All, I'm trying to create a custom template to display my single blog posts and I'm trying to use Shortcodes to create a tabbed layout. Say I have the following code to display some tabs:
<?php
echo do_shortcode('[tabs][tab title="Tab 1"]This is text[/tab][tab title="Tab2"]Tab content...[/tab][/tabs]');
?>
This works fine, however say I'd like to add in some dynamic content into my second tab with a query.
I tried to do something like this:
<?php
$shortcode = do_shortcode('[tabs][tab title="Tab 1"]This is text[/tab][tab title="Tab2"]');
$post_id = $post->ID;
$qry = "Select * from table where ID='$post_id'";
$result = mysql_query($qry);
$resultset = mysql_fetch_array($result);
$shortcode .= "The first field is: ".$resultset['field1'];
$shortcode .= do_shortcode('[/tab][/tabs]');
echo $shortcode;
?>
However this didn't work. I can't think of any other way to add some custom dynamic content into a shortcode. Can anyone else give me some ideas?
Thanks in advance