• Hi there,

    I currently have code in my sidebar which loads a custom menu. Under this I need to add another menu item which will display posts from the current week (The page is an events listing with each post giving info on a specific event).

    So the idea is to allow the user to see what evenbts are on in the coming week. I’ve been trying to use code where possible so I don’t have to worry about plugins. The code below loads my custom menu.

    <?php
         if ( is_single() || is_archive() || is_page(4) || in_category( array('news', 'events', 'events', 'spotlight'))) : ?>
            <div class="widget">
                <h3>What's On</h3>
    		<?php wp_nav_menu( array('menu' => 'Events Menu' )); ?>
            </div>
    <?php endif ; ?>

    I don’t think I can easily create another ‘custom menu’ which displays current posts so I think hard-coding a ‘View This weeks events’ link is my only option.

    I found the following on the WP codex but to be honest I’m not sure how I can adapt this to include the link/menu item. Any advice appreciated!

    $current_year = date('Y');
    $current_month = date('m');
    
    query_posts( "cat=22&year=$current_year&monthnum=$current_month&order=ASC" );
  • The topic ‘Adding a menu item 'View This Weeks Posts'’ is closed to new replies.