Hi,
thanks for your post, and sorry for the trouble.
Does everything work again if you remove that PHP code from the theme’s “functions.php” file again?
Can you please turn on the WP_DEBUG constant (via https://wordpress.org/support/article/editing-wp-config-php/#wp_debug )? That should show us an error message instead that unclear message.
Unfortunately, I don’t know that “Woody Ad Snippets” plugin and don’t know how to make it work with filtering, sorry.
Regards,
Tobias
Hey there!
Yep. I’ve now turned on WP_DEBUG. Here’s my current code that I took from the other example which might have something to do with it:
add_shortcode( 'table-user-filtered', 'formfunia_tablepress_filtered_table' );
function formfunia_tablepress_filtered_table( $atts ) {
if ( ! is_user_logged_in() ) {
return 'Error: No user is logged in.';
}
$current_user = wp_get_current_user();
$username = $current_user->user_login;
$atts['filter'] = $username;
$atts['cache_table_output'] = false;
return tablepress_get_table( $atts );
}
This returns the following error:
Fatal error: Uncaught Error: Call to undefined function tablepress_get_table() in /home/sploda/public_html/sp/wp-content/themes/sploda/functions.php:24 Stack trace: #0 /home/sploda/public_html/sp/wp-includes/shortcodes.php(325): formfunia_tablepress_filtered_table('j', '\n<div class="wp...', 'table-user-filt...') #1 [internal function]: do_shortcode_tag(Array) #2 /home/sploda/public_html/sp/wp-includes/shortcodes.php(199): preg_replace_callback('/\\[(\\[?)(table\\...', 'do_shortcode_ta...', '[table-user-fil...') #3 /home/sploda/public_html/sp/wp-content/plugins/insert-php/admin/includes/class.gutenberg.snippet.php(160): do_shortcode('[table-user-fil...') #4 /home/sploda/public_html/sp/wp-includes/class-wp-block-type.php(109): WINP_Gutenberg_Snippet->render_snippet_content(Array, '\n<div class="wp...') #5 /home/sploda/public_html/sp/wp-includes/blocks.php(263): WP_Block_Type->render(Array, '\n<div class="wp...') #6 /home/sploda/public_html/sp/wp-includes/blocks.php(314): render_block(Array) #7 /home/sploda/public_html/sp/w in /home/sploda/public_html/sp/wp-content/themes/sploda/functions.php on line 24
Do you know what I’d be able to do to customize the code to work with my site?
Thanks,
Jelani
Hi,
ok, can you please replace
add_shortcode( 'table-user-filtered', 'formfunia_tablepress_filtered_table' );
with
if ( ! is_admin() ) {
add_shortcode( 'table-user-filtered', 'formfunia_tablepress_filtered_table' );
}
Regards,
Tobias