• Resolved kenlbrown

    (@kenlbrown)


    Greetings… this question seems to have been answered and has worked for others but I can not get it to work myself.

    In my child-theme I have edited added the following CSS:
    post-list .page { width: 33%; float: left; }

    Also in my child-theme I have edited index.php

    <div class="post-list group">
    	<?php $i = 1; echo '<div class="post-row">'; while ( have_posts() ): the_post(); ?>
    		<?php get_template_part('content'); ?>
    	<?php if($i % 3 == 0) { echo '</div><div class="post-row">'; } $i++; endwhile; echo '</div>'; ?>
    </div><!--/.post-list-->

    What it’s doing is dropping the 3rd post in a row down to a row by itself.

    The site in question is https://airmaxxx.com

    Any help with this would be greatly appreciated!

    Thanks in advance!

    Ken

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi Ken. You almost have it. The php modifications are correct. In your CSS, “page” is a class that would be on the <body> tag if you were using a page template. Only thing you need to change is to target the posts:

    post-list .post { width: 33%; float: left; }
    Thread Starter kenlbrown

    (@kenlbrown)

    Ahhhh … good find man, that would have taken me more time to figure out… mucho gracias!

    You’re welcome; glad to help.

    Thread Starter kenlbrown

    (@kenlbrown)

    Greetings…
    I know I have this marked as “resolved” but I ran into an issue with this in the posts categories. It’s dropping the 3rd item down to a second line and because the post-list .post { width: 33%; float: left; } controls the categories as well, modifying this CSS affects the layout on the home page.

    https://airmaxxx.com/ ### is correctly displayed
    https://airmaxxx.com/category/air-compressors/ ### drops the 3rd item down a line

    Not sure if the width of the sidebar is the issue or the container padding (tried editing those with no success).

    Any ideas?

    Thanks in advance!

    Ken

    You need to make the same change in archive.php that you made in index.php.

    Thread Starter kenlbrown

    (@kenlbrown)

    Brilliant! I was looking for category.php since I’ve been used to working with twenty-thirteen for a few years.

    Mucho Gracias!

    De nada.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘home page post-list 3 columns’ is closed to new replies.