芝麻web文件管理V1.00
编辑当前文件:/home/ephorei/www/wp-content/themes/astra/inc/builder/class-astra-builder-loader.php
'ast-advanced-hook-location', 'exclusion' => 'ast-advanced-hook-exclusion', 'users' => 'ast-advanced-hook-users', ); $result = Astra_Target_Rules_Fields::get_instance()->get_posts_by_conditions( ASTRA_ADVANCED_HOOKS_POST_TYPE, $option ); $header_counter = 0; $footer_counter = 0; $layout_404_counter = 0; foreach ( $result as $post_id => $post_data ) { $post_type = get_post_type(); // Get the display devices condition for the post. $display_devices = get_post_meta( $post_id, 'ast-advanced-display-device', true ); if ( ! is_array( $display_devices ) ) { $display_devices = array( 'desktop', 'tablet', 'mobile' ); } if ( ASTRA_ADVANCED_HOOKS_POST_TYPE !== $post_type ) { $layout = get_post_meta( $post_id, 'ast-advanced-hook-layout', false ); if ( isset( $layout[0] ) && '404-page' == $layout[0] && 0 == $layout_404_counter ) { $layout_404_settings = get_post_meta( $post_id, 'ast-404-page', true ); if ( isset( $layout_404_settings['disable_header'] ) && 'enabled' == $layout_404_settings['disable_header'] ) { remove_action( 'astra_header', array( Astra_Builder_Header::get_instance(), 'header_builder_markup' ) ); } if ( isset( $layout_404_settings['disable_footer'] ) && 'enabled' == $layout_404_settings['disable_footer'] ) { remove_action( 'astra_footer', array( Astra_Builder_Footer::get_instance(), 'footer_markup' ) ); } $layout_404_counter ++; } elseif ( isset( $layout[0] ) && 'header' == $layout[0] && 0 == $header_counter ) { // Remove default site's header. remove_action( 'astra_header', array( Astra_Builder_Header::get_instance(), 'header_builder_markup' ) ); // Check if the post has 'ast-advanced-hook-enabled' meta key is not set to 'no'. $is_enabled = 'no' !== get_post_meta( $post_id, 'ast-advanced-hook-enabled', true ); // Check if the custom header is enabled for all devices. $is_all_devices = 3 === count( $display_devices ); if ( $is_enabled && $is_all_devices ) { // Prevent Off-Canvas markup on custom header rendering. add_filter( 'astra_disable_mobile_popup_markup', '__return_true' ); } $header_counter++; } elseif ( isset( $layout[0] ) && 'footer' == $layout[0] && 0 == $footer_counter ) { // Remove default site's footer. remove_action( 'astra_footer', array( Astra_Builder_Footer::get_instance(), 'footer_markup' ) ); $footer_counter++; } } } } /** * Method to add rel="nofollow" for markup * * @param string $theme_location Theme location for key. * @param string $markup Markup. * @return string Menu markup with rel="nofollow". * @since 4.6.14 */ public function nofollow_markup( $theme_location, $markup ) { $nofollow_disabled = apply_filters( 'astra_disable_nofollow_markup', true ); if ( $nofollow_disabled ) { return $markup; } if ( isset( self::$menu_locations[ $theme_location ] ) ) { $markup = str_replace( 'href="', 'rel="nofollow" href="', $markup ); } else { self::$menu_locations[ $theme_location ] = true; } return $markup; } } /** * Prepare if class 'Astra_Builder_Loader' exist. * Kicking this off by calling 'get_instance()' method */ Astra_Builder_Loader::get_instance(); } if ( ! function_exists( 'astra_builder' ) ) { /** * Get global class. * * @return object */ function astra_builder() { return Astra_Builder_Loader::get_instance(); } }