WordPress.org

Ready to get started?Download WordPress

Forums

WP UI - Tabs, Accordions, Sliders
WP UI shortcode with custom fields (6 posts)

  1. Stefan83
    Member
    Posted 1 year ago #

    I'm trying to get the WP UI tabs to work with custom fields but I can't get the following code to work. Is it possible to use shortcodes with custom fields?

    <?php echo do_shortcode('[wptabs style="wpui-android"]'); ?>
    
    <?php
    $values = get_post_meta($post->ID, 'delivery_information', true);
    if ($values){
    echo do_shortcode('[wptabtitle]');
    echo 'Delivery Info';
    echo do_shortcode('[/wptabtitle]');
    echo do_shortcode('[wptabcontent]');
    echo $values;
    echo do_shortcode('[/wptabcontent]');
    }
    ?>
    <?php echo do_shortcode('[/wptabs]'); ?>

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

  2. avipr
    Member
    Posted 1 year ago #

    Hi

    I also want to know , if here is any way to get it working without shortcode, I am doing it in single.php, but not able to get. Can any body please help.

  3. akridgeblue
    Member
    Posted 1 year ago #

    Hmm. Not sure exactly what you are trying to do there but here are some tips.
    // With opening and closing shortcode use this method instead.

    echo do_shortcode('[iscorrect]'.$text_to_be_wrapped_in_shortcode.'[/iscorrect]');

    Using shortcode in custom field example:

    < ?php
    if (get_post_meta($post->ID, 'gallery', true)) {
    $shortcode = get_post_meta($post->ID, 'gallery', true);
    echo do_shortcode("$shortcode");
    } else { echo ''; }
    ?>

  4. avipr
    Member
    Posted 1 year ago #

    Hello
    thanks @akridgeblue
    I don't know if @Stefan83 got his answer, but I can explain what I need-
    I have custom fields with every post and i want to show them using tabs, suppose i have 4 extra fields with posts- say field 1, field2, field3 and field 4, now i want to show the data of these fields using tabs. because this data is related to post so I want to code in single.php

    Let me try if I can get into.

    Thanks again

  5. akridgeblue
    Member
    Posted 1 year ago #

    No problem. Yeah coding with shortcodes and php can be a pain. Its so finicky sometimes and takes me a lot of debugging/testing.
    Check this out for some more info:
    http://wordpress.org/support/topic/shortcode-is-being-surrounded-by-p-tags?replies=14
    and this:
    http://codex.wordpress.org/Shortcode_API#Enclosing_vs_self-closing_shortcodes
    and this for custom shortcodes(might try adding shortcode stuff and content into this then just call one shortcode but not sure if that would work:
    http://wordpress.org/extend/plugins/shortcoder/screenshots/

  6. akridgeblue
    Member
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic