Post UI Tabs
[resolved] Create a setter method overide has_tabs (3 posts)

  1. proximity2008
    Posted 3 years ago #

    Nice plugin.

    I got stuck however with its implementation because there is no way to overide has_tabs()

    I was trying to use the plugin to pull child pages onto a parent page, and because the parent page did not have has_tabs() set the shortcode, it wouldn't execute.

    I tried various do shortcode / filter combinations in vain.

    $loop = new WP_Query( array( 'post_type' =>  $post->post_type,
                                       'posts_per_page' => -1,
                                       'post_parent' => $post->post_parent )
          // using the WordPress UI tab plugin.
          while ( $loop->have_posts() ) : $loop->the_post();
             $title = get_the_title();
             $content = get_the_content();
             //simply does not work...
             $shortcode_content .= "[tab name=\"{$title}\"]\r\njust does not work!\r\n[/tab]";
          $shortcode_content .= "\r\n[end_tabset]";
          echo apply_filters( 'the_content', $shortcode_content  );

    Now if I could force has_tabs to true via a public method I could get around it.

    Thanks anyway.


  2. Mark / t31os
    Plugin Author

    Posted 3 years ago #

    That's a reasonable request(and a minor code change), i've just pushed out an update that switches the $has_tabs variable to public, so you can now do this just before your custom loop..

    global $Post_UI_Tabs;
    $Post_UI_Tabs->has_tabs = true;

    The tabs should then activate as expected, at least they did in my limited testing.. :)

    EDIT: April 21st 2013

    I don't think the above change was the smartest of ways to provide users with a means to set the variable, so i've added a new filter in the current version of Post UI Tabs for setting has_tabs, please see the FAQ.

  3. proximity2008
    Posted 3 years ago #

    Thank you for doing this.

    I will keep that in the back of my mind when I use your plugin again.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Post UI Tabs
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic