Wordpress search bar outputting only posts titles

為{幸葍}努か 提交于 2019-12-06 06:59:48

The problem is that content-search.php also contains a header and a loop. It should only contain the sections of code you want to reuse for each item in the main loop, by using something like this in content-search.php:

  <div class="row-posts-container">
    <div class="row-posts">
      <div class="posts col-lg-12 hidden-sm col-md-12 hidden-xs">
        <a href="<?php the_permalink(); ?>"><?php $first = str_replace(' | ', '<br />', get_the_title()); echo str_replace('REPLACE_ME', '<i>REPLACE_ME</i>', $first);?></a>
      </div>
    </div>

Do this are trying to access a wrong template file

while ( have_posts() ) : the_post();
     /* Make sure the template is your content.php */
      get_template_part('content', 'search');
endwhile;

You need to do this because the file name is content-search.php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!