Jump to content
Sign in to follow this  
patrick6000

is 1.3.x supporting custom post type and cpt archives ?

Recommended Posts

patrick6000

I cannot find a way to template my custom post types and custom post type archives. I was expecting that 1.3.x will give me the way, but i cannot find it. I am using the following plugins : - Custom Post Type UI - Post Type Archives and playing with the page and template overriding system offered by the 1.3.x but cannot get anything right now. Does somebody have a solution ? I had some results by hacking the 1.2.3 core files by adding

is_post_type_archive()
in the
set_main_type()
and the
get_page_template()
functions inside
class.template.php

but the trick doesn't work anymore with 1.3.x Regards Eric

Share this post


Link to post
Share on other sites
cmunns

I imagine Andrew will be writing a guide for custom templating soon, I'll pester him about this.

Share this post


Link to post
Share on other sites
halifax_college

Do you happen to know if that guide is definitely on the cards? This is a fairly big feature of WP3.0 and I'd rather not have to hack together some sections in order to try and duplicate "core" functionality

Share this post


Link to post
Share on other sites
bryan-hadaway

Everything is constantly evolving and I can guarantee that new guides are in the works... no ETA for now, stay tuned. Thanks, Bryan

Share this post


Link to post
Share on other sites
halifax_college

Would any of the devs be able to shed some light on what they consider to be the correct way to do this? I've been dry-running through the code and by the looks of things there doesn't seem to be a straightforward path to do it. It's fairly easy to add a content template to the drag-drop interface: `pagelines_get_content_templates()` returns an array of content templates, by hooking into the `pagelines_content_template_array` event it's possible to add your own template that shows up on the drag-drop interface. Awesome, now to try and get the theme to use that template on the front end: All the wordpress templates (index, single, page) "include" `template.load.php` which call the `pagelines_template` event Now the only place this hook is referenced is in the `config.templates.php` file, function `the_template_map()`. The hook is used in the "page templates" part of the array, not the "content template" part. The hook which the "content template" array references is `pagelines_main` which is called in `template.content.php` which is loaded by the `content` section. Ok, so it seems we need to follow `the_template_map()`, the only (relevant) place that calls that function is PaglinesTemplate which seems to build some kind of registry of all available sections. The only place the "hook" element is used is in `hook_and_print_sections()` which links all template areas to their sections. Now it appears the template is decided on this line

$template_slug = ($hook_id == 'templates' || $hook_id == 'main') ? $hook_id.'-'.$this->template_type : $hook_id;

In the front end `$this->template_type` is set by `PageLinesTemplate::set_main_type()`, which is hard-coded to only select from the 3 templates defined in `pagelines_get_content_templates()`. (Some of what I've written may be a little off - it's 4:30am here!) I'm guessing you guys have got a fair bit on your plate what with that beta thread, but this is a fairly big show stopper for us and I'd really appreciate some input on it. EDIT: Also, I realise I can probably "hack this in" by modifying the core files but I'd rather avoid doing that.

Share this post


Link to post
Share on other sites
timlinson

@Matt: so are you just trying to get ppro to register a new entry in the "Template Setup" section? If so, this is all you need to do: - copy platformpro/page.alpha.php over to the platformbase folder - add this to platformbase/functions.php: `pagelines_add_page('alpha', 'My Own Section');`

Share this post


Link to post
Share on other sites
halifax_college

Hi Tim, No, I'm trying to work out how to create a custom "text content area" template to display a wordpress loop for a custom post type

Share this post


Link to post
Share on other sites
cmunns

Do you have the loop worked out and custom post types added? What stage in the process are you basically at?

Share this post


Link to post
Share on other sites
halifax_college

I've got a custom "event" post type and I was looking through the code to see if/how ppro selects the template. At the moment I can browse to `/events` and I'll get a list of events but they're displayed using the default posts `archive` template, and when I view an event it uses the default `single` template

Share this post


Link to post
Share on other sites
toddlevy

+1 for this... ability to create custom entries in the pagelines_get_content_templates.

Share this post


Link to post
Share on other sites
kastelic

One way i did this was to create a custom section (see http://www.pagelines.com/docs/custom-sections for instructions) and the section basically contained a custom loop, for example the following: $args = array( 'posts_per_page' => 3, 'offset' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'post', 'post_status' => 'publish', 'paged' => $paged ); // Create a new instance $second_query = new WP_Query($args); // The Loop while( $second_query->have_posts() ) : $second_query->the_post(); ?> <div class="customloop-item"> <div class="customloop-title"><?php the_title(); ?></div> <div class="customloop-thumbnail"><?php the_post_thumbnail(); ?></div> <div class="customloop-excerpt"><?php the_excerpt();?> </div> <div class="customloop-meta"><?php the_meta();?> </div> </div> <?php endwhile; wp_reset_postdata();

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×