WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Inserting a new column of posts on homepage

[Resolved] Inserting a new column of posts on homepage

  • I want to insert a new column of posts for a specific category, next to the main column of posts – I don’t know enough php to do this myself so how may I go about it?

    I’m using a modified version of the Origin theme (WordPress 3.4.2) I hope someone can help here.

Viewing 1 replies (of 1 total)
  • Okay well I solved my own problem. I added a new div, pasted a post loop inside, and to specify the number and type of posts I wanted the column to list, I inserted the following code in the relevant template (for me, that’s the index.php file) below the start of the div code “<div class=”[name]”> “

    <?php
     $topbox = get_posts('numberposts=3&category=8');
     foreach($topbox as $post) :
        setup_postdata($post);
     ?>
    
    --content, e.g. post title, thumbnail info, excerpt info goes here--
    
     <?php endforeach; ?>
    </div>

    Edit how you see fit.

    Then I changed the width of columns via CSS so they appear on the homepage.

    I can’t say if my solution is the correct and cleanest way, but so far it’s working fine.

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Inserting a new column of posts on homepage’ is closed to new replies.
Skip to toolbar