当前位置: 首页>>代码示例>>PHP>>正文


PHP the_search_query函数代码示例

本文整理汇总了PHP中the_search_query函数的典型用法代码示例。如果您正苦于以下问题:PHP the_search_query函数的具体用法?PHP the_search_query怎么用?PHP the_search_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了the_search_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: description

function description()
{
    if (is_home() || is_front_page()) {
        echo trim(of_get_option('site_description'));
    } elseif (is_category()) {
        $description = strip_tags(category_description());
        echo trim($description);
    } elseif (is_single()) {
        if (get_the_excerpt()) {
            echo get_the_excerpt();
        } else {
            global $post;
            $description = trim(str_replace(array("\r\n", "\r", "\n", " ", " "), " ", str_replace("\"", "'", strip_tags($post->post_content))));
            echo mb_substr($description, 0, 220, 'utf-8');
        }
    } elseif (is_search()) {
        echo '“';
        the_search_query();
        echo '”为您找到结果 ';
        global $wp_query;
        echo $wp_query->found_posts;
        echo ' 个';
    } elseif (is_tag()) {
        $description = strip_tags(tag_description());
        echo trim($description);
    } else {
        $description = strip_tags(term_description());
        echo trim($description);
    }
}
开发者ID:carpliyz,项目名称:9IPHP,代码行数:30,代码来源:header.php

示例2: widget

    function widget($args, $instance)
    {
        ?>
	<div class="sidebar-section search">
	    <form class="cf searchform" method="get" action="<?php 
        echo esc_url(home_url('/'));
        ?>
">
		<div>
		    <label class="assistive-text" for="s"><?php 
        _e('Search for:', OP_SN);
        ?>
</label>
		    <div class="search-text-input"><input type="text" value="<?php 
        the_search_query();
        ?>
" name="s" id="s" /></div>
		    <input type="submit" id="searchsubmit" value="<?php 
        esc_attr_e('Search', OP_SN);
        ?>
" />
		</div>
	    </form>
	</div>
	<?php 
    }
开发者ID:JalpMi,项目名称:v2contact,代码行数:26,代码来源:op_SidebarSearchWidget.php

示例3: the_breadcrumb

function the_breadcrumb()
{
    echo '<div class="e-breadcrumbs">';
    echo '<a href="';
    echo get_option('home');
    echo '">';
    bloginfo('name');
    echo "</a>";
    if (is_category() || is_single()) {
        echo "&nbsp;&nbsp;&#187;&nbsp;&nbsp;";
        the_category(' &bull; ');
        if (is_single()) {
            echo " &nbsp;&nbsp;&#187;&nbsp;&nbsp; ";
            the_title();
        }
    } elseif (is_page()) {
        echo "&nbsp;&nbsp;&#187;&nbsp;&nbsp;";
        echo the_title();
    } elseif (is_search()) {
        echo "&nbsp;&nbsp;&#187;&nbsp;&nbsp;Search Results for... ";
        echo '"<em>';
        echo the_search_query();
        echo '</em>"';
    }
    echo '</div>';
}
开发者ID:aIbarrab,项目名称:cbrclub,代码行数:26,代码来源:breadcrumbs.php

示例4: widget

    function widget($args, $instance)
    {
        extract($args);
        $categories = get_categories();
        echo $before_widget;
        ?>
				
			<div class="widget">
				<h4><?php 
        echo apply_filters('widget_title', $instance['heading']);
        ?>
</h4>
				<form action="<?php 
        echo esc_url(home_url('/'));
        ?>
" method="get">
					<div class="input-group">
						<input type="text" class="form-control" placeholder="Search" name="s" value="<?php 
        the_search_query();
        ?>
">
						<span class="input-group-btn">
							<button class="btn" type="submit"><i class="fa fa-search"></i></button>
						</span>
					</div>
				</form>
			</div>
		<?php 
        echo $after_widget;
    }
开发者ID:juhando,项目名称:zen,代码行数:30,代码来源:search.php

示例5: widget

    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        echo $before_widget;
        $getimage = $instance['fotos_search_bg'];
        $getsearchbtn = $instance['fotos_search_btn'];
        $bgimage = $getimage ? sprintf('style="background:url(\'%s\') no-repeat;"', $getimage) : false;
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        printf('<div class="fotos-custom-search-widget" %s>', $bgimage);
        ?>
				<form action="/" method="get" class="fotos-custom-search-form">
				    <fieldset>
				        <input type="text" name="s" id="search" placeholder="search" value="<?php 
        the_search_query();
        ?>
" />
				        <input type="image" alt="Search" src="<?php 
        echo $getsearchbtn;
        ?>
" />
				    </fieldset>
				</form>
        	<?php 
        printf('</div>');
        echo $after_widget;
    }
开发者ID:steffancarrington,项目名称:fotos,代码行数:28,代码来源:custom-search.php

示例6: search_widget

function search_widget()
{
    ?>
	<li id="search_widget" class="widget widget_search">
<?php 
    if (!is_dynamic_sidebar()) {
        ?>
<h2><?php 
        _e('Etc', 'depo-masthead');
        ?>
</h2><?php 
    }
    ?>
<form method="get" id="searchform" action="<?php 
    bloginfo('url');
    ?>
/">
<label class="hidden" for="s"><?php 
    _e('Search for:');
    ?>
</label>
<div><input type="text" value="<?php 
    the_search_query();
    ?>
" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form></li><?php 
}
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:29,代码来源:functions.php

示例7: widget

        function widget($args, $instance)
        {
            extract($args);
            echo $before_widget;
            $search_type = yit_get_option('search_type');
            if (!is_shop_installed() && $search_type == 'product') {
                $search_type = 'post';
            }
            ?>

		<form action="<?php 
            echo home_url('/');
            ?>
" method="get" class="search_mini">
			<input type="text" name="s" id="search_mini" value="<?php 
            the_search_query();
            ?>
" placeholder="<?php 
            if (is_shop_installed()) {
                _e('search for products', 'yit');
            } else {
                _e('search for...', 'yit');
            }
            ?>
" />
			<input type="hidden" name="post_type" value="<?php 
            echo $search_type;
            ?>
" />
			<input type="submit" value="Search" id="mini-search-submit" />
		</form>

<?php 
            echo $after_widget;
        }
开发者ID:gloomyghost,项目名称:Tip-Top-Art,代码行数:35,代码来源:search_mini.php

示例8: widget

        function widget($args, $instance)
        {
            extract($args);
            echo $before_widget;
            $search_type = yit_get_option('search_type');
            if (!is_shop_installed() && $search_type == 'product') {
                $search_type = 'post';
            }
            ?>

        <a href="#" class="search_mini_button"></a>
        <div class="search_mini_content">
            <span class="dropdown_arrow"></span>

            <?php 
            if (defined('YITH_WCAS')) {
                ?>
                <?php 
                echo do_shortcode('[yith_woocommerce_ajax_search]');
                ?>
            <?php 
            } else {
                ?>
                <form action="<?php 
                echo home_url('/');
                ?>
" method="get" class="search_mini">
                    <input type="text" name="s" id="search_mini" value="<?php 
                the_search_query();
                ?>
" placeholder="<?php 
                if (is_shop_installed()) {
                    _e('search for products', 'yit');
                } else {
                    _e('search for...', 'yit');
                }
                ?>
" /><input type="submit" value="" id="mini-search-submit" />
                    <input type="hidden" name="post_type" value="<?php 
                echo $search_type;
                ?>
" />
                </form>
            <?php 
            }
            ?>
        </div>
<?php 
            echo $after_widget;
        }
开发者ID:jayeshnair,项目名称:ctp,代码行数:50,代码来源:search_mini.php

示例9: widget

        function widget($args, $instance)
        {
            extract($args);
            echo $before_widget;
            $search_for_product = apply_filters('yit_search_for_prod_label', __('search for products', 'yit'));
            $search_for = apply_filters('yit_searc_for_prod_label', __('search for...', 'yit'));
            $placeholder = is_shop_installed() ? $search_for_product : $search_for;
            if (defined('YITH_WCAS')) {
                ?>
            <?php 
                echo do_shortcode('[yith_woocommerce_ajax_search]');
                ?>
        <?php 
            } else {
                $search_type = yit_get_option('search_type');
                if (!is_shop_installed() && $search_type == 'product') {
                    $search_type = 'post';
                }
                ?>


        <form action="<?php 
                echo home_url('/');
                ?>
" method="get" class="search_mini">
            <input type="text" name="s" id="search_mini" value="<?php 
                the_search_query();
                ?>
" placeholder="<?php 
                echo $placeholder;
                ?>
" />
            <input type="hidden" name="post_type" value="<?php 
                echo $search_type;
                ?>
" />
            <input type="submit" value="<?php 
                _e('Search', 'yit');
                ?>
" id="mini-search-submit" />
        </form>

        <?php 
            }
            echo $after_widget;
        }
开发者ID:VitaliyProdan,项目名称:wp_shop,代码行数:46,代码来源:search_mini.php

示例10: the_qa_search_form

function the_qa_search_form()
{
    ?>
<form method="get" action="<?php 
    echo qa_get_url('archive');
    ?>
">
	<input type="text" name="s" value="<?php 
    the_search_query();
    ?>
" />
	<button><?php 
    _e('Search', QA_TEXTDOMAIN);
    ?>
</button>
</form>
<?php 
}
开发者ID:rgrp,项目名称:wordpress-qa,代码行数:18,代码来源:template-tags.php

示例11: rd_search

function rd_search($atts, $content)
{
    extract(shortcode_atts(array('t_color' => '', 'bg_color' => '', 'b_color' => '', 'h_color' => '', 'placeholder' => 'Search', 'margin_top' => '0', 'margin_bottom' => '0', 'animation' => '', 'width' => '', 'radius' => '0'), $atts));
    ob_start();
    $id = RandomString(20);
    global $rd_data;
    if ($t_color == '') {
        $t_color = $rd_data['rd_content_text_color'];
    }
    if ($b_color == '') {
        $b_color = $rd_data['rd_content_border_color'];
    }
    if ($bg_color == '') {
        $bg_color = $rd_data['rd_content_bg_color'];
    }
    if ($h_color == '') {
        $h_color = $rd_data['rd_content_hover_color'];
    }
    if ($placeholder == '') {
        $placeholder = "Search";
    }
    if ($width !== '') {
        echo '<style>#rd_' . $id . ' {width:' . $width . 'px;}</style>';
    }
    echo '<style>#rd_' . $id . ' {margin-top:' . $margin_top . 'px; margin-bottom:' . $margin_bottom . 'px;}#rd_' . $id . ' #search input[type=text]{background:' . $bg_color . '; border:1px solid ' . $b_color . '; color:' . $t_color . '; border-radius:' . $radius . 'px;}#rd_' . $id . ' #search input[type=submit]{color:' . $t_color . '}#rd_' . $id . ' #search input[type=submit]:hover{color:' . $h_color . '}</style>';
    echo '<div class="rd_search_sc ' . $animation . '" id="rd_' . $id . '"><div id="search">';
    ?>
<form method="get" action="<?php 
    echo esc_url(home_url(""));
    ?>
"><input type="text" name="s" placeholder="<?php 
    echo esc_attr($placeholder);
    ?>
" class="search"  value="<?php 
    echo the_search_query();
    ?>
"/><input type="submit" id="searchsubmit" value=""></form>

			</div></div> <?php 
    $output_string = ob_get_contents();
    ob_end_clean();
    return $output_string;
}
开发者ID:axelander95,项目名称:wsguiavirtualpichincha,代码行数:43,代码来源:rd_search.php

示例12: wootique_header_search

function wootique_header_search()
{
    global $woo_options;
    ?>
	<div id="search-top">
		    
    	<form role="search" method="get" id="searchform" class="searchform" action="<?php 
    echo home_url();
    ?>
">
			<label class="screen-reader-text" for="s"><?php 
    _e('Search for:', 'woothemes');
    ?>
</label>
			<input type="text" value="<?php 
    the_search_query();
    ?>
" name="s" id="s"  class="field s" placeholder="<?php 
    _e('Search for products', 'woothemes');
    ?>
" />
			<input type="image" class="submit btn" name="submit" value="<?php 
    _e('Search', 'woothemes');
    ?>
" src="<?php 
    echo get_template_directory_uri();
    ?>
/images/ico-search.png">
			<?php 
    if ($woo_options['woo_header_search_scope'] == 'products') {
        echo '<input type="hidden" name="post_type" value="product" />';
    } else {
        echo '<input type="hidden" name="post_type" value="post" />';
    }
    ?>
	
		</form>
		<div class="fix"></div>

	</div><!-- /.search-top -->
	<?php 
}
开发者ID:ridwanahmedkhan,项目名称:E-Commerce_Wordpress,代码行数:42,代码来源:theme-woocommerce.php

示例13: widget_chaostheory_search

function widget_chaostheory_search($args)
{
    extract($args);
    if (empty($title)) {
        $title = __('Search', 'chaostheory');
    }
    ?>
		<?php 
    echo $before_widget;
    ?>

			<?php 
    echo $before_title;
    ?>
<label for="s"><?php 
    echo $title;
    ?>
</label><?php 
    echo $after_title;
    ?>
			<form id="searchform" method="get" action="<?php 
    echo home_url();
    ?>
">
				<div>
					<input id="s" name="s" type="text" value="<?php 
    the_search_query();
    ?>
" size="10" />
					<input id="searchsubmit" type="submit" value="<?php 
    esc_attr_e('Find &raquo;', 'chaostheory');
    ?>
" />
				</div>
			</form>
		<?php 
    echo $after_widget;
    ?>

<?php 
}
开发者ID:darrylivan,项目名称:caraccidentlawyerflagstaff.com,代码行数:41,代码来源:widgets.php

示例14: display

    function display($args)
    {
        extract($args);
        echo $before_widget;
        ?>
<form method="get" id="searchform" action="<?php 
        bloginfo('home');
        ?>
/">
	<input class="text" type="text" value="<?php 
        the_search_query();
        ?>
" name="s" id="s" />
	<input class="button-secondary" type="submit" id="searchsubmit" value="<?php 
        _e('Search', 'guangzhou');
        ?>
" />
</form>
		<?php 
        echo $after_widget;
    }
开发者ID:billerby,项目名称:Surdeg,代码行数:21,代码来源:search.php

示例15: section_template

   function section_template() { 	
	
		if(is_category() || is_archive() || is_search()):
		
		?>
		
			<div class="current_posts_info">
				<?php if(is_search()):?>
					<?php _e("Search results for ", 'pagelines');?> 
					<strong>"<?php the_search_query();?>"</strong>
				<?php elseif(is_category()):?>
					<?php _e("Currently viewing the category: ", 'pagelines');?> 
					<strong>"<?php single_cat_title();?>"</strong>
				<?php elseif(is_tag()):?>
					<?php _e("Currently viewing the tag: ", 'pagelines');?>
					<strong>"<?php single_tag_title(''); ?>"</strong>
				<?php elseif(is_archive()):?>
					<?php if (is_author()) { 
						global $author;
						global $author_name;
						$curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
						_e('Posts by:', 'pagelines'); ?>
						<strong><?php echo $curauth->display_name; ?></strong>
					<?php } elseif (is_day()) {	?>
					 	<?php _e('From the daily archives:', 'pagelines'); ?>
						<strong><?php the_time('l, F j, Y'); ?></strong>
					<?php } elseif (is_month()) { ?>
						<?php _e('From the monthly archives:', 'pagelines'); ?>
						<strong><?php the_time('F Y'); ?></strong>
					<?php } elseif (is_year()) { ?>
						<?php _e('From the yearly archives:', 'pagelines'); ?>
						<strong><?php the_time('Y'); ?></strong>
					<?php } else {?> 
						<?php _e("Viewing archives for ", 'pagelines');?>
						<strong>"<?php the_date();?>"</strong>
					<?php } ?>
				<?php endif;?>
			</div>
		<?php endif;
	}
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:40,代码来源:section.postsinfo.php


注:本文中的the_search_query函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。