• Hi, I have just begun using the Twenty Sixteen theme and I would like to modify it slightly to add a divider or separator between posts where there is a list of multiple posts. I have tried multiple ways of doing this but I have not been able to get it to work. Can someone help me do this? The divider or separator can be something like a horizontal line.

    PS I have created a child theme for the modifications.

    Thanks

    • This topic was modified 5 years, 4 months ago by ChuckC3.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter ChuckC3

    (@chuckc3)

    Let me be more specific about my question – I have found some code I would like to add to the twentysixteen template but I’m not sure where to add it. Here is the code:

    <?php
    if (($wp_query->current_post + 1) < ($wp_query->post_count)) {
    echo ‘<div class=”post-item-divider”>Post Divider</div>’;
    }
    ?>

    The above code should go inside the loop that displays a series of posts at the end of the loop. Where would I add this code in the twentysixteen template?

    Thread Starter ChuckC3

    (@chuckc3)

    OK, I have answered my own question. The place to enter this code is in Index.PHP and it goes in here:

    get_template_part( ‘template-parts/content’, get_post_format() );

    echo ‘xxxx’;

    // End the loop.
    endwhile;

    You can insert whatever you want.

    Thread Starter ChuckC3

    (@chuckc3)

    One more thing…if you want the divider or separator to appear in lists of posts in a category, you need to insert code into that loop inside Archive.PHP here:

    get_template_part( ‘template-parts/content’, get_post_format() );

    echo ‘xxxx’;

    // End the loop.
    endwhile;

    If you want to look at how I’ve done it, you can look at my site at:

    https://managedagile.com/

    • This reply was modified 5 years, 4 months ago by ChuckC3.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add a Divider or Separator Between Posts’ is closed to new replies.