WordPress.org

Ready to get started?Download WordPress

Forums

WooSidebars
[resolved] Sidebars for Post Entries Option Gone? (4 posts)

  1. Amber
    Member
    Posted 1 year ago #

    Currently it shows that WooSidebars can create different Sidebars for different posts. However, it doesn't appear to be the case for either regular post entries or Custom Post Type entries. Under Widget Areas it only has the following options under a tab called Post Types:

    • "Locations" Post Type Archive (i.e Locations is a sample custom post type)
    • Each Individual "Location" (Entries in the "Locations" post type)
    • Each Individual Post (Entries in the "Posts" Post Type

    If, for example you create Widget A and want to assign it to entry "Location A" under Custom Post Type "Locations" or entry Hello World (the default WordPress install post) there is no apparent way to do this.

    Ticking "Each Individual "Location" shows the sidebar (Widget A) on every entry under the "Locations" post type (no choices for individual entries; i.e. "Location A").

    Ticking the "Each Individual Post" shows the sidebar (Widget A) on all regular entries (no choices for individual entries; i.e. "Hello World").

    The Widget Areas "Posts" tab, which seemed to be where you could assign Sidebars to individual posts is no longer there (as seen in: http://woothemes.wpengine.netdna-cdn.com/wp-content/themes/woo/images/woosidebars/woosidebars-posts-large.png).

    I would like to be able to assign sidebars to individual posts and individual custom post type entries. Is it possible to get this option back or did I miss something?

    http://wordpress.org/extend/plugins/woosidebars/

  2. Amber
    Member
    Posted 1 year ago #

    UPDATE:

    I did some poking around/Googling and found that the Posts tab DOES appear when you click on the Checkmark found in the Custom Sidebars column of the Post listings page.

    However, this doesn't appear to work for Custom Post Types. Any way to get that checkmark feature to be compatible with custom post types?

  3. Amber
    Member
    Posted 1 year ago #

    I modified the plugin for the time being to accommodate for my custom post types.

    To do this I opened the class-woo-sidebars.php files and found the following (approx. line 115):
    add_post_type_support( 'post', 'woosidebars' );

    Beneath that I added the following:

    add_post_type_support( 'my_custom_post_type_name', 'woosidebars' );

    Then I found the following section (approx. line 134 - 141):

    public function register_post_type_columns () {
    		$post_type = get_post_type();
    
    		if ( $post_type != '' && post_type_supports( $post_type, 'woosidebars' ) ) {
    			add_filter( 'manage_edit-' . $post_type . '_columns', array( &$this, 'add_post_column_headings' ), 10, 1 );
    			add_action( 'manage_posts_custom_column', array( &$this, 'add_post_column_data' ), 10, 2 );
    			add_action( 'manage_pages_custom_column', array( &$this, 'add_post_column_data' ), 10, 2 );
    		}

    Beneath that I added:

    $custom_post_type = get_post_type('my_custom_post_type_name');
    
    		if ( $custom_post_type != '' && post_type_supports( $custom_post_type, 'woosidebars' ) ) {
    			add_filter( 'manage_edit-' . $custom_post_type . '_columns', array( &$this, 'add_post_column_headings' ), 10, 1 );
    			add_action( 'manage_posts_custom_column', array( &$this, 'add_post_column_data' ), 10, 2 );
    			add_action( 'manage_pages_custom_column', array( &$this, 'add_post_column_data' ), 10, 2 );
    		}

    I am now able to select my individual custom post type entries to be included in the WooSidebars Widget Areas.

    It would be great to see this somehow added in by default so that users don't need to manually hack the core plugin code.

    :)

  4. Amber
    Member
    Posted 1 year ago #

    Ok clearly my brain is out to lunch today and I just realized that modifying the plugin is not necessary. Disregard previous posts.

    Simply add the following to your functions.php or plugin:

    <?php
    add_post_type_support( 'my_custom_post_type_name', 'woosidebars' );
    ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.