Using Checkboxes on Plugin Options Page for Custom Plugin

This should do it: // Going to add a conditional statement here to run this vc_remove_element function if the checkbox for Row is selected vc_remove_element( “vc_row” ); // Row add_action(‘admin_menu’, ‘plugin_admin_settings_tab’); function plugin_admin_settings_tab() { add_options_page(‘Remove Visual Composer Elements’, ‘Remove Visual Composer Elements’, ‘manage_options’, ‘remove_visual_composer_elements’, ‘plugin_rvce_options_page’); add_action(‘admin_init’, ‘plugin_rvce_admin_init’); } ?> <?php function plugin_rvce_options_page() { ?> <div> … Read more

Activation hook not creating table

The table name needs to be in quotes on the line where you’re checking if it exists. I tested it, and after that was fixed, the table was successfully created. Here is the full code: function mm_booking_activate() { global $wpdb; $mm_booking_table_name = $wpdb->prefix . “mm_booking”; $mm_booking_db_version = ‘1.0’; $charset_collate = $wpdb->get_charset_collate(); if ( $wpdb->get_var( “SHOW … Read more

WordPress Admin Post Type Table Class Filter Hook

The function get_post_class() is used to generate these classes. You can filter post_class to change the output. Example is_admin() && add_filter( ‘post_class’, function( $classes, $class, $post_id ) { $post = get_post( $post_id ); // Decide whether to add a class or not … $classes[] = ‘my-custom-class’; return $classes; }, 10, 3 );

Adding Automatically To In WordPress Using Filter Referencing?

You can filter the_content and use preg_replace() to look for instances of <table></table> and then surround them with your <div>. add_action( ‘the_content’, ‘wpse_260756_the_content’, 10, 1 ); function wpse_260756_the_content( $content ) { $pattern = “/<table(.*?)>(.*?)<\/table>/i”; $replacement=”<div class=”table-responsive”><table$1>$2</table></div>”; return preg_replace( $pattern, $replacement, $content ); }