Wordpress search results in columns

Sonja

New Member
#1
I'm trying to style my Wordpress search results so that they appear in columns (3 columns per row) but somehow it's not working. Maybe you can help me? I've googled this problem and tried placing the while loop inside the row div but that wouldn't work. The site is: www.medical-promotion.de
Thanks for your help! :)
Below is the code provided by the theme.

Mã:
 <?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(); ?>
 

Admin

Administrator
Thành viên BQT
#2
Have a look at the below image. That's the output of the file you shared.

Csh5F.png

As you can see within the post_content div and underneath the post_meta div that's where the search list is located, not way up higher where the row class is.

In your code, the output of that block relates to the following statement.
Mã:
<?php the_content(); ?>
So, it looks like the content of the page is pulled in dynamically. Have a look in the WordPress admin section (when you edit the search page) and see if anything there gives you a clue.

Else, search for the fsn-row full-width-row classes within the files of your theme directory. This will give you a clue which file to edit.
 
Top