treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Homepage Help

  • Does anyone have a good suggestion on how to execute this? What I'm looking to do is have a homepage that is broken up into 3 columns. The first two columns I want to be editable through the CMS. The final right column I wanted to have recent posts coming in.

    I was thinking initially to maybe just do 3 separate post loops and query a specific post id for the left and middle columns and then just exclude that post category from the right.

    Am I overthinking it?
  • Personally, I would do it like this:

    Column 1: import/include a page
    Column 2: import/include a page
    Column 3: the posts loop

    The contents for the first two columns would just be pages with an empty template (no header, footer, or any divs -- just basic content). To include these pages on your homepage, you can use this code:

    $include = get_pages('include=14');
    $content = apply_filters('the_content',$include[0]->post_content);
    echo $content;
    Where the example "14" would be the ID of your page. So all in all:

    <div id="column-01">
    <?php
    $include = get_pages('include=14');
    $content = apply_filters('the_content',$include[0]->post_content);
    echo $content;
    ?>
    </div>

    <div id="column-02">
    <?php
    $include = get_pages('include=15');
    $content = apply_filters('the_content',$include[0]->post_content);
    echo $content;
    ?>
    </div>

    <div id="column-03">
    [ THE WHOLE LOOP THING HERE ]
    </div>
    Then again, I'm sure there's better ways, it's just what would work best for me.
  • Plugin: Advanced Custom Fields.

    You can set up two WYSIWYG areas on your 'Home Page' then run a loop in the third column with query_posts.
  • Awesome thanks guys I'm going to look at both of them. Appreciate the feedback.
  • Thanks again for the info. I ended up employing Senff's solution and it was a very excellent way of integrating everything. I'm looking into the other plugin though... I want to explore more how I can use that in the future :)
  • I would have done what yo originally said, except that the column on the rght could use a widget area with the "recent posts" widget.
  • Senff, how would I do something similar to this. I want a grid of thumbnails on my homepage that each link to a separate page. These thumbnails would pull from the featured image of that page. The page title will also be displayed above each thumbnail.

    Similar to http://demo.graphpaperpress.com/mixfolio/ in a way but those thumbnails would be pulling from pages and not images.

    Thanks!