WordPress.org

Ready to get started?Download WordPress

Forums

Dynamic Widgets
[resolved] Individual CPT control? (10 posts)

  1. Michelle
    Member
    Posted 1 year ago #

    Hello,

    Is there a way to screen a widget based on individual Custom Post Type items, like there is for individual Pages/Posts? I have a CPT called 'books' but I want to show specific widgets on specific book pages, not just for all Books or on the Book Archive.

    Thanks!

    Michelle

    http://wordpress.org/extend/plugins/dynamic-widgets/

  2. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    Yes, there is. Make sure you have ticked the "Make exception rule available to individual posts and tags." checkbox for the widget you want to control on an individual base. Set a default view in the (custom) post section of DW (Yes - No).

    Then go to the edit screen of the specific (custom) post. At the bottom you'll find a box "Dynamic Widgets" with another checkbox which creates an exception to the default view.

  3. Michelle
    Member
    Posted 1 year ago #

    Thanks! I see what you mean, and it works when you set the widget to 'show' all of a custom post type, then hide it for just one of those items. Unfortunately it doesn't seem to work the other way around, when you set the default to "hide" it for a custom post type, then make an exception for just one item in that CPT to 'show'. Any way I could get that to work? It's going to be pretty labor-intensive if I have to go into every single CPT-item and hide a widget so it only appears on one...

    Thanks so much for your quick reply to my original request and for the great plugin btw!!

  4. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    It should actually work the other way around as well. Have you tried OLD method?

  5. Michelle
    Member
    Posted 1 year ago #

    Just switched over to 'OLD', no joy. In the single-CPT panel it says "defaults to On" no matter what, despite having it turned to 'hide' for that CPT on the main Dynamic Widget widget page. The widget itself doesn't appear anywhere, even though I've clicked the box to 'make exception' on the CPT-item page.

    I've completely uninstalled (via your link) and reinstalled to confirm it's not some lingering weirdness but it's still happening.

  6. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    Hmm... I'd almost say it looks like a bug. It might be theme related tho. I'll do some tests an let you know.

  7. Michelle
    Member
    Posted 1 year ago #

    Thanks! Let me know if you need a 'dump', I can email it to you. :)

  8. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    I've been trying quite some things to see if I can reproduce this incorrect behaviour. Unfortunately not successfull until now. Maybe it's theme related. Which theme are you using?

  9. Michelle
    Member
    Posted 1 year ago #

    I'm using a custom-built theme (based on Bones) but I just switched to TwentyTwelve and the same thing happens: works great if the default is "show" and you make an exception on the CPT to 'hide' - doesn't work if the default is 'hide' and you want to 'show'.

    I tried deactivating all my plugins as well and no joy.

    This is the code for one of my CPTS if that helps:

    register_post_type('book_praise', array(	'label' => 'Book Praise','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => ''),'query_var' => true,'exclude_from_search' => false,'supports' => array('title','editor','revisions',),'labels' => array (
      'name' => 'Book Praise',
      'singular_name' => 'Book Praise',
      'menu_name' => 'Book Praise',
      'add_new' => 'Add Book Praise',
      'add_new_item' => 'Add New Book Praise',
      'edit' => 'Edit',
      'edit_item' => 'Edit Book Praise',
      'new_item' => 'New Book Praise',
      'view' => 'View Book Praise',
      'view_item' => 'View Book Praise',
      'search_items' => 'Search Book Praise',
      'not_found' => 'No Book Praise Found',
      'not_found_in_trash' => 'No Book Praise Found in Trash',
      'parent' => 'Parent Book Praise',
    ),) );

    Thanks for your help!

  10. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    Apologies for the late reply. It took a while finding out. I think I know what's going wrong. Please check in the single CPT if the DW tickbox is still ticked. It might be removed.

    When you save options in the DW widget edit screen, the individual rules for single CPT are lost. That's a bug! Will be fixed in the next release.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic