I need to be able to display multiple post templates for custom post types. I haven’t found a solution for this. The documentation only specifies one singe post template for a custom post type:
I need all the templates from the “standard” post template display to show. How do I show every option and template for a custom post type? I need all the standard post settings options (templates, review option etc.) for a custom post type.
Well they can actually. Which your own docs state. They are just limited to a single template without code modifications. I’ve already modified the wp_booster framework to include custom post types (which you should do by default if you ask me).
I was hoping that there was an easy solution, but I’ll get to work on modifying the rest of the framework myself.
Another thing. You might want to rewrite the error handling of your td_api.api. I.e. line 322:
td_util::error(__FILE__, "td_api_base::mark_used_on_page : a component with the ID: $id is not set.");
Will display errors on page and not only to error log.
Hi
You can modify the post panel generator to have all post templates available for custom post type by editing td_templates_settings.php like in this example: http://screencast.com/t/8aUB77jrHOQ8 Hoover this is not a grantee the they will also work. Our post templates were designed to work only with post post type and to have them working on custom post types you’ll need a different approach for them.
Note that this is a very complex task which require many customizations in theme’s files and also good coding skills are involved in order to complete it. We can’t offer customization services at the moment so if you still need guidance on this or you’re not aware of the steps you need to take in this regard please consider hiring a developer or a freelancer to do this for you.
Thanks for the message!
Hi Andrei.
I’m almost there with the modifications. So far the block code is working 100 % with several custom post types. But I still cannot show custom post types on the category pages. Top posts are working as the are based on the block settings, but the article display is not showing. I’ve been trying to find there in the code the ‘post_type’=> ‘post’ is set for that but can’t seem to find it.
So far i’ve changed this:
td_data_source.php
$wp_query_args = array(
'ignore_sticky_posts' => 1,
'post_type' => array('post','custom1','custom2','custom3'),
'post_status' => 'publish'
);
This will enable mega menus to fetch data from custom post types.
Out commented the post tytd_wp_booster_functions.php
// if ($post->post_type != 'post') {
// return $wordpress_template_path;
// }
This will enable custom post types to use the default post templates.
td_templates_settings.php line 89:
'template' => get_template_directory() . '/includes/wp_booster/wp-admin/content-metaboxes/td_set_post_settings.php',
));
Forcing the templates to show for custom cpt in edit post in backend.
I’ve also added custom cpt to search etc.
But where do I set the post types for the article display on category pages etc?
Hi
Basically a custom post type it’s assigned to a custom taxonomy. That is a point of a custom post type, to have an additional way to sort thing in wordpress. The categories are default wp-taxonomies which are designed to display only wp’s default posts types. To change that you’ll need to modify the query for category pages and send your custom post types as a parameter. The query for category pages it’s made by loop.php file so you have to make some changes in that file in order to achieve your goal.
In td_data_source.php are made all queries for theme’s blocks. That file dos not generate content for pages like category page, archive page etc. It generate the query for each theme’s block.
Thanks!
Got it working. Almost..
Pagination is showing, but following pages are not working. Clicking them will generate a 404 error. Someting I’m missing?
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$args = array(
'post_type' => 'custom1',
'post_status' => 'published',
'posts_per_page' => '10',
'paged' => $paged
);
$wp_query = new WP_Query( $args );
Hi Dhananjay.
The website I’m building / redesigning will launch May 1st. It’s under wraps until then 🙂
I realised that Newspaper theme really is not geared for CPT. In the end there is too many customisations needed and would probably break all sorts for theme updates in the future.
I had to options to accomplish my goal:
1. Use CPT to get the data-sorting i wanted.
2. Modify and add the needed sorting logic to the data backend.
I chose the latter. Today I rewrote the ajax functions and implemented the function (only get posts from main box / menu filter AND sub-filters (from drop-downs).
I’ve documented the changes here: Adding Ajax Logic
You might wanna take a look.
-
This reply was modified 10 years by
Phonetic.
