Home Forums Front-end Issues Displaying a group outside WordPress Loop Reply To: Displaying a group outside WordPress Loop

  • James, The Tab is working using Ajax. Here is my page template that is set for tabs.

    Template Name: Single Post with data
    //* Enqueue tab js including jQuery UI Tabs
    add_action( 'wp_enqueue_scripts', 'my_load_tab_script' );
    function my_load_tab_script() {
    	wp_enqueue_script( 'my-tabs', get_stylesheet_directory_uri() . '/assets/js/my-tabs-ajax.js', array( 'jquery-ui-tabs' ), '1.0.0', true );
    //* Remove the post content and add our tabbed content
    remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
    add_action( 'genesis_entry_content', 'my_do_tabbed_content' );
    function my_do_tabbed_content() {
    	<div id="tab-wrap">
    		<!-- Tab links -->
    		<ul class="tabs">
    			<li><a href="#tab_1">Overview</a></li>
    			<li><a href="<?php echo get_stylesheet_directory_uri(); ?>/includes/tabs/data.php" class="tab">HTML</a></li>
    		<div class="my-tab-content">
    			<!-- Tab content - id must match the href from the tab link -->
    			<div id="tab_1">
    				<?php the_content(); ?>
    //* Run the Genesis loop

    and here is my data tab file data.php

    // Include WordPress
    define('WP_USE_THEMES', false);
     $group_ID = 12113;
     $fields = get_fields($groupID);
     $fields = get_field_objects();
    echo '<div class="aps-column">';
    echo '<div class="aps-group">';
    echo '<ul class="aps-specs-list">';
              if( $fields )
                foreach( $fields as $field_name => $field )
                  if( $field['value'] )
                      echo ' <li>';
                        echo '<strong class="aps-term">' . $field['label'] . '</strong>';
    echo '<div class="aps-attr-value"><span class="aps-1co">' . $field['value'] . '</span></div>';
    echo '</li>';
    echo '</ul>';
    echo '</div>';
    echo '</div>';

    I tried a lot of code but as i am not a php professional i am doing some mistake. Thanks again for your kind support.