Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using Weaver II Pro theme 1.3.8 with WordPress 3.5.2

The theme is very flexible and provides many templates. On individual pages, I can even choose which template to use, which is cool and handy.

Is there a way to assign a particular template for a particular custom post type, e.g. no sidebars for bbPress forum pages, or no sidebars for time.ly All-in-One-Event-Calendar, etc?

share|improve this question
    
Yap. It is possible ;) I just test this: (wordpress.stackexchange.com/questions/91525/…). It's working. –  pendjer Sep 6 '13 at 21:08
add comment

3 Answers

If your theme and plugins follow the basic WP template hierarchy and different content types actually have their own custom post types, you should be able to achieve this through template naming. Learn more from http://codex.wordpress.org/Post_Type_Templates and http://codex.wordpress.org/Template_Hierarchy

Unfortunately many plugins (and some themes too) have their own template structure and this might cause problems.

If you can't use template naming, you can check the current post type inside the main template and output sidebar and other stuff through if-else statements (see example below).

if ( get_post_type() == 'yourposttypewithsidebar' )
{
    get_sidebar();
}
else
{
    // don't show sidebar
}
share|improve this answer
add comment

Create a single template, like: single-{post_type}.php in the root of your theme.

see also: http://codex.wordpress.org/Post_Types#Custom_Post_Type_Templates

share|improve this answer
add comment

It depends on how your custom post type is set up. Check on the admin page for the post type and see if there is a box called "Page Attributes." This will allow you to choose from existing templates. Otherwise you will likely have to create your own like others have said. You will need to copy the template for the page that it most closely resembles (i.e. another page that has no sidebar) and save it as single-{post_type}.php for example if your custom post type is called product, it would be called single-product.php.

For bbpress you would have to name the page you want to copy forum.php. Usually you can get rid of the sidebar simply by removing <?php get_sidebar(); ?>but you might have to fix the rest of the content accordingly.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.