WordPress.org

Ready to get started?Download WordPress

Forums

Quark
[resolved] Search results only displays full post (3 posts)

  1. R_Hemingway
    Member
    Posted 9 months ago #

    Hi all,

    I'm having an issue where my search results are only displaying a 'full post'.

    This would be ok but unfortunately I'm using a table plugin to create sortable jquery tables on some pages & posts, and when displaying results it strips out all the formatting and making it look terrible

    See my test site for example.

    Under settings I have checked the box for excerpts, but no joy!

    Any help much appreciated!

  2. ahortin
    Member
    Theme Author

    Posted 9 months ago #

    You have two options here. The first option is to simply insert a ‘More tag’ into your content by clicking the ‘Insert More Tag’ button on the Editor Toolbar. When you insert a “More” tag into your Post/Page, everything prior to the tag is considered as a ‘teaser’ and so you wont get the full content displaying.

    Alternatively, override the content.php file in your child theme by making a copy of this file and then changing the section that displays the search results. Instead of using the_content(), change this to use the_excerpt().

  3. R_Hemingway
    Member
    Posted 9 months ago #

    Got it!

    The comment on the 1st line confused me:

    <?php if ( is_search() ) { // Only display Excerpts for Search ?>

    But i've swapped out the_content for the_excerpt and it's fine now.

    Didn't want to use the 'more' tag because I am using custom excerpts.

    Thanks for your help!

Reply

You must log in to post.

About this Theme

About this Topic

Tags

No tags yet.