Support » Plugin: Simple Page Sidebars » Display Sidebar on a Custom Post

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Brady Vercher

    (@bradyvercher)

    Hi paolosan. This plugin was mainly built for use with pages, so it’s not particularly suited for using with custom post types. Although, if you’re comfortable editing code, you can add a short snippet to your theme’s functions.php file to add support to other post types.

    Otherwise, there are a few other plugins that you might look into for more advanced functionality.

    Brady,

    What is the short snippet that I would have to add to accomplish showing the custom sidebar options on pages with the different post-type than “page” I have been looking through the plugin and have not been able to find how to do it.

    Your help is greatly appreciated.

    forgot to subscribe to the topic

    Plugin Author Brady Vercher

    (@bradyvercher)

    Just add this snippet and replace {{post_type}} with your custom post type:

    function customprefix_init() {
    	add_post_type_support( '{{post_type}}', 'simple-page-sidebars' );
    }
    add_action( 'init', 'customprefix_init' );

    That did it, thank you so much and thanks for the super speedy reply. That was awesome.

    Thanks for a great plugin!!

    Plugin Author Brady Vercher

    (@bradyvercher)

    No problem. Glad it worked for you and thanks for the feedback!

    Sorry Brady. Rookie here.

    When you change {{post_type}} for a custom post type that you need is something like

    add_post_type_support( ‘Post’, ‘simple-page-sidebars’ )

    … if you want to add the sidebar for ALL posts created ?

    Thanks in advance and good job !!

    Roger

    forgot to subscribe to the topic

    Plugin Author Brady Vercher

    (@bradyvercher)

    Hi Roger,

    The post type name is lowercase, so you’d just use post in that snippet. It doesn’t add a sidebar to any post, it just enables the ability to replace sidebars on a per-post basis if they’re using the default sidebar to begin with.

    Defining a sidebar to use for all posts would require some additional code, or should probably be done in the theme (or with a different plugin).

    Hope that helps.

    Cheers,
    Brady

    Thanks Brady. Clear 🙂

    Roger

    Just provide a wp_reset_query(); at the end of your loop. It works fine.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Display Sidebar on a Custom Post’ is closed to new replies.