Support » Fixing WordPress » Adding shortcode for tabs to PHP file

  • HI.

    I was just wondering about how best to use shortcakes within PHP.
    I think I have it right but seems to be a problem of calling a custom attribute within the php?

    Any suggestions of how to have single quotes within the do_shortcode?
    I have tried double quotes at the start or double quotes around the single quote in the #ATT call but both don’t produce anything.

    <?php echo do_shortcode(
    	"[tabs slidertype='top tabs']
    	[tabcontainer]
    	[tabtext] Event Details [/tabtext]
    	[tabtext] Sponsors [/tabtext]
    	[tabtext]Terms & Conditions [/tabtext]
    	[/tabcontainer]
    	[tabcontent]
    	[tab] Content [/tab]
    	[tab] <?php echo $EM_Event->output('#_ATT{Sponsors'}) ?> [/tab]
    	[tab] <?php echo $EM_Event->output('#_ATT{Terms}') ?> [/tab]
    	[/tabcontent] [
    	/tabs]"); ?>

    Thanks
    Troy

Viewing 3 replies - 1 through 3 (of 3 total)
  • have you tried this, maybe ?

    $sponsors = $EM_Event->output('#_ATT{Sponsors}');
    $terms = $EM_Event->output('#_ATT{Terms}');
    
    echo do_shortcode( "
    		[tabs slidertype=\"top tabs\"]
    			[tabcontainer]
    				[tabtext] Event Details [/tabtext]
    				[tabtext] Sponsors [/tabtext]
    				[tabtext]Terms & Conditions [/tabtext]
    			[/tabcontainer]
    			[tabcontent]
    				[tab] Content [/tab]
    				[tab] $sponsors [/tab]
    				[tab] $terms [/tab]
    			[/tabcontent]
    		[/tabs]
    	");

    Thanks.

    I was able to get the tabs to display, but it displays $sponsors and $terms within the pages rather than the attributes?

    Any other thoughts it looks like everything is in comments rather than individual parts
    `<?php
    $sponsors = $EM_Event->output(‘#_ATT{Sponsors}’);
    $terms = $EM_Event->output(‘#_ATT{Terms}’);

    echo do_shortcode(‘
    [tabs slidertype=”top tabs”]
    [tabcontainer]
    [tabtext] Event Details [/tabtext]
    [tabtext] Sponsors [/tabtext]
    [tabtext]Terms & Conditions [/tabtext]
    [/tabcontainer]
    [tabcontent]
    [tab] Content [/tab]
    [tab] $sponsors [/tab]
    [tab] $terms [/tab]
    [/tabcontent]
    [/tabs]’) ?>;

    <div class=”booking-form”>

    <?php echo $EM_Event->output(‘#_BOOKINGFORM’); ?>’

    Thanks

    echo do_shortcode('
    					[tabs slidertype="top tabs"]
    						[tabcontainer]
    							[tabtext] Event Details [/tabtext]
    							[tabtext] Sponsors [/tabtext]
    							[tabtext]Terms & Conditions [/tabtext]
    						[/tabcontainer]
    						[tabcontent]
    							[tab] Content [/tab]
    							[tab] '. $EM_Event->output('#_ATT{Sponsors}') .' [/tab]
    							[tab] '. $EM_Event->output('#_ATT{Terms}') .' [/tab]
    						[/tabcontent]
    					[/tabs]
    				');
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding shortcode for tabs to PHP file’ is closed to new replies.