• Please bare with me as I’m not an experienced PHP or WP developer. Here is what I am trying to do:

    1. Return a query for child pages under a particular parent [done].
    2. Paginate the results [done].
    3. When the page is displayed, show the page where month = this month AND year = this year. But, only show this on the first page so that when someone clicks “next” they go to the next post.

    Basically, I need to pull the content from all of these subpages, but the first one that is displayed needs to be from the current month. Then, the pagination still needs to work from the query. It’s like you drop right into the middle of the query results.

    The month and year are stored as custom values in the page’s data. Here is the code I have so far, and it is working to solve my first two requirements.

    <?php
    		$current_month = date('m');
    		$current_year = date('Y');
    		$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
            query_posts('post_type=page&post_parent=5&posts_per_page=1&paged=' . $paged);
        ?>

    I’ve looked through the documentation of the query_posts function, and it all appears to limit the whole query. Orderby and order will not work, because I need these to be ordered by the “order” field in the page data.

    Thoughts? Thanks ahead of time.


    Shane

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Shane

    (@mohonrim)

    Thanks, MichaelH. However, from what I understand and what the documentation states, “Returns posts for just…” My query needs to first return all of the pages just like the current query does. Then, I need the first page to be displayed as the one that matches the current month and year. The time parameters would limit all the results of the query to just ones matching the month and year, correct?

    Sorry-don’t think I have an answer for that, nor to be able to make pagination work. Maybe someone else can jump in with a solution.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Query_posts and Date issues, how to show today’s page and still list others’ is closed to new replies.