WordPress.org

Ready to get started?Download WordPress

Forums

WP UI - Tabs, Accordions, Sliders
[resolved] conditional tab (6 posts)

  1. pescadito01
    Member
    Posted 2 years ago #

    Hi, thank for these great plugin.

    However, i would ask about how to use a conditional tab, for example in php

    pseudocode could be:

    [wptabs]
    [wptabtitle] Tab1 [/wptabtitle]
    [wptabcontent] Content1 [/wptabcontent]
    if (some condition),
    [wptabtitle] Tab2 [/wptabtitle]
    [wptabcontent] Content2 [/wptabcontent]
    [/wptabs]

    any help will be apreciated
    best regards, pescadito

    http://wordpress.org/extend/plugins/wp-ui/

  2. kavingray
    Member
    Plugin Author

    Posted 2 years ago #

    Hi there,

    Thanks, Glad you like it. :)

    This is a neat idea BTW, but there is no functionality available as of this current version. Some of this functionality could be mimicked with Javascript, but php would be more powerful and concise. I will take this as a feature request and implement this in the next update.

    BTW, is this one of the wordpress conditional or more sophisticated PHP?

  3. pescadito01
    Member
    Posted 2 years ago #

    the idea is use php (any variable or wordpress conditional)!

    i tryed it with do_shortcode ..[wptabs].. and so but without result (because i'am not a php expert). could you give me any help in php?

    best regards, pescadito

  4. pescadito01
    Member
    Posted 2 years ago #

    hi, here my testing but without result

    1) trying to code in php
    [Code moderated as per the Forum Rules. Please use the pastebin]

    2) Using a old http://wordpress.org/extend/plugins/conditional-custom-fields-shortcode/

    [wptabs]

    [wptabtitle] Imagenes[/wptabtitle]
    [wptabcontent] [gallery] [/wptabcontent]

    [if-cf-neq ".i_videocode" ""]
    [wptabtitle] Videos[/wptabtitle]
    [wptabcontent] Video Content [/wptabcontent]
    [/if-cf-eq]

    [/wptabs]

    Any idea will be apreciated
    Best regards, pescadito

  5. kavingray
    Member
    Plugin Author

    Posted 2 years ago #

    Hi there,

    if this is desired in a php template( theme or page template) , I suggest you use this HTML in this code paste to implement WP UI widgets, instead of convoluted 1st example with do_shortcode.

    But, from editor, the second example should work correctly. This might be a typo, the conditional shortcodes should match up correctly, both if-cf-neq ( second one is eq ).

  6. pescadito01
    Member
    Posted 2 years ago #

    thanks kavingray, it's work very well!

    <div class="wp-tabs wpui-dark">

    <h3 class="wp-tab-title">PresentaciĆ³n</h3>
    <div class="wp-tab-content">
    <img src="{{.i_imgdetalles}}" width="99%">
    </div>

    <?php
    global $post;
    $images = get_post_meta($post->ID, 'img_include', true);
    //echo '
    $images= '. $images . '
    ';
    if ($images <> '') {
    //echo 'images yes
    ';?>
    <h3 class="wp-tab-title">Imagenes</h3>
    <div class="wp-tab-content">
    [gallery include="{{.img_include}}"]
    </div>
    <?php } ?>

    </div>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags