Title: [Plugin: Post UI Tabs] support for nested shortcodes?
Last modified: August 20, 2016

---

# [Plugin: Post UI Tabs] support for nested shortcodes?

 *  Resolved [duncan](https://wordpress.org/support/users/flowevd/)
 * (@flowevd)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-post-ui-tabs-support-for-nested-shortcodes/)
 * Hi Mark,
 * This is a great plugin – thank you.
 * I had to pull in some tabs via a shortcode recently, and found that the only 
   way to make sure the plugin tabified them as normal was to force the has_tabs
   property to true (thanks for making that public), because the first shortcode
   needed to be parsed before the page contained ‘[end_tabset]’ (if that makes sense),
   and ‘on_the_posts’ only checks the plain $content of the $posts.
 * Might you consider adding a filter inside ‘on_the_posts’ to assign has_tabs, 
   passing in $content so developers could do any shortcode parsing etc they wanted,
   to decide whether there are tabs or not?
 * Something like
    ` $this->has_tabs = apply_filters( 'put_decide_has_tabs', $this-
   >has_tabs, $content );
 * towards the end?
 * I would send this in Trac but I’m no good with it and can’t find this plugin 
   in the dropdown.
 * Best Regards,
    Duncan
 * [http://wordpress.org/extend/plugins/put/](http://wordpress.org/extend/plugins/put/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/plugin-post-ui-tabs-support-for-nested-shortcodes/#post-2919167)
 * Whilst that’s certainly an option, you should note that the data a filter passes
   to functions hooking on can only be passed back the data from the first argument,
   so using your above example, regardless of what you may change in `$content`,
   that data would not be getting passed back to the plugin.
 * An option would be would be pass an array of the data into the hook, eg.
 *     ```
       $this->has_tabs = apply_filters( 'put_decide_has_tabs', array( $this->has_tabs, $content ) );
       ```
   
 * Though i’m inclined to say that if you want to hook the post content and determine
   whether to enable/disable tabs, you should do so with your own filter on `the_content`
   and i’d be happy to add a filter to set the `has_tabs` variable, so you can more
   easily set that via a filter instead of bringing the `$Post_UI_Tabs` object into
   scope and explicitly setting the `has_tabs` property.
 *     ```
       $this->has_tabs = (bool) apply_filters( 'put_decide_has_tabs', $this->has_tabs );
       ```
   
 * If you wanted to run some conditional logic over the post content before setting
   that hook you could run two filters, something along the lines of..
 *     ```
       // Hook at priority 6, plugin runs filter at priority 7
       add_filter( 'the_content', 'my_filter_on_the_content', 6 );
   
       // Assuming you want tabs disabled unless logic in filter is true
       $set_tabs = false;
   
       function my_filter_on_the_content( $content ) {
   
       	global $set_tabs;
       	// Do condition logic to determine whether to enable has_tabs
       	$set_tabs = true;
   
       	return $content;
       }
       if( $set_tabs )
       	add_filter( 'put_decide_has_tabs', '__return_true' );
       ```
   
 * The logic can be inversed if you want to have tabs on, but conditionally turn
   them off.
 * I’ll add the filter to the next update anyway, it definitely makes sense to have
   users set that variable via a filter instead of messing around with the class
   object.

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: Post UI Tabs] support for nested shortcodes?’ is closed to new
replies.

 * ![](https://s.w.org/plugins/geopattern-icon/put_dadada.svg)
 * [Post UI Tabs](https://wordpress.org/plugins/put/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/put/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/put/)
 * [Active Topics](https://wordpress.org/support/plugin/put/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/put/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/put/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * Last activity: [13 years, 1 month ago](https://wordpress.org/support/topic/plugin-post-ui-tabs-support-for-nested-shortcodes/#post-2919167)
 * Status: resolved