Hi, I'm looking for some way to make a query that would display posts from a category of the same name as the page it would be displayed on. Sounds complicated so let me give you an example:
I have a page called News and a category called News as well, I would like to display post from the News category on the News page. However, I want it to be as dynamic as possible (usable on any page), so I can't hardcode the names into the query.
I came up with this code so far:
<?php
$catvar = "" // here would be page name
$query= 'category_name=' . $catvar. '';
query_posts($query); // run the query
?>
So basically all I need is a way to display name of the current page inside this code. How to achieve this?
Thanks in advance for all help.