I have a menu bar with different topics (technology, food, etc.) When I click on one of those, I would like to display all posts that have that specific topic assigned. Everything I have found online shows me how to do this by specifying the topic using an ID. However, I do not want to "hard code" it, but rather run a function that gets the name of the page, and then displays posts that correspond to that category. So essentially, instead of having cat=1 in my query argument, I would like to enter code that gets the title of the page, as the title of the page equals the category I want to show. I have posted the first part of my code below. My loop works fine other than that and displays the content how I want it to. I just need to figure out how to dynamically fetch the page title and assign that as the category value. Thank you for any help
<?php query_posts('cat=1'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>