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

  1. Caneval
    Posted 3 years 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
    Posted 3 years 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]"> "

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

    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