Conversation
supportHello, This plugin works perfect and I had no problem adding a field to acf group and displaying a table on the front end. My question is, is there anyway to get the output table code to use the same output as using the shortcode of [table id=1 responsive=scroll /] and use the features or format of the responsive add-on. https://tablepress.org/extensions/responsive-tables/ Thanks, Paul
Hi Paul, Sorry for the (very) belated response here, I only just saw the notification here on wordpress.org. If you are still having trouble: the simplest answer is to use “do_shortcode()”. echo do_shortcode( '[table id="'.$tablepress_id.'" responsive=scroll]' ); should do the trick. There are other (smarter/faster) ways to avoid do_shortcode and use tablepress_print_table(), but I’m not sure how straightforward that is. It could be something as simple as $args = array( 'id' => get_field( 'your_field_here'), 'responsive => 'scroll' ); if ( function_exists( 'tablepress_print_table' ) ) { tablepress_print_table( $args ); } But I have not tested the code above. I am, however reasonably certain do_shortcode() will work fine. Let me know if you are still having trouble and I can play around with it a little more. Best, Phil
Hi Paul, Sorry for the (very) belated response here, I only just saw the notification here on wordpress.org. If you are still having trouble: the simplest answer is to use “do_shortcode()”. echo do_shortcode( '[table id="'.$tablepress_id.'" responsive=scroll]' ); should do the trick. There are other (smarter/faster) ways to avoid do_shortcode and use tablepress_print_table(), but I’m not sure how straightforward that is. It could be something as simple as $args = array( 'id' => get_field( 'your_field_here'), 'responsive => 'scroll' ); if ( function_exists( 'tablepress_print_table' ) ) { tablepress_print_table( $args ); } But I have not tested the code above. I am, however reasonably certain do_shortcode() will work fine. Let me know if you are still having trouble and I can play around with it a little more. Best, Phil