【问题标题】:Wordpress search results in columns列中的 Wordpress 搜索结果
【发布时间】:2018-09-07 06:49:38
【问题描述】:

我正在尝试设置我的 Wordpress 搜索结果的样式,以便它们出现在列中(每行 3 列),但不知何故它不起作用。也许你能帮助我?我用谷歌搜索了这个问题,并尝试将 while 循环放在行 div 中,但这不起作用。网址是:www.medical-promotion.de

感谢您的帮助! :)

以下是主题提供的代码。

 <?php
    /**
    * Search
    */
    ?>
<?php get_header(); ?>

<section class="site-content">
 <div class="container">
  <?php if( have_posts()) : ?>
   <div class="row">
    <?php while ( have_posts()) : the_post(); ?>
     <div class="col-lg-4 col-sm-4 col-xs-12">
      <div class="blog_large">
       <?php
        $aneeq_post_slide = get_post_meta( $post->ID, 'aneeq_all_post_slides_settings_'.$post->ID, true);
        //blog option settings
        $aneeq_option_settings = get_option('aneeq_blog_settings');
        //feature img url
        $aneeq_url = wp_get_attachment_url( get_post_thumbnail_id($post->ID), 'thumbnail' ); 
        ?>
         <article class="post">                         
          <figure class="post_img">
            <a href="<?php the_permalink(); ?>">
              <?php if($aneeq_url != NULL) { the_post_thumbnail(); } ?>
            </a>
          </figure>                             
            <div class="post_date">
                <span class="day"><?php echo get_the_date('j'); ?></span>
                <span class="month"><?php echo get_the_date('M'); ?></span>
            </div>
            <div class="post_content">
                <div class="post_meta">
                    <h2>
                    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                    </h2>
                <div class="metaInfo">
                    <span><i class="fa fa-user"></i> <?php esc_html_e('By', 'aneeq') ?> <a href="<?php echo esc_url(get_author_posts_url(get_the_author_meta('ID'))); ?>"><?php the_author(); ?></a> </span>
                <?php if (has_category()) : ?>  
                        <span><i class="fa fa-th-list"></i>
                            <a href="#"><?php the_category('&nbsp;,&nbsp');?></a> 
                        </span>
                <?php endif; ?>

            </div>
            </div>
            <?php the_content(); ?>
            </div>
            </article>
            </div>
            </div>

    </div><!--/.row-->
    </div> <!--/.container-->
    </section>
<?php get_footer(); ?>

【问题讨论】:

  • 那个文件名是什么?
  • 文件名为search.php

标签: php wordpress search


【解决方案1】:

请看下图。这是您共享的文件的输出。

正如您在 post_content div 内和 post_meta div 下看到的那样,这是搜索列表所在的位置,而不是在 row 类所在的位置更高。

在您的代码中,该块的输出与以下语句相关。

<?php the_content(); ?>

所以,看起来页面的内容是动态拉入的。查看 WordPress 管理部分(当您编辑搜索页面时),看看那里是否有任何线索。

否则,请在主题目录的文件中搜索 fsn-row full-width-row 类。这将为您提供要编辑哪个文件的线索。

【讨论】:

  • 很棒的 Sonja,很高兴我的帮助帮助您解决了这个问题。而且,不错的网站!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-01-14
  • 2019-03-11
  • 2018-03-11
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多