Support » Plugin: Tabby Responsive Tabs » Shortcode don't works

  • Resolved marcophile

    (@marcophile)


    Hello
    When i put this code

    [tabby title="La Gacilly" open="yes"]
    <iframe style="border: 0;" src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d42899.20715371446!2d-2.1476838!3d47.7775611!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x480fa242eb6c30d3%3A0x6062024848c53b24!2sLa+Gacilly!5e0!3m2!1sfr!2sfr!4v1400489796389" width="800" height="600" frameborder="0"></iframe>
    [tabby title="La commune"]
    [pages_communes commune=1460]
    [tabby title="La Poste"]
    Essai
    [tabbyending]

    The page doesn’t show the results of shortcode in tabs 2
    but it appears above. You can see it at
    http://marcophilie56.shost.ca/le-morbihan/les-communes-du-morbihan/g/la-gacilly/
    Thanks for help

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

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

    (@numeeja)

    The tabs look as I would expect them to, however there does not appear to be any content generated by your [pages_communes commune=1460] shortcode.

    Shortcodes are normally fine to use in tab content (except for some map and dynamic gallery plugins where the content is rendered at zero size if it is not initially visible on page load).

    What content are you expecting to see generated by the [pages_communes commune=1460] shortcode? Is this from a plugin? If so which one? Does this shortcode work if you place it on the page but outside of the tabgroup?

    Thread Starter marcophile

    (@marcophile)

    I have changed the code like this and the sub-pages appear

    [pages_communes commune=1460]
    [tabby title="La Gacilly" open="yes"]
    <iframe style="border: 0;" src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d42899.20715371446!2d-2.1476838!3d47.7775611!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x480fa242eb6c30d3%3A0x6062024848c53b24!2sLa+Gacilly!5e0!3m2!1sfr!2sfr!4v1400489796389" width="800" height="600" frameborder="0"></iframe>
    [tabby title="La commune"]
    Commune
    [tabby title="La Poste"]
    Essai
    [tabbyending]

    The shortcode shows sub-pages of the page
    the code is

    function sous_pages($atts, $content=null)
    {
    	extract(shortcode_atts(array(
    	'commune' => '46'
    	), $atts));
    		echo '	<ul>   ';
    		  echo ' <ul>';
             wp_list_pages("title_li=&child_of=$commune");
    	               echo '<font size="2" face="Comic Sans MS">';
    	          echo $children;
    	 echo '</font>';
    	 echo '   </ul>';
    	 }
     add_shortcode('pages_communes', 'sous_pages');

    Plugin Author cubecolour

    (@numeeja)

    Where did you get that code? There are some problems with it.

    • The unordered list tags are mismatched – there are two opening <ul> tags but only one closing </ul> tag
    • the $children variable has not been declared and it has not been assigned a value, so will always be empty.
    • <font> tags have long been deprecated. Your output should be styled with CSS instead. Here your font tag serves no purpose as the $children variable it surrounds is empty.
    • The output will appear before any other markup rather than appearing where the shortcode appears – it needs to be returned instead of echoed.

    To use the wp_list_pages without echoing the output, you can use the &echo=0 parameter/value pair.

    Try this in place of your original shortcode function:

    function sous_pages( $atts, $content=null ) {
    	extract(shortcode_atts(array(
    		'commune' => '46'
    	), $atts));
    
    $childlist = wp_list_pages( 'title_li=&child_of=' . $commune . '&echo=0');
    
    	if ($childlist) {
    		$output  = '<ul>';
    		$output .= $childlist;
    		$output .= '</ul>';
    
    		return $output;
    	}
    }
    
    add_shortcode('pages_communes', 'sous_pages');
    Thread Starter marcophile

    (@marcophile)

    Thanks it’s work
    I am beginner to code
    thanks again to have change the code

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Shortcode don't works’ is closed to new replies.