• I am hoping to drive some mobile traffic directly into a Reloaded table, and I’ve found that the Preview lightbox that comes up from tables listings is pretty much exactly what i need.

    So i’m wondering if it’s possible to access a non-styled (or at least, non javascript) version of the table that doesn’t live inside a WP page or post, like the way this preview works.

    Please advise!

    thanks

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

    (@tobiasbg)

    Hi,

    the preview is only available to logged-in users that have the right to access WP-Table Reloaded, so that’s not really going to help here.

    What you could do is this: Use a filter hook that dynamically deactivates the usage of the JavaScript library, depending on whether the user is using a mobile browser.

    This could be starting point (add it to your theme’s “functions.php”, but you will need to implement a function “is_mobile_browser()” first, i.e. a detection on whether the current page view should use the JavaScript library):

    function remove_datatables_for_mobile_browsers( $attributes ) {
      if ( is_mobile_browser() )
        $attributes['use_tablesorter'] = false;
      return $attributes;
    }
    add_filter( 'wp_table_reloaded_shortcode_table_default_atts', 'remove_datatables_for_mobile_browsers' );

    Another idea would be to remove the default CSS from the page, after you determine that you want an unstyled table. To achieve that, you would need something like

    function maybe_remove_wp_table_reloaded_default_css() {
      if ( is_mobile_browser() )
        remove_action( 'wp_head', array( &$GLOBALS['WP_Table_Reloaded_Frontend'], 'add_frontend_css' ) );
    }
    add_action( 'wp_head', 'maybe_remove_wp_table_reloaded_default_css', 1 );

    If you already have a mobile theme, you won’t need that “is_mobile_browser()” function there.

    Hope this helps.

    Best wishes,
    Tobias

    Thread Starter madvibes

    (@madvibes)

    thanks for this, tobias!

    it’s not really the styling that i’m worried about, i would just like to be able to pull the table into a page that doesn’t load in the WP loop or have all the other content along side (nav, sidebar, etc). the unstyled/non-JS is just a byproduct of that, i think, which is useful, but not necessary

    do you know if that’s possible? for example, i use the Formidable Forms plugin for a lot of dynamic data, and it’s got a “preview form” that loads into a blank page, outside of WP, but is still live data that you can access directly.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no, this is not really possible that easily.

    WP-Table Reloaded always requires to be called from the frontend side of WordPress, i.e. from within a theme.
    Well, actually it just requires WordPress and all plugins to be loaded. After that, you can use either the Shortcode (which only are executed in the the_content() template tag function or in text widgets), or you can use the custom WP-Table Reloaded template tag function (see the docs), anywhere where PHP can be executed.

    So, if the page into which you want to pull the table has access to the WordPress functions, that template tag is the way to go.

    Regards,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: WP-Table Reloaded] Can I access the Table Preview directly?’ is closed to new replies.