芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/cepali.edu.mx/wp-content/themes/edufication/inc/metabox.php
meta_box = array ( 'id' => $meta_box_id, 'title' => $meta_box_title, 'post_type' => $post_type, ); $this->fields = array( 'edufication-sidebar-position', 'edufication-selected-sidebar', ); // Add metaboxes add_action( 'add_meta_boxes', array( $this, 'add' ) ); add_action( 'save_post', array( $this, 'save' ) ); } /** * Add Meta Box for multiple post types. * * @since Edufication 1.0.0 * * @access public */ public function add($postType) { if( in_array( $postType, $this->meta_box['post_type'] ) ) { add_meta_box( $this->meta_box['id'], $this->meta_box['title'], array( $this, 'show' ), $postType ); } } /** * Renders metabox * * @since Edufication 1.0.0 * * @access public */ public function show() { global $post; $layout_options = edufication_sidebar_position(); $sidebar_options = edufication_selected_sidebar(); // Use nonce for verification wp_nonce_field( basename( __FILE__ ), 'edufication_custom_meta_box_nonce' ); // Begin the field table and loop ?>
ID, 'edufication-sidebar-position', true ); if( empty( $metalayout ) ){ $metalayout=''; } foreach ( $layout_options as $value => $url ) : echo '
'; echo '
'; echo '
'; echo '
'; endforeach; ?>
ID, 'edufication-selected-sidebar', true ); if ( empty( $metasidebar ) ){ $metasidebar='sidebar-1'; } foreach ( $sidebar_options as $field => $value ) { ?>
/>
fields as $field ) { // Checks for input and sanitizes/saves if needed if( isset( $_POST[ $field ] ) ) { update_post_meta( $post_id, $field, sanitize_text_field( wp_unslash( $_POST[ $field ] ) ) ); } } // end foreach } } $post_types = array( 'page', 'post' ); $edufication_metabox = new Edufication_MetaBox( 'edufication-options', //metabox id esc_html__( 'Edufication Meta Options', 'edufication' ), //metabox title $post_types //metabox post types ); /** * Enqueue scripts and styles for Metaboxes * @uses wp_enqueue_script, and wp_enqueue_style * * @since Edufication 1.0.0 */ function edufication_enqueue_metabox_scripts( $hook ) { if( $hook == 'post.php' || $hook == 'post-new.php' ){ //Scripts wp_enqueue_script( 'edufication-metabox', get_template_directory_uri() . '/assets/js/metabox' . edufication_min() . '.js', array( 'jquery', 'jquery-ui-tabs' ), '2013-10-05' ); //CSS Styles wp_enqueue_style( 'edufication-metabox-tabs', get_template_directory_uri() . '/assets/css/metabox-tabs' . edufication_min() . '.css' ); } return; } add_action( 'admin_enqueue_scripts', 'edufication_enqueue_metabox_scripts', 11 );