Custom page template that utilizes shortcode in the loop

I am trying to create a custom page template in wordpress utilizing the the loop and a tabs shortcode (from shortcodes ultimate plugin). I am able to use do_shortcode in the template and as long as I am not attempting to pass variables through the shortcode, it will populate the tabs and the content as needed. However, I want to be able to use the_title() and the_ID() to dynamically populate the content (as we add pages under the parent page, these pages will automatically be brought in as tabs on the parent page).

My trouble is that I am just good enough with PHP to stumble through most things, they just take me way longer than a PHP guru. However, this one has cost me a day’s worth of back and forth with the code. I am grateful for any help/insight!

$args = array(
‘post_type’ => ‘page’,
‘post_parent’ => $post->ID,
‘order’ => ‘ASC’,
‘orderby’ => ‘title’,
‘posts_per_page’ => ‘-1’
$parent = new WP_Query( $args );
if ( $parent->have_posts() ) :
while ( $parent->have_posts() ) : $parent->the_post(); // IF THE PARENT HAS POSTS, ITERATE POST CONTENT

      $tab_content = '[su_tab title="' . the_title() . '" disabled="no" anchor="tab_' . the_ID() . '"]';
      $tab_content .= the_content();
      $tab_content .= '[/su_tab]'; 

endif; wp_reset_postdata(); //END PULLING CHILDREN

$tab_beg = ‘[su_tabs style=“default” active=“1” vertical=“no”]’; //beginning tab container
$tab_end = ‘[/su_tabs]’; //close tab container

$full_tabs = $tab_beg . $tab_content . $tab_end;
echo do_shortcode( $full_tabs );

Sponsor our Newsletter | Privacy Policy | Terms of Service