How do i add the current post/page title in a post query?
I've tried this, doesn't work:
query_posts( 'posts_per_page=10category_name=&' . $post->post_title); if (have_posts()) : while (have_posts()) : the_post();
|
How do i add the current post/page title in a post query? I've tried this, doesn't work:
|
|||||||||||
|
|
Your original code has a typo - the ampersand is used to separate arguments, so it should be:
However, since this is a new query in addition to the default, a new instance of WP_Query should be used instead of
|
|||
|
|
|
To others who wants to use this, This solution makes a page into a category page, an easy way to get categories into a header navigation that lists pages. Just make this code into a page template and set a title that matches the category you want to show.
|
|||
|
|