ID, '_themetek_page_transparent_navbar', true ); // Show/hide title on pages echo '
'; echo ''; $page_transparent_navbar_checked = ''; if ($themetek_page_transparent_navbar == "yes") { $page_transparent_navbar_checked = 'checked="checked"'; } echo ''; echo ''; esc_html_e( 'If checked, the navbar section will take a transparent color. This option is linked with the homepage transparent settings.', 'ekko' ); echo ''; echo '
'; } // Print page title meta box content. function themetek_meta_box_title_section($post) { // Add an nonce field so we can check for it later wp_nonce_field( 'themetek_meta_box_title_section', 'themetek_meta_box_title_section_nonce' ); // Retrieve an existing value from the database and use the value for the form. $themetek_page_showhide_title_section = get_post_meta( $post->ID, '_themetek_page_showhide_title_section', true ); $themetek_page_showhide_breadcrumbs = get_post_meta( $post->ID, '_themetek_page_showhide_breadcrumbs', true ); $themetek_page_subtitle = get_post_meta( $post->ID, '_themetek_page_subtitle', true ); $themetek_page_title_color = get_post_meta( $post->ID, '_themetek_page_title_color', true ); $themetek_page_titlebar_background = get_post_meta( $post->ID, '_themetek_page_titlebar_background', true ); // Show/hide title on pages echo '
'; echo ''; $page_showhide_title_section_checked = ''; if ($themetek_page_showhide_title_section == "yes") { $page_showhide_title_section_checked = 'checked="checked"'; } echo ''; echo ''; esc_html_e( 'If checked, title section will be hidden.', 'ekko' ); echo ''; echo '
'; // Show/hide breadcrumbs on pages echo '
'; echo ''; $page_showhide_breadcrumbs_checked = ''; if ($themetek_page_showhide_breadcrumbs == "yes") { $page_showhide_breadcrumbs_checked = 'checked="checked"'; } echo ''; echo ''; esc_html_e( 'If checked, breadcrumbs will be hidden.', 'ekko' ); echo ''; echo '
'; // Page subtitle text echo '
'; echo ''; echo ''; echo ''; esc_html_e( 'Write the section subtitle. Displayed under the main page title.', 'ekko' ); echo ''; echo '
'; // Text align $values_text_align = get_post_custom( $post->ID ); $selected_text_align = isset( $values_text_align['page_title_align'] ) ? esc_attr( $values_text_align['page_title_align'][0] ) :''; echo '
'; echo ''; echo ''; echo '
'; // Page title and subtitle text color echo '
'; echo ''; echo ''; echo ''; esc_html_e( 'Specify the page title and subtitle color. Eg. #FFFFFF', 'ekko' ); echo ''; echo '
'; // Title bar background color echo '
'; echo ''; echo ''; echo ''; esc_html_e( 'Specify the title bar background color. Eg. #FFFFFF', 'ekko' ); echo ''; echo '
'; } // Print page settings meta box content. function themetek_meta_box_pagesettings($post) { // Add an nonce field so we can check for it later wp_nonce_field( 'themetek_meta_box_pagesettings', 'themetek_meta_box_pagesettings_nonce' ); // Retrieve an existing value from the database and use the value for the form. $themetek_page_bgcolor = get_post_meta( $post->ID, '_themetek_page_bgcolor', true ); $themetek_page_top_padding = get_post_meta( $post->ID, '_themetek_page_top_padding', true ); $themetek_page_bottom_padding = get_post_meta( $post->ID, '_themetek_page_bottom_padding', true ); // Get page background color echo '
'; echo ''; echo ''; echo ''; esc_html_e( 'Specify the page background color. Eg. #FFFFFF', 'ekko' ); echo ''; echo '
'; // Get page top padding echo '
'; echo ''; echo ''; echo ''; esc_html_e( 'Specify the page top padding value. Eg. 10px', 'ekko' ); echo ''; echo '
'; // Get page bottom padding echo '
'; echo ''; echo ''; echo ''; esc_html_e( 'Specify the page bottom padding value. Eg. 10px', 'ekko' ); echo ''; echo '
'; } // When the post is saved, saves our custom data. (Regular pages) function themetek_save_meta_box_data( $post_id ) { // Check if our nonce is set. if ( ! isset( $_POST['themetek_meta_box_page_header_nonce'] ) ) { return $post_id; } if ( ! isset( $_POST['themetek_meta_box_title_section_nonce'] ) ) { return $post_id; } if ( ! isset( $_POST['themetek_meta_box_pagesettings_nonce'] ) ) { return $post_id; } $nonce_pageheader = $_POST['themetek_meta_box_page_header_nonce']; $nonce_pagesettings = $_POST['themetek_meta_box_pagesettings_nonce']; $nonce_pagetitle = $_POST['themetek_meta_box_title_section_nonce']; // Verify that the nonce is valid. if ( ! wp_verify_nonce( $nonce_pageheader, 'themetek_meta_box_page_header' ) ) { return $post_id; } if ( ! wp_verify_nonce( $nonce_pagetitle, 'themetek_meta_box_title_section' ) ) { return $post_id; } if ( ! wp_verify_nonce( $nonce_pagesettings, 'themetek_meta_box_pagesettings' ) ) { return $post_id; } // If this is an autosave, our form has not been submitted, so we don't want to do anything. if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return $post_id; } // Check the user's permissions. if ( 'page' == $_POST['post_type'] ) { if ( ! current_user_can( 'edit_page', $post_id ) ) return $post_id; } else { if ( ! current_user_can( 'edit_post', $post_id ) ) return $post_id; } /* OK, it's safe for us to save the data now. */ // Sanitize user input and update the meta field in the database. if( isset( $_POST[ 'page_transparent_navbar' ] ) ) { update_post_meta( $post_id, '_themetek_page_transparent_navbar', 'yes' ); } else { update_post_meta( $post_id, '_themetek_page_transparent_navbar', '' ); } if( isset( $_POST[ 'page_bgcolor' ] ) ) { update_post_meta( $post_id, '_themetek_page_bgcolor', sanitize_text_field( $_POST[ 'page_bgcolor' ] ) ); } if( isset( $_POST[ 'page_top_padding' ] ) ) { update_post_meta( $post_id, '_themetek_page_top_padding', sanitize_text_field( $_POST[ 'page_top_padding' ] ) ); } if( isset( $_POST[ 'page_bottom_padding' ] ) ) { update_post_meta( $post_id, '_themetek_page_bottom_padding', sanitize_text_field( $_POST[ 'page_bottom_padding' ] ) ); } if( isset( $_POST[ 'page_showhide_title_section' ] ) ) { update_post_meta( $post_id, '_themetek_page_showhide_title_section', 'yes' ); } else { update_post_meta( $post_id, '_themetek_page_showhide_title_section', '' ); } if( isset( $_POST[ 'page_showhide_breadcrumbs' ] ) ) { update_post_meta( $post_id, '_themetek_page_showhide_breadcrumbs', 'yes' ); } else { update_post_meta( $post_id, '_themetek_page_showhide_breadcrumbs', '' ); } if( isset( $_POST[ 'page_subtitle' ] ) ) { update_post_meta( $post_id, '_themetek_page_subtitle', sanitize_text_field( $_POST[ 'page_subtitle' ] ) ); } if( isset( $_POST['page_title_align'] ) ) { update_post_meta( $post_id, 'page_title_align', esc_attr( $_POST['page_title_align'] ) ); } if( isset( $_POST[ 'page_title_color' ] ) ) { update_post_meta( $post_id, '_themetek_page_title_color', sanitize_text_field( $_POST[ 'page_title_color' ] ) ); } if( isset( $_POST[ 'page_titlebar_background' ] ) ) { update_post_meta( $post_id, '_themetek_page_titlebar_background', sanitize_text_field( $_POST[ 'page_titlebar_background' ] ) ); } } add_action( 'save_post', 'themetek_save_meta_box_data' ); ?>