WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Inserting a new column of posts on homepage (2 posts)

  1. Caneval
    Member
    Posted 1 year ago #

    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.

  2. Caneval
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic