I'm using Pages to organize a web site with static and blog content on the same page. I do this by using static pages and then including a loop in the template that looks like this :
<?php query_posts('category_name=testpage'); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> [rest of normal display stuff here]
This works fine if I make a new template for each page and manually change testpage in the code above to whatever the category is.
But I'd like this template to be automatic, so that if I add a new page with name Pizza, and a new Category with name Pizza, I can just assign the same template and it would now display the Pizza category blog entries.
I'm hoping there is some variable that holds the name of the page that this template was applied to which I could pick up and use as a variable in my code. Something like :
$thispage = template_tag_that_gets_pagename() ... <?php query_posts("category_name=$thispage"); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> [rest of normal display stuff here]
Anyone have a clue? I really don't want to have to make copy after copy of the template just to change this one little bit of information, but I haven't found anything that suggests how I can find out which page is currently being displayed in the template at runtime.