View Single Post
  #1  
Old 09-26-2012, 04:50 PM
badpenguin badpenguin is offline
Registered User
Genesis Member
 
Join Date: Dec 2011
Location: Italy
Posts: 51
Default how to create a page templat that act as directory?

I want to create a page that act as a category and show all the posts:
a kind of sitemap.

I called a page with the slug "/map" and assigned it my custom page template.

In the template i just override wp_query:
PHP Code:
global $wp_query;
$wp_query = new WP_Query('category_name=camping,village');
genesis(); 
This way it looks with the right CSS from my category template
but it uses wrong HTML-Titlte and its missing H1 tags and also the body of the original /map page.

Is there a way in genesis of simply doing this? I.e.
1. creating a page and using H1, TITLE, and Body from the Page
2. display posts from a custom WP_Query the same way as if i accessed /category/

EDIT:

I've found a very hacky solution:
PHP Code:
global $wp_query;
$x = new WP_Query('category_name=camping,village');
// Merge query results with the WP_Query from the /map slug page
foreach ($x->posts as $p) {
    
$wp_query->posts[] = $p;

However a better less hacky way is preferred

Thanks, Antonio