• nathanbunn

    (@nathanbunn)


    I want to have my blog page recognize that there is more than one post. When it recognizes that there is more than one post on my page, I want it to insert a <div> in between them. Pages that have just one post will not have a <div> after the post. The <div> will be stylized using CSS and will act like a separating bar. How do I do that using WordPress? Is there something that can pick out if there are multiple posts?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Chip Bennett

    (@chipbennett)

    What Theme are you using?

    Thread Starter nathanbunn

    (@nathanbunn)

    I’m making my own. I downloaded a starter theme from http://wpcandy.com/made/the-wordpress-starter-theme-project (I haven’t touched themes in a long time and I need to understand the structure fully to really make my own). I’ve modified it by adding new elements in but I have kept the core intact.

    Chip Bennett

    (@chipbennett)

    Ah, ok, then.

    Next question: what template files have you modified, if any?

    WordPress, by defualt, recognizes if more than one post is being displayed. Multiple posts are displayed in an “index” page, and single posts are displayed in a “single” page. The Template Hierarchy dictates which template file is used in each view.

    More than likely, you will need to modify the markup inside the Loop, in your index.php template file (or, alterately, the loop.php template file, if it exists).

    Thread Starter nathanbunn

    (@nathanbunn)

    Mainly header.php and footer.php 😛 The most I’ve done to index.php and single.php is add a date icon.

    Here is the entire code, in between the get_header and get_footer functions:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    for any other page (including index.php, if I have 11 posts and 10 are displayed on my front page) that contains one blog post.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding elements to my blog page when there is more than one post’ is closed to new replies.