title: Wordpress menu that shows all posts in a certain category
body: <p>I am working on creating a widget menu(kind of a sidebar like w3schools) that is supposed to show all posts that are listed in a particular category.<br>
   For example from the home page once the user clicks "HTML" in the Nav bar it takes them to the page with introduction about the course and I have put a sidebar custom menu(by using drag and drop) in which there are other posts of the same category by the name of "HTML".   </p>
  
  <p>I want to be able to make a post and mark it under "HTML" category, in the menu option I select the menu to show menu only on posts with the "HTML" category and then after that whenever I make a post under the category "HTML", the menu should automatically add another post to the list. Simply put, a dynamic menu that shows all posts under a certain category. </p>
  
  <p>So far I have come across this piece of code but putting it in the editor for menu doesn't work :</p>
  
  <pre><code>$catPost = get_posts(get_cat_ID("NameOfTheCategory"));
  
  foreach ($catPost as $post) : setup_postdata($post); ?&gt;
          &lt;div&gt;
               &lt;h2&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt; 
                &lt;p&gt;&lt;?php the_content(); ?&gt;&lt;/p&gt;
          &lt;/div&gt; &lt;?php  endforeach;?&gt;
  </code></pre>
  
  <p>I am new to WordPress and I have tried searching everywhere and trying a lot of plugins but I can't find anything.</p>