Home › Forums › MapPress Support › maps in tabs- nesting shortcode
- This topic has 4 replies, 2 voices, and was last updated 11 years, 4 months ago by
jakbaustudio.
-
AuthorPosts
-
May 16, 2012 at 10:51 pm #9397
jakbaustudio
Participanthi,
My tabs and maps works good when I paste shortcode on page/entry, the problem shows up when I want to nest two shortcodes in the code by <?php echo do_shortcode…. >
I can nest shortcode, but when add attributes to mashup nothing loads.
I want to do
[tabset]
[tab]
[masup category 1 ]
[/tab]
[tab]
[masup category 2 ]
[/tab]
[/tabset]
This code is schematic.
Any idea how to solve that?
May 20, 2012 at 7:07 pm #9425Chris
KeymasterHi, I’m not sure I understand what you’re trying to do. Are you trying to get maps to work inside tabs when using the WordPress post/page editor?
Or are you trying to output tabs with maps in your template files using the do_shortcode() function?
Could you explain further? Do you have an example of your actual code?
May 20, 2012 at 9:13 pm #9426jakbaustudio
ParticipantHi,
I’m trying paste maps in my template file using do_shortcode() function
This code works almost good, but in TEST TAB 2 and 3 maps are not zoomed.
<?php do_shortcode(“[tab name=’TEST TAB 1′] [mashup][/tab]”);
do_shortcode(“[tab name=’TEST TAB 2′][mashup][/tab];”);
do_shortcode(“[tab name=’TEST TAB 3′][mashup][/tab];”);
echo do_shortcode(“[end_tabset]”);?>problem is when I paste attributes to mashup like:
<?php do_shortcode(“[tab name=’TEST TAB 1′] [mashup maptypeid="terrain" zoom="6" center_lat="51.984880" center_lng="19.401855" width="600" height="500"][/tab]”);
do_shortcode(“[tab name=’TEST TAB 2′][mashup show="query" maptypeid="terrain" show_query="category_name=turystyka-i-relaks" zoom="6" center_lat="51.984880" center_lng="19.401855" width="600" height="500"][/tab];”);
do_shortcode(“[tab name=’TEST TAB 3′][mashup show="query" show_query="category_name=zabytki-i-zwiedzanie" maptypeid="terrain" zoom="6" center_lat="51.984880" center_lng="19.401855" width="600" height="500"][/tab];”);
echo do_shortcode(“[end_tabset]”);?>This stuff doesn’ load. Any ideas? would be greatfull for that.
u can see that here:
it works on page edit see sample here: http://blaskipolski.pl/domo/
May 21, 2012 at 6:32 am #9430Chris
KeymasterHi,
Is it the same behavior when you put the shortcodes in a post (rather than using do_shortcode)?
I don’t know how to see that on your site so I don’t know what you mean by it doesn’t load? You get a blank map? Or no map?
What tab plugin are you using?
I think the problem is that the tabs plugin must itself call do_shortcode() on its content, otherwise it won’t process the inside shortcodes. When I search on Google it seems a lot of people have this problem, for example:
http://wordpress.stackexchange.com/questions/18659/nested-shortcode-doesnt-work
I’m not sure it would work, but maybe you could first explode the map shortcode, then put the result in the tabs? That way they wouldn’t be nested any more:
$tab1 = do_shortcode("[mashup]");
$tab2 = do_shortcode("[mashup]");
echo do_shortcode("[tab name='tab1']$tab1[/tab1]");May 24, 2012 at 10:18 pm #9456jakbaustudio
ParticipantI have changed my strategy 🙂 instead of using do shortcode in template.
I have created another widget area and put into template. When i paste nested shortcoede into widgets everything works great on homepage !
-
AuthorPosts
- You must be logged in to reply to this topic.