$checkbox ) { if ( 'on' == $checkbox ) { array_push( $post_types, $post_type ); } } $metabox = new_cmb2_box( array( 'id' => $prefix . 'metabox', 'title' => 'Facebook Conversion Pixel', 'object_types' => $post_types, 'context' => 'normal', 'priority' => 'high', 'show_names' => true, ) ); $metabox->add_field( array( 'name' => __( 'Insert Code', 'facebook-conversion-pixel' ), 'desc' => __( 'Insert Facebook Conversion Pixel code on this page', 'facebook-conversion-pixel' ), 'id' => $prefix . 'checkbox', 'type' => 'checkbox', ) ); $metabox->add_field( array( 'name' => __( 'Conversion Pixel', 'facebook-conversion-pixel' ), 'desc' => __( 'Paste your Facebook Conversion Pixel code here', 'facebook-conversion-pixel' ), 'id' => $prefix . 'conversion_code', 'type' => 'textarea_code', ) ); } add_filter( 'cmb2_init', 'fb_pxl_display_meta_box' ); /** * Display settings link on WP plugin page * @since 1.0 */ function fb_pxl_plugin_action_links( $links, $file ) { $plugin_file = 'facebook-conversion-pixel/facebook-conversion-pixel.php'; if ( $file == $plugin_file ) { $settings_link = '' . __( 'Settings', 'facebook-conversion-pixel' ) . ''; array_unshift( $links, $settings_link ); } return $links; } add_filter( 'plugin_action_links', 'fb_pxl_plugin_action_links', 10, 4 ); /** * Set default options on activation * @since 1.1 */ function fb_pxl_activate() { $options = array( 'post' => 'on', 'page' => 'on' ); update_option( 'fb_pxl_options', $options ); } register_activation_hook( __FILE__, 'fb_pxl_activate' );

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *