WordPress.org

Ready to get started?Download WordPress

Forums

show blog posts in custom menu (1 post)

  1. candell
    Member
    Posted 1 year ago #

    I have a custom menu in my theme, the blog menu has a submenu showing the 10 latest blog posts.

    At the moment each time a new blog post is put up I need to go to Appearance > Menus and remove the oldest one and add the new one and position it manually and save.

    This is coded into my theme as such

    in functions

    add_action( 'init', 'register_my_menus' );
    function register_my_menus() {
    register_nav_menus(
    array(
    'main-menu' => __( 'Main menu' ),
    'footer-menu' => __( 'Footer menu' ),
    )
    );
    }

    and the main menu I wish to change is in the header

    <?php wp_nav_menu( array( 'theme_location' => 'main-menu', 'container' => false, 'menu_class' => 'dropdown', 'menu_id' => '' , ) ); ?>

    Is it possible to automate the blog posts so that they show automatically without having to remove and add each time a new one is posted?

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags