ID ); $selected = isset( $values['header_choice_select'] ) ? esc_attr( $values['header_choice_select'][0] ) : ''; $check = isset( $values['footer_widget_check'] ) ? esc_attr( $values['footer_widget_check'][0] ) : ''; wp_nonce_field( 'page_opt_meta_box_nonce', 'meta_box_nonce' ); ?>
Select Header Element:
* To select header for blog go to Appearance / Theme options / Blog Options
/>
array( // on allow a tags 'href' => array() // and those anchords can only have href attribute ) ); if( isset( $_POST['header_choice_select'] ) ) update_post_meta( $post_id, 'header_choice_select', esc_attr( $_POST['header_choice_select'] ) ); $chk = ( isset( $_POST['footer_widget_check'] ) && $_POST['footer_widget_check'] ) ? 'on' : 'off'; update_post_meta( $post_id, 'footer_widget_check', $chk ); } /* * --------------------------------------------------------------------- * MNKY Custom header image * --------------------------------------------------------------------- */ add_action( 'add_meta_boxes', 'custom_header_id' ); function custom_header_id() { $post_types = get_post_types(); foreach ( $post_types as $post_type ) { if ($post_type == 'ad_post_type') {$post_type = 'page';} add_meta_box( 'custom_header_img_url', 'Custom Header Image URL', 'custom_header_img_add', $post_type, 'normal', 'high' ); } } function custom_header_img_add( $post ) { $values = get_post_custom( $post->ID ); $chi_url = isset( $values['custom_header_id'] ) ? esc_attr( $values['custom_header_id'][0] ) : ''; wp_nonce_field( 'custom_header_img_add_nonce', 'meta_box_nonce_chi' ); ?> Header Image will only work if "Custom Header Element" chosen.array( // on allow a tags 'href' => array() // and those anchords can only have href attribute ) ); if( isset( $_POST['custom_header_id'] ) ) update_post_meta( $post_id, 'custom_header_id', esc_attr( $_POST['custom_header_id'] ) ); } /* * --------------------------------------------------------------------- * MNKY Custom header HTML * --------------------------------------------------------------------- */ function custom_header_b($post) { global $metaBox; if (function_exists('wp_nonce_field')) { wp_nonce_field('awd_nonce_action','awd_nonce_field'); } foreach ($metaBox['fields'] as $field) { echo '
'; } //end foreach }//end function custom_header_b function saveMetaData($post_id, $post) { //make sure we're saving at the right time. //DOING_AJAX is set when saving a quick edit on the page that displays all posts/pages //Not checking for this will cause our meta data to be overwritten with blank data. if ( empty($_POST) || !wp_verify_nonce(isset($_POST['awd_nonce_field']) && $_POST['awd_nonce_field'],'awd_nonce_action') || $post->post_type == 'revision' || defined('DOING_AJAX' )) { return; } global $metaBox; global $wpdb; foreach ($metaBox['fields'] as $field) { $value = $_POST[$field['id']]; if ($field['type'] == 'media' && !is_numeric($value) ) { //Convert URL to Attachment ID. $value = $wpdb->get_var( "SELECT ID FROM $wpdb->posts WHERE guid = '$value' AND post_type='attachment' LIMIT 1"); } update_post_meta($post_id, $field['id'], $value); }//end foreach }//end function saveMetaData /** * Add JavaScript to get URL from media uploader. */ function embedUploaderCode() { ?> 'custom_header_html_add', 'title' => 'Custom Header HTML, insert anything you want.', 'context' => 'normal', 'priority' => 'high', 'fields' => array( array( 'name' => 'Textarea', 'desc' => 'Custom Header HTML will only work if "Custom Header Element" choosen. Supports Flash objects and shortcodes!', 'id' => 'custom_header_html', 'type' => 'textarea', 'std' => '' ) ) ); add_action('admin_menu', 'mytheme_add_box'); // Add meta box function mytheme_add_box() { $post_types = get_post_types(); foreach ( $post_types as $post_type ) { global $meta_box; add_meta_box($meta_box['id'], $meta_box['title'], 'mytheme_show_box', $post_type, $meta_box['context'], $meta_box['priority']); } } // Callback function to show fields in meta box function mytheme_show_box() { global $meta_box, $post; if (function_exists('wp_nonce_field')) { wp_nonce_field('mytheme_nonce_action','mytheme_nonce_field'); } foreach ($meta_box['fields'] as $field) { // get current post meta data $meta = get_post_meta($post->ID, $field['id'], true); switch ($field['type']) { case 'textarea': echo '', $field['desc'],'
Choose cover style for portfolio item thumbnail.
Leave second field blank to disable corresponding string. Default detail titles are changeable.
array( // on allow a tags 'href' => array() // and those anchords can only have href attribute ) ); if( isset( $_POST['portfolio_cat_id_value'] ) ) update_post_meta( $post_id, 'portfolio_cat_id_value', wp_kses( $_POST['portfolio_cat_id_value'], $allowed ) ); } ?>