Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your question.

    You could try the “WordPress Post Tabs” plugin from https://www.ads-software.com/extend/plugins/wordpress-post-tabs/. This is known to work with WP-Table Reloaded. See https://www.inlandbasketball.com/season-5/wnl/ for an example.

    Best wishes,
    Tobias

    Thread Starter drizzle

    (@drizzle)

    Thanks for the reply, and that’s a nice looking example.

    By coincidence, WP Post Tabs was one of the plugins I was trying. Haven’t been able to merge their php code for use on a template with yours.

    Here’s the code I’m using on the template to create two of the tables, which work fine:

    <?php
    $table_id = get_post_meta($post->ID, 'roster_id', true);
    wp_table_reloaded_print_table( "id=$table_id" );
    ?>
    
    <?php
    $table_id = get_post_meta($post->ID, 'schedule_id', true);
    wp_table_reloaded_print_table( "id=$table_id" );
    ?>

    Their template code for the tabs is (from their website):

    [php]<?php do_shortcode("[mytab name='TEST TAB 1']Tab1 content[/mytab]");
    do_shortcode("[mytab name='TEST TAB 2']Tab2 content[/mytab];");
    echo do_shortcode("[end_mytabset]");?>[/php]

    I’m just not sure how to replace the “Tab1 content” and “Tab2 content” with the table code.

    Any thoughts? Thanks…

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    oh, I see.
    What you need is either the other WP-Table Reloaded template tag function wp_table_reloaded_get_table() (which does not automatically echo the table HTML), or you could simply use the Shortcode now:

    <?php
    $roster_table_id = get_post_meta( $post->ID, 'roster_id', true );
    do_shortcode( "[tab name='Roster'][table id={$roster_table_id} /][/tab]" );
    $schedule_table_id = get_post_meta( $post->ID, 'schedule_id', true );
    do_shortcode( "[tab name='Schedule'][table id={$schedule_table_id} /][/tab]" );
    echo do_shortcode("[end_tabset]");
    ?>

    Regards,
    Tobias

    Thread Starter drizzle

    (@drizzle)

    Thanks, Tobias. Works and looks great.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    very nice! Good to hear that!

    Best wishes,
    Tobias

    Thread Starter drizzle

    (@drizzle)

    When using this approach to inserting tables into the tabs, can html also be used to insert additional content before and after the table shortcode? I keep getting error messages when I try that.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    yes, of course. I don’t see why this should not work. Just maske sure to add the HTML code correctly, either outside of PHP brackets, or in echo statements. There, you’ll need to watch " and ' characters, to make sure everything is interpreted as a string.

    Regards,
    Tobias

    Thread Starter drizzle

    (@drizzle)

    Thanks. I’ve got the tables showing fine, but my gallery isn’t visible and the paragraph appears above the tabs and under the title.

    <?php get_header(); the_post(); ?>
    <h1 class="year"><?php the_title(); ?></h1>
    <?php
    $roster_table_id = get_post_meta( $post->ID, 'roster_id', true );
    do_shortcode( "[tab name='Roster'][table id={$roster_table_id} /]  [/tab]" );
    $schedule_table_id = get_post_meta( $post->ID, 'schedule_id', true );
    do_shortcode( "[tab name='Schedule'][table id={$schedule_table_id} /][/tab]" );
    do_shortcode( "[tab name='Gallery']" );
    ?>
    <p>Click on photo to enlarge</p>
    <?php
    $team_gallery_id = get_post_meta( $post->ID, 'gallery_id', true );
    do_shortcode( "[nggallery id={$team_gallery_id} template=caption]" );
    do_shortcode( "[/tab]" );
    echo do_shortcode("[end_tabset]");
    ?>
    <?php get_footer(); ?>
    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    I can’t see anything wrong in the code…
    Can you maybe post the URL to the page where this is happening? Maybe I can find something then.

    Regards,
    Tobias

    Thread Starter drizzle

    (@drizzle)

    Tobias,

    Here’s the page I’m working on:
    https://wyofootball.com/history/past-teams/2001-spartans/

    If I add “echo” before the Gallery shortcode, the images appear but above the tabs.

    The paragraph “Click on photo to enlarge” always appears above the tabs, even though I want it to appear under the tabs only when “Gallery” is selected.

    Thanks

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    after checking the WordPress source code again, I found that ALL do_shortcode() calls do in fact need an echo in front of them.
    Can you add that to all of them? Maybe that helps.

    Regards,
    Tobias

    Thread Starter drizzle

    (@drizzle)

    Thanks. I added the echo’s but still have the problem with the tabs appearing below the gallery. It may be an issue with the gallery shortcode.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ok, thanks for adding that. Yes, it’s either a problem with the gallery Shortcode or with the Tabs Shortcode (I assume the latter).

    Regards,
    Tobias

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Plugin: WP-Table Reloaded] Viewing tables within tabs’ is closed to new replies.