Hi,
if your call to do_shortcode('[table id=62]'); only results in [table id=62], this means that the Shortcode is not yet registered, likely, because you are doing your call to early or something like that.
Where and how are you calling do_shortcode()? Can you provide a longer snippet of code? Why don’t you use the template tag the_content()?
And instead of do_shortcode('[table id=62]'); you could actually just use WP-Table Reloaded’s own template tag, like wp_table_reloaded_print_table( "id=62" ); (see http://tobias.baethge.com/wordpress-plugins/wp-table-reloaded-english/documentation/ for more on that).
Regards,
Tobias
I’m not printing the data out, that’s the thing, but putting it in a variable. The whole thing is in a plugin and run when I’m looking at the plugin admin menu.
I’m trying to do some SEO analysis and search the posts to find out posts that are missing links and images, and I need to find the links and images that are in tables.
Looks like I need to dig out the table id then and use wp_table_reloaded_get_table(). That should do the trick. Thanks!
Yeah, except the function isn’t defined either. I’m guessing the problem is that I’m doing this on the admin side.
Hi,
thanks for your clarification!
Yes, exactly, those functions are not available on the admin side (because the plugin itself never needs them there).
You could however simply load your own instance of the plugin frontend part in your plugin:
include_once ( WP_TABLE_RELOADED_ABSPATH . 'controllers/controller-frontend.php' );
$My_WP_Table_Reloaded = new WP_Table_Reloaded_Controller_Frontend();
After that, the Shortcodes should be available (as they are registered in the frontend class’s constructor), or you could directly perform a query:
$atts = array( 'id' => 62 );
$table_output = $My_WP_Table_Reloadedd->handle_content_shortcode_table( $atts );
Hope this helps!
Best wishes,
Tobias
Thanks, this sorted out the problem. I figured out the include, but not triggering the constructor.
As I said, excellent plugin, and top-notch support too!
Hi,
great! 🙂 Good to your that you got this to work!
Best wishes,
Tobias