• Resolved maxupp

    (@maxupp)


    Hello!

    Love this plugin and its functionality, for the site I’m creating i’m trying to make my tabs a little more robust… Please let me know if someone has asked this before I could not quite find it if they have.

    I’m trying to create basically a gallery holder that can be easily updated by the user when I’m not around anymore.
    So i’ve done an echo do_shortcode on the inside of the template page I want the tabs on that looks like this:

    <?php { echo do_shortcode(‘

    [tabby title=”First Tab”]
    First Content
    [tabby title=”Second Tab”]
    Second Content
    [tabby title=”Third Tab”]
    Third Content
    [tabbyending]

    ‘);
    }?>

    What I want to create is something with the functionality of this:

    <?php { echo do_shortcode(‘

    [tabby title=”<?php the_field(‘first_title’); ?>”]
    <?php the_field(‘first_content); ?>
    <?php the_field(‘first_lightbox); ?>
    [tabby title=”<?php the_field(‘second_title’); ?>”]
    <?php the_field(‘second_content’); ?>
    <?php the_field(‘second_lightbox); ?>
    [tabby title=”<?php the_field(‘third_title’); ?>”]
    <?php the_field(‘third_content’); ?>
    <?php the_field(‘third_lightbox); ?>
    [tabbyending]

    ‘);
    }?>

    I do not have a live link yet as I am still working locally.

    https://wordpress.org/plugins/tabby-responsive-tabs/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author cubecolour

    (@numeeja)

    I’ve not used advanced custom fields so I don’t know what the correct syntax would be for your proposed usage with values from that plugin, but I’ll investigate if I get some time over the weekend.

    Thread Starter maxupp

    (@maxupp)

    I believe it could be the same as just calling another sort of <?php ?> within tabby.

    Plugin Author cubecolour

    (@numeeja)

    You definitely don’t want to nest any <?php tags inside other <?php tags like you have in your example as that is incorrect syntax.

    I’ve not tried this code, but I have looked at the documentation and a few support topics for ACF to see how the its tags work and I think this may be close to what you need:

    <?php
    
    echo do_shortcode('[tabby title="' . the_field('first_title') . '"]');
    
    the_field('first_content');
    the_field('first_lightbox');
    
    echo do_shortcode('[tabby title="' . the_field('second_title') . '"]');
    
    the_field('second_content');
    the_field('second_lightbox);
    
    echo do_shortcode('[tabby title="' . the_field('third_title') . '"]');
    
    the_field('third_content');
    the_field('third_lightbox);
    
    echo do_shortcode('[tabbyending]');
    
    ?>
    Thread Starter maxupp

    (@maxupp)

    Outstanding. I think that gets it!

    A big solution was calling the shortcode for each individual title – with that I can use regular custom fields inside each box. And those title aught to work.

    Your help is much appreciated!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Using advanced custom fields’ is closed to new replies.