ID, '_generate-disable-header', true ); $disable_nav = get_post_meta( $post->ID, '_generate-disable-nav', true ); $disable_secondary_nav = get_post_meta( $post->ID, '_generate-disable-secondary-nav', true ); $disable_post_image = get_post_meta( $post->ID, '_generate-disable-post-image', true ); $disable_headline = get_post_meta( $post->ID, '_generate-disable-headline', true ); $disable_footer = get_post_meta( $post->ID, '_generate-disable-footer', true ); } $return = ''; if ( ! empty( $disable_header ) && false !== $disable_header ) { $return = '.site-header {display:none}'; } if ( ! empty( $disable_nav ) && false !== $disable_nav ) { $return .= '#site-navigation,.navigation-clone, #mobile-header {display:none !important}'; } if ( ! empty( $disable_secondary_nav ) && false !== $disable_secondary_nav ) { $return .= '#secondary-navigation {display:none}'; } if ( ! empty( $disable_post_image ) && false !== $disable_post_image ) { $return .= '.generate-page-header, .page-header-image, .page-header-image-single {display:none}'; } $need_css_removal = true; if ( defined( 'GENERATE_VERSION' ) && version_compare( GENERATE_VERSION, '3.0.0-alpha.1', '>=' ) ) { $need_css_removal = false; } if ( $need_css_removal && ! empty( $disable_headline ) && false !== $disable_headline && ! is_single() ) { $return .= '.entry-header {display:none} .page-content, .entry-content, .entry-summary {margin-top:0}'; } if ( ! empty( $disable_footer ) && false !== $disable_footer ) { $return .= '.site-footer {display:none}'; } return $return; } } if ( ! function_exists( 'generate_de_scripts' ) ) { add_action( 'wp_enqueue_scripts', 'generate_de_scripts', 50 ); /** * Enqueue scripts and styles */ function generate_de_scripts() { wp_add_inline_style( 'generate-style', generate_disable_elements() ); } } if ( ! function_exists( 'generate_add_de_meta_box' ) ) { add_action( 'add_meta_boxes', 'generate_add_de_meta_box', 50 ); /** * Generate the layout metabox. * * @since 0.1 */ function generate_add_de_meta_box() { // Set user role - make filterable. $allowed = apply_filters( 'generate_metabox_capability', 'edit_theme_options' ); // If not an administrator, don't show the metabox. if ( ! current_user_can( $allowed ) ) { return; } if ( defined( 'GENERATE_LAYOUT_META_BOX' ) ) { return; } $args = array( 'public' => true ); $post_types = get_post_types( $args ); foreach ( $post_types as $type ) { if ( 'attachment' !== $type ) { add_meta_box( 'generate_de_meta_box', __( 'Disable Elements', 'gp-premium' ), 'generate_show_de_meta_box', $type, 'side', 'default' ); } } } } if ( ! function_exists( 'generate_show_de_meta_box' ) ) { /** * Outputs the content of the metabox. * * @param object $post The post object. */ function generate_show_de_meta_box( $post ) { wp_nonce_field( basename( __FILE__ ), 'generate_de_nonce' ); $stored_meta = get_post_meta( $post->ID ); $stored_meta['_generate-disable-header'][0] = ( isset( $stored_meta['_generate-disable-header'][0] ) ) ? $stored_meta['_generate-disable-header'][0] : ''; $stored_meta['_generate-disable-nav'][0] = ( isset( $stored_meta['_generate-disable-nav'][0] ) ) ? $stored_meta['_generate-disable-nav'][0] : ''; $stored_meta['_generate-disable-secondary-nav'][0] = ( isset( $stored_meta['_generate-disable-secondary-nav'][0] ) ) ? $stored_meta['_generate-disable-secondary-nav'][0] : ''; $stored_meta['_generate-disable-post-image'][0] = ( isset( $stored_meta['_generate-disable-post-image'][0] ) ) ? $stored_meta['_generate-disable-post-image'][0] : ''; $stored_meta['_generate-disable-headline'][0] = ( isset( $stored_meta['_generate-disable-headline'][0] ) ) ? $stored_meta['_generate-disable-headline'][0] : ''; $stored_meta['_generate-disable-footer'][0] = ( isset( $stored_meta['_generate-disable-footer'][0] ) ) ? $stored_meta['_generate-disable-footer'][0] : ''; $stored_meta['_generate-disable-top-bar'][0] = ( isset( $stored_meta['_generate-disable-top-bar'][0] ) ) ? $stored_meta['_generate-disable-top-bar'][0] : ''; ?>