将搜索结果从仅摘录更改为全文

时间:2017-05-10 作者:sasha123

我用的是画布主题,这就是内容搜索的方式。php看起来像

<?php
/**
 * Post Content Template
 *
 * This template is the default page content template. It is used to display the content of the
 * `single.php` template file, contextually, as well as in archive lists or search results.
 *
 * @package WooFramework
 * @subpackage Template
 */

/**
 * Settings for this template file.
 *
 * This is where the specify the HTML tags for the title.
 * These options can be filtered via a child theme.
 *
 * @link http://codex.wordpress.org/Plugin_API#Filters
 */

$settings = array(
                \'thumb_w\' => 100,
                \'thumb_h\' => 100,
                \'thumb_align\' => \'alignleft\',
                \'post_content\' => \'excerpt\',
                \'comments\' => \'both\'
                );

$settings = woo_get_dynamic_values( $settings );

$title_before = \'<h1 class="title entry-title">\';
$title_after = \'</h1>\';

if ( ! is_single() ) {
    $title_before = \'<h2 class="title entry-title">\';
    $title_after = \'</h2>\';
$title_before = $title_before . \'<a href="\' . esc_url( get_permalink( get_the_ID() ) ) . \'" rel="bookmark" title="\' . the_title_attribute( array( \'echo\' => 0 ) ) . \'">\';
$title_after = \'</a>\' . $title_after;
}

$page_link_args = apply_filters( \'woothemes_pagelinks_args\', array( \'before\' => \'<div class="page-link">\' . __( \'Pages:\', \'woothemes\' ), \'after\' => \'</div>\' ) );

woo_post_before();
?>
<article <?php post_class(); ?>>
<?php
    woo_post_inside_before();
    if ( \'content\' != $settings[\'post_content\'] && ! is_singular() )
        woo_image( \'width=\' . esc_attr( $settings[\'thumb_w\'] ) . \'&height=\' . esc_attr( $settings[\'thumb_h\'] ) . \'&class=thumbnail \' . esc_attr( $settings[\'thumb_align\'] ) );
?>
    <header>
        <?php the_title( $title_before, $title_after ); ?>
    </header>
<?php
    woo_post_meta();
?>
    <section class="entry">
        <?php
             the_excerpt();
        ?>
    </section><!-- /.entry -->
    <div class="fix"></div>
<?php
    woo_post_inside_after();
?>
</article><!-- /.post -->
<?php
woo_post_after();
$comm = $settings[\'comments\'];
if ( ( \'post\' == $comm || \'both\' == $comm ) && is_single() ) { comments_template(); }
?>
这是我的搜索。php

<?php
/**
 * Search Template
 *
 * The search template is used to display search results from the native WordPress search.
 *
 * If no search results are found, the user is assisted in refining their search query in
 * an attempt to produce an appropriate search results set for the user\'s search query.
 *
 * @package WooFramework
 * @subpackage Template
 */

 get_header();
 global $woo_options;
?>      
    <!-- #content Starts -->
    <?php woo_content_before(); ?>
    <div id="content" class="col-full">

        <div id="main-sidebar-container">    

            <!-- #main Starts -->
            <?php woo_main_before(); ?>
            <section id="main" class="col-left">

            <?php get_template_part( \'loop\', \'search\' ); ?>

            </section><!-- /#main -->
            <?php woo_main_after(); ?>

            <?php get_sidebar(); ?>

        </div><!-- /#main-sidebar-container -->         

        <?php get_sidebar( \'alt\' ); ?>       

    </div><!-- /#content -->
    <?php woo_content_after(); ?>

<?php get_footer(); ?>
谢谢!

1 个回复
SO网友:rudtek

根据您的第二段代码,您正在寻找循环搜索。php。

如果您确定它正在使用内容搜索,请更改此行:

 <section class="entry">
        <?php
             the_excerpt();
        ?>
    </section><!-- /.entry -->

 <section class="entry">
        <?php
             the_content();
        ?>
    </section><!-- /.entry -->
或为内容添加更多细节:

the_content( \'Continue reading \' . get_the_title() );

结束

相关推荐

Search query with Ajax

我正在运行一个$wpdb 选择查询并从文本框中获取其参数。结果显示只要我按下搜索按钮,但我想用Ajax做同样的事情,而不刷新页面。我什么都试过了,但页面仍在刷新。jQuery代码:jQuery(document).ready(function() { jQuery(\"#Submityourskill\").click(function(){ jQuery.post(yes.ajaxurl,{action : \'doit\'},