• calidude38

    (@calidude38)


    I have a blog set up with a static page for the home page. I want to be able to display posts on the static page in 3 columns. I plan on having 3 posts a day show up on this one page and in a column layout. I heave searched for plugins to do this without success. Does anyone know how I can get only posts for that day to show on a page?

    Thanks in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Michael

    (@alchymyth)

    http://codex.wordpress.org/Template_Tags/query_posts#Time_Parameters

    Returns posts for just the current date:

    $today = getdate();
    query_posts(‘year=’ .$today[“year”] .’&monthnum=’ .$today[“mon”] .’&day=’ .$today[“mday”] );

    http://codex.wordpress.org/Pages
    http://codex.wordpress.org/Pages#Page_Templates

    Thread Starter calidude38

    (@calidude38)

    So if this is my page.php of my theme where in here would I put it? I am a little lost with the instruction of The Loop.

    <div id=”content”>

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class=”post fix” id=”post-<?php the_ID(); ?>”>

    Michael

    (@alchymyth)

    query_posts() comes before the beginning of the loop:

    <div id="content">
    
    <?php $today = getdate();
    query_posts('year=' .$today["year"] .'&monthnum=' .$today["mon"] .'&day=' .$today["mday"] . 'posts_per_page=3' ); ?>
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="post fix" id="post-<?php the_ID(); ?>">
    Thread Starter calidude38

    (@calidude38)

    Wow, thanks that worked great!! One more thing <grin> If I wanted to limit which categories posts would show on this page, could I do this here also?

    Thanks so much for the help. I have spent way too many hours trying to figure this out on my own.

    Bob

    Michael

    (@alchymyth)

    http://codex.wordpress.org/Template_Tags/query_posts#Category_Parameters

    query_posts('year=' .$today["year"] .'&monthnum=' .$today["mon"] .'&day=' .$today["mday"] . 'posts_per_page=3&cat=7' ); ?>

    shows 3 posts of today, from cat 7

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Display days posts within a page’ is closed to new replies.