WordPress.org

Ready to get started?Download WordPress

Forums

Time based navigation (3 posts)

  1. Daluxe
    Member
    Posted 2 years ago #

    Hi Ladies and Gentleman!

    I guess there's no (built in) function available for my problem, so I'll ask you ;)

    I tried to develop a time based navigation menu.
    f.e. I'm having one page for each weekday and on monday the menu-item of monday should be the first item in the menu's list.

    So I wondered, if it's possible to build a navigation with feeding a function with an array of page-id's instead of custom menus... like mySuperCoolMenu(array(5,6,7,8)); 'cause I found no possibility to dynamically modify my custom menus I've created in WordPress.

    My final guess is to build a function which builds a menu while using the_title() and get_page_link().

    Maybe someone already came up with a solution for my issue and wanna share some code snippets or something :)

    Thanks alot in advance
    Daluxe

  2. NateJacobs
    Member
    Posted 2 years ago #

    Quick idea, but haven't written out the code.

    Create a wp_nav_menu for each day. Create a function that would include a switch statement to display the appropriate menu based upon day of week.

    function ngtj_day_of_week_menu() {
        $day_of_week = date( 'N' );
        switch( $day_of_week ) {
            case 1:
                wp_nav_menu( MENU FOR MONDAY );
                break;
            case 2:
                wp_nav_menu( MENU FOR TUESDAY );
                break;
            etc...
        }
    }
  3. Daluxe
    Member
    Posted 2 years ago #

    Hey Nate!
    Thanks for your idea. The thing is, that I don't want to create a custom menu for each day, 'cause there are more menus to come soon.

    I found the function wp_page_menu() which may fit for me, 'cause I could feed the function with an include parameter. I'll take a look on that function and tell you how it works out for my purpose.

Topic Closed

This topic has been closed to new replies.

About this Topic