• Resolved Run Buff

    (@run-buff)


    Hi,
    After playing around with a few functions and many scenarios, I can’t seem to get exactly what I want on a Page, custom or default. Basically, when someone clicks a Page menu header I’d like for the page to open up the same way that clicking an Archive month does: displays in descending order the posts for the current month with title and summary, etc. Seems straight forward, but I can’t figure out the logic on how to make that happen.

    Here’s how the page looks when you click on the May Archive link, and this is what I would like to occur when clicking the Blog Post header menu link.

    https://www.tystrange.com/2014/05/

    I can easily make the page look like the archive widget summary, but I would like for it to open with the full month of posts.

    Thoughts?

    Cheers,
    Ty

Viewing 1 replies (of 1 total)
  • Thread Starter Run Buff

    (@run-buff)

    Hi,
    After rooting around to fully understand what php was doing, I figured out how to do it.
    1. Create a custom template

    2. place this code in it
    <?php
    /*
    Template Name: Blog Page
    */

    /* This example is for a child theme of Twenty Ten:
    * You’ll need to adapt it the HTML structure of your own theme.
    */

    get_header(); ?>
    <div id=”container”>
    <div id=”content” role=”main”>
    <?php
    // Get the current month and year
    $year = get_the_date(‘Y’);
    $monthnum = get_the_date(‘n’);
    // Grab the post via the query
    query_posts( “year=$year&monthnum=$monthnum&posts_per_page=-1” );
    ?>
    <!– Output the query via the optional $name parameter (set as index) –>
    <?php get_template_part( ‘loop’, ‘index’ );?>

    </div><!– #content –>
    </div><!– #container –>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    3. Create a new Page and set the template to the name of the new one you created in step one.

    Cheers,
    Ty

Viewing 1 replies (of 1 total)
  • The topic ‘Display Current Month's Archive with Title and Summary On Page’ is closed to new replies.