Custom search results layout
-
Hi,
I want to easily change the layout of the search results page, without making a lot of code changes or new files etc.
The search page is
if($format == '') get_template_part( 'includes/post-formats/standard' );Therefore I am editing the standard post page.
I want to remove the p tag from excerpt IF it is on search page and then echo the excerpt for my permalink to show correctly underneath, but I can’t get it working properly.
The code on standard is:
<div class="excerpt"> <?php $content = get_the_content(); $excerpt = get_the_excerpt(); if (has_excerpt() && (!is_search)) { the_excerpt(); else (is_search()) { $myExcerpt = get_the_excerpt(); $tags = array("<p>", "</p>"); $myExcerpt = str_replace($tags, "", $myExcerpt); echo $myExcerpt; } } else { if(!is_search()) { echo my_string_limit_words($content,135); } else { echo my_string_limit_words($excerpt,135); } } if(is_search()) { echo '<p><span class="search-permalink">'; the_permalink(); echo'</span></p>'; } ?> </div>I hope you can help me out 🙂
Cheers,
Kenn Nielsen
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Custom search results layout’ is closed to new replies.