1

I am using the wp-ui Wordpress plugin to create vertical tabbed content. What I want to do is add a span to part of the tab title - to add some additional style, but the shortcode/plugin strips my "span" code

[wptabs mode="vertical" effect="fade"] 
[wptabtitle] <span>Silent auction</span> - More title here.[/wptabtitle]
[wptabcontent] Content goes here [/wptabcontent]
[/wptabs]

Is there a simple way to keep the shortcode/plugin from stripping my added code. The plugin shortcode is easier for the client otherwise, I'd try something different.

Help? Can anyone explain what I need to do with the code below to get the result above?

I found this code:

add_shortcode( 'wptabtitle',    array(&$this, 'sc_wptabtitle'));

Then, I located this in the same file.

/**
 *  [wptabtitle]
 */
function sc_wptabtitle( $atts, $content = null ) {
    extract(shortcode_atts(array(
        'header'    =>  'h3',
        'hclass'    =>  'wp-tab-title',
        'label'     =>  'text',
        'image_size'=>  '24,24',
        '_id'       =>  false,
        'load'      =>  '',
        'post'      =>  '',
        'page'      =>  '',
        'cat'       =>  '',
        'category_name' => '',
        'tag'       =>  '',
        'tag_name'      =>  '',
        'number'    =>  '4',
        'exclude'   =>  '',
        'tag'       =>  '',
        'feed'      =>  '',
        'hide'      =>  "false",
        'elength'   =>  $this->options['excerpt_length'],
        'before_post'   =>  '',
        'after_post'    =>  '',
        'template'      =>  '1',
        'icon'      =>  false
    ), $atts));

    global $wpui_id_remove_chars;

    if ( str_ireplace( $wpui_id_remove_chars, '', $_id ) != $_id )
        $_id = false;

    $tmpl = ( isset( $this->options[ 'post_template_' . $template ] ) ) ?
                $this->options[ 'post_template_' . $template ] :
                $this->options[ 'post_template_1' ];

     if ( isset( $this->options[ 'title_template' ] ) && $this->options[ 'title_template' ] != '' ) {
         $title_template = $this->options[ 'title_template' ];
        if ( $_id ) {
            $title_template = str_ireplace( '>{$title}', 'id="' . $_id . '">{$title}', $title_template );
        }
     } else {
         $title_template = '<' . $header;
         $title_template .= ' class="' . $hclass . '"';
         if ( $_id ) {
             $title_template .= ' id="' . $_id . '"';
         }
         $title_template .= '>{$title}</' . $header . '>'; 
     }

    if ( $hide == "true" ) $hclass .= ' wpui-hidden-tab';

    $data = false;

    // Get the post contents.
    if ( $post != '' ) {
        $data = $this->wpuiPosts->wpui_get_post( $post, $elength );
    } elseif ( $page != '' ) {
        $data = $this->wpuiPosts->wpui_get_post( $page, $elength );
    } elseif ( $feed != '' ) {
        $data = $this->wpuiPosts->wpui_get_feeds( array(
                        'url'       =>  $feed,
                        'number'    =>  $number
                    ));

    } elseif ( $cat != '' || $category_name != '' || $tag != '' || $tag_name != '' ) {
        $data = $this->wpuiPosts->wpui_get_posts( array(
                                    'cat'       =>  $cat,
                                    'category_name' => $category_name,
                                    'tag'       =>  $tag,
                                    'tag_name'  =>  $tag_name,
                                    'number'    =>  $number,
                                    'exclude'   =>  $exclude,
                                    'length'    =>  $elength
                                ));
    }

    if ( $load != '' ) {
        $content = '<a class="wp-tab-load" href="' . $load . '">' . $content . '</a>';
    }


    $title_str = str_ireplace( '{$title}', $content, $title_template );


    if ( $icon && $icon != '' ) {
        $title_str = str_replace( '{$thumbnail}', htmlspecialchars_decode( $icon ), $title_str );
    }

    if ( is_array( $data ) ) {
        if ( isset( $data[ 'title' ] ) ) {
            $title_str = $this->wpuiPosts->replace_tags( $title_template, $data );
            $data = $before_post . $this->wpuiPosts->replace_tags( $tmpl, $data ) . $after_post;
        } else {
            $scra = '';
            foreach( $data as $index=>$values ) {
                $scra .= $this->wpuiPosts->replace_tags( $tmpl, $values );
            }
            $data = $before_post . $scra . $after_post;
        }
    }


    $title_str = preg_replace( '/\{.*\}/', '', $title_str );

    $output = $title_str;

    if ( $data ) {
        $output .= do_shortcode( "[wptabcontent]" . $data . "[/wptabcontent]" );
    }

    return $output;


} // END function sc_wptabtitle

Thanks, Louise

  • 1
    Depends on how the shortcode callback is written. Can you post the source code? – s_ha_dum Nov 5 '13 at 14:51
  • That is a widget, not a shortcode. Look for add_shortcode in the source. – s_ha_dum Nov 5 '13 at 18:30
  • Better, yes, but this doesn't look like the right shortcode. Is there another callback for the wptabtitle shortcode? – s_ha_dum Nov 6 '13 at 4:49
  • Again, that is a widget. Look for add_shortcode('wptabtitle','<callback>'). <callback> will be some function name. The function identified by that name is the part you need to post. – s_ha_dum Nov 6 '13 at 19:32
  • @s_ha_dum - Can you check the code above now? Thanks for not giving up on me. – Louise Nov 7 '13 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.