StudioPress Community Forums

StudioPress Community Forums (http://www.studiopress.com/support/index.php)
-   General Discussion (http://www.studiopress.com/support/forumdisplay.php?f=7)
-   -   how to create a page templat that act as directory? (http://www.studiopress.com/support/showthread.php?t=118869)

badpenguin 09-26-2012 04:50 PM

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 :bang:

jjaycallejas 09-26-2012 07:15 PM

How about something like this? http://www.briangardner.com/custom-archives-page/

badpenguin 09-27-2012 02:09 AM

Quote:

Originally Posted by jjaycallejas (Post 596662)

This will not work in my case because i need to hack the wp_query
before the loop, i handle the archive loop in functions.php i don't need to recreate
it in this template.

Also a plugin apply_filter() call it in the "before wrap" functions.

So its not something i can do with the custom grid loop.
:bang:


All times are GMT -5. The time now is 03:44 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.