Support » Plugin: TablePress - Tables in WordPress made easy » TablePress class is no longer available

  • Resolved buzibuzi

    (@buzibuzi)


    Hi, thank you for this great plugin. i have been using it to load data in a php class loaded functions.php to load some data using this code

    if ( defined( 'TABLEPRESS_ABSPATH' ) && class_exists('TablePress') ) {
        TablePress::$model_options = TablePress::load_model( 'options' );
        TablePress::$model_table = TablePress::load_model( 'table' );
        TablePress::$controller = TablePress::load_controller( 'frontend' );
        TablePress::$controller->init_shortcodes();
        $table = TablePress::$model_table->load(6);
        /* the rest of the code here..... */
    }

    for some reason, today, the TablePress class is no longer available. what could be the reason ?
    what can i do to include it in this code so i can use it again ?
    require(?)

    Thanks

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

    (@tobiasbg)

    Hi,

    is just the class not available (i.e. the class_exists() check returns false), or is the TABLEPRESS_ABSPATH not defined either?
    Is TablePress working by itself?

    Regards,
    Tobias

    Thread Starter buzibuzi

    (@buzibuzi)

    both
    class_exists() check returns false and TABLEPRESS_ABSPATH retuns false.
    the plugin is functional in backend. but shortcode doesnt work in front end

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    then your code is probably running too early (before TablePress is loaded). You might have to wrap everything in a filter hook function that is hooked to the plugins_loaded or init filter hook.

    Regards,
    Tobias

    Thread Starter buzibuzi

    (@buzibuzi)

    but nothing changed, except for WordPress being updated to version 6.
    it also doesn’t explain why I’m not seeing the short code rendered properly on the front end.
    im seeing
    [table id=4 /]

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ok, if you are only seeing the Shortcode on the frontend, something strange is going on. Are you really sure that TablePress is working fine in the admin area, i.e. can you access the list of tables?

    Regards,
    Tobias

    Thread Starter buzibuzi

    (@buzibuzi)

    Yes, it is strange. i can access the tables and edit them in the admin area.
    perhaps some files are corrupt. if i install the plugin again will it overwrite the DB data from the current installation ?

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    yes, that should be worth a try. And no worries, replacing the files will keep the data in the DB untouched, so nothing to lose there.

    Regards,
    Tobias

    Thread Starter buzibuzi

    (@buzibuzi)

    Hi Tobias, i tried this. reinstalled the plugin.
    same result.
    could it be the order in which the class is being called. maybe its not loaded yet when im trying to use it.could have started after new the WordPress 6 update.
    But this doesnt explain the shortcode issue.

    anyway, i would like to call the Tablepress class using PHP ‘include’ for testing purpose. could you point me to the right way to do this ?
    Thanks

    Thread Starter buzibuzi

    (@buzibuzi)

    my bad, i had some forgotten plugin filter that kicked-in for some reason.
    all is fine.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ah, that explains things 🙂 Good to hear that everything is working now!

    Best wishes,
    Tobias
     
    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘TablePress class is no longer available’ is closed to new replies.