• 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:

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

    duplicate and use for categories…

    Thread Starter sebastianoseno@gmail.com

    (@sebastianosenogmailcom)

    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.