WordPress.org

Ready to get started?Download WordPress

Forums

Types - Custom Fields and Custom Post Types Management
php variables for custom post types and taxonomies (3 posts)

  1. Emanuel Sferios
    Member
    Posted 6 months ago #

    Hi. I want to edit my theme to display a sidebar only when viewing a specific custom post type or a specific custom taxonomy. The theme author told me how to do it with a regular category. Like this...

    global $cat;
    if ( $cat == '63') $category_columns = '1 Column + Sidebar';

    63 is the category id in this case. However, this does not work when I try to use the id from a custom taxonomy.

    What should I replace $cat with to make this work?

    Thanks!

    http://wordpress.org/plugins/types/

  2. Srdjan
    Member
    Plugin Author

    Posted 5 months ago #

    Hi, check if these docs can help:

    http://codex.wordpress.org/Conditional_Tags#A_Post_Type
    http://codex.wordpress.org/Conditional_Tags#A_Taxonomy_Page

    Also be sure to make these checks after 'init' hook.

  3. Emanuel Sferios
    Member
    Posted 5 months ago #

    Thanks!

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.