*/ /** * ============================================================================================= * Custom Page Meta Box * ============================================================================================= */ /** * Add meta box to pages. * * The format for the add_meta_box() is as follows: * add_meta_box( $id, $title, $callback, $post_type, $context, $priority, $callback_args ); * $id : (string) (required) HTML 'id' attribute of the edit screen section Default: None * $title : (string) (required) Title of the edit screen section, visible to user Default: None * $callback : (callback) (required) Function that prints out the HTML for the edit screen section. * Pass function name as a string * $post_type : (string) (required) The type of Write screen on which to show the edit screen section * ('post', 'page', 'link', or 'custom_post_type' where custom_post_type is the custom post type slug) * Default: None * $context : (string) (optional) The part of the page where the edit screen section should be shown * ('normal', 'advanced', or 'side'). (Note that 'side' doesn't exist before 2.7)Default: 'advanced' * $priority : (string) (optional) The priority within the context where the boxes should show * ('high', 'core', 'default' or 'low') Default: 'default' * $callback_args : (array) (optional) Arguments to pass into your callback function. The callback will receive * the $post object and whatever parameters are passed through this variable. Default: null * * @since 0.0.1 */ function canuck_add_page_custom_meta_box() { add_meta_box( 'canuck_page_custom_meta_box', __( 'Canuck Page Options', 'canuck' ), 'canuck_show_page_custom_meta_box', 'page', 'normal', 'high' ); } add_action( 'add_meta_boxes', 'canuck_add_page_custom_meta_box' ); /** * The Callback * * The callback is used to display the options on the page * * @since 0.0.1 */ function canuck_show_page_custom_meta_box() { global $post; $page_template = basename( get_page_template() ); // Initial notes. echo '' . wp_kses_post( __( 'If you are using a Portfolio template, or a Feature template, select the template and Save Draft to see more options.', 'canuck' ) ) . ''; echo '
' . esc_html__( 'Also note that the static home page, "Template: Home Page" does not use these options.', 'canuck' ) . '
'; // Use nonce for verification. wp_nonce_field( basename( __FILE__ ), 'canuck_page_meta_box_nonce' ); // **************** Page Layout Option ****************************************************. $page_layout = esc_html( get_post_meta( $post->ID, 'canuck_metabox_page_layout', true ) ); ?>

ID, 'canuck_metabox_title', true ) ? false : true ); ?>

>

ID, 'canuck_metabox_sidebar_a', true ) ); ?>

ID, 'canuck_metabox_sidebar_b', true ) ); ?>


ID, 'canuck_metabox_feature_category', true ) ); $categories = get_categories(); ?>

ID, 'canuck_metabox_feature_type', true ) ); ?>

-





ID, 'canuck_portfolio_category', true ) ); $categories = get_categories(); ?>

ID, 'canuck_portfolio_type', true ) ); ?>

ID, 'canuck_metabox_include_post_content_title', true ) ? true : false; ?>

>

ID, 'canuck_metabox_include_post_content', true ) ? true : false; ?>

>

ID, 'canuck_metabox_include_image_caption', true ) ? true : false; ?>

>

ID, 'canuck_metabox_include_image_description', true ) ? true : false; ?>

>


ID, 'canuck_metabox_include_feature_title', true ) ? false : true ); ?>

>


ID, 'canuck_metabox_link_to_post', true ) ? false : true ); ?>

>

ID, 'canuck_custom_feature_link', true ); ?>