Support » How-To and Troubleshooting » Dropdown menu – Autoinclude posts

Dropdown menu – Autoinclude posts

  • Hi folks, i’m having a trouble trying to build a menu for my blog. I want to create a dropdown menu with categories and my posts inside of them. I know that i can manually insert articles in a menu, but is there a way to simply put the category in the menu and have the articles belonging to that category added automatically? It would be very tedious to me to add every single article to the menu by hand picking it…

Viewing 2 replies - 1 through 2 (of 2 total)
  • you can use this code to list posts from category:

    $args = array( 'numberposts' => 10, 'category' => 1 );
    $postslist = get_posts( $args );
    foreach ($postslist as $post) :  setup_postdata($post); ?>
    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    <?php endforeach; ?>

    duplicate and use for categories…

    and where shall i put it? how can i use code in the menu section? sorry, quite a newbie 😀

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Dropdown menu – Autoinclude posts’ is closed to new replies.