• Hello WordPress Wizards.

    I have done some googling for this and all of the results seem to be very vague ‘please do all the work for me’ posts and unsurprisingly no one has had the patients to help resolved them.

    All i an looking to do is to wrap each search result in a div so that i can customise the look. This is what i have so far:

    Inside the loop i have found:

    <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
    			<?php the_excerpt(); ?>
    <?php else : ?>

    So within this i have simply appended an opening and closing of a div before and after the excerpt(); like so:

    ?php echo '<div id="searchResult">' . the_excerpt() . '</div>' ?>

    However this doesn’t behave as i would expect. When i do a search it adds both the opening and closing after the each search result. Am i editing the right section of the loop or is it just my php?

    Cheers in advance.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Try looking in your theme’s search.php template file.

    Thread Starter frankfolk

    (@frankfolk)

    I am using a theme called starkers which is essentially a empty theme. So i have been coding it from the ground up. That wont do me any good because currently all the search.php does is call in the search function from the loop.

    Call in what search function?

    Thread Starter frankfolk

    (@frankfolk)

    get_template_part( ‘loop’, ‘search’ );

    You can replace that with your own search loop.

    Thread Starter frankfolk

    (@frankfolk)

    yes, but since the current loop does everything i want other than allowing me to style it i’d prefer to keep it’s current functionality. I’m just looking for where in the loop i can append a div around each result.

    Try creating your own loop-search.php template file.

    Thread Starter frankfolk

    (@frankfolk)

    I’ve said that i don’t want to do that, but i can see i’m going to have to. Thanks anyway.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Editing search results.’ is closed to new replies.