PATH:
home
/
centosnipponia
/
public_html
/
lifannl
/
wp-content
/
themes
/
sydney-pro-ii
/
inc
/
modules
/
page-headers
<?php /** * Functions for the extended blog module * * @package Sydney */ if ( !Sydney_Modules::is_module_active( 'page-headers' ) ) { return; } /** * Enqueue blog related styles */ function sydney_enqueue_page_headers_styles() { wp_enqueue_style( 'sydney-page-headers-styles', get_template_directory_uri() . '/css/modules/page-headers.min.css' ); } add_action( 'wp_enqueue_scripts', 'sydney_enqueue_page_headers_styles', 9 ); /** * Enqueue page header scripts */ function sydney_enqueue_page_headers_scripts() { $post_header_parallax = get_theme_mod( 'post_header_parallax', 'disabled' ); if ( 'disabled' != $post_header_parallax ) { wp_enqueue_script( 'sydney-page-headers-scripts', get_template_directory_uri() . '/js/modules/page-header-parallax.min.js', '', '', true ); } } add_action( 'wp_enqueue_scripts', 'sydney_enqueue_page_headers_scripts' ); /** * Remove archive labels */ if ( ! function_exists( 'sydney_remove_archive_labels' ) ) : function sydney_remove_archive_labels( $title ) { $disable = get_theme_mod( 'disable_archive_labels', 0 ); if ( !$disable ) { return $title; } if ( is_category() ) { $title = single_cat_title( '', false ); } elseif ( is_tag() ) { $title = single_tag_title( '', false ); } elseif ( is_author() ) { $title = '<span class="vcard">' . get_the_author() . '</span>'; } elseif ( is_year() ) { $title = get_the_date( _x( 'Y', 'yearly archives date format' ) ); } elseif ( is_month() ) { $title = get_the_date( _x( 'F Y', 'monthly archives date format' ) ); } elseif ( is_day() ) { $title = get_the_date( _x( 'F j, Y', 'daily archives date format' ) ); } elseif ( is_post_type_archive() ) { $title = post_type_archive_title( '', false ); } elseif ( is_tax() ) { $title = single_term_title( '', false ); } return $title; } add_filter( 'get_the_archive_title', 'sydney_remove_archive_labels' ); endif; /** * Category form fields */ require get_template_directory() . "/inc/modules/page-headers/class_sydney_archive_form_fields.php"; /** * Load Custom post type settings */ function sydney_load_cpt_page_header_settings( $wp_customize ) { //Load settings for custom post types. Regular post settings are loaded from the core option files require get_template_directory() . "/inc/modules/page-headers/settings/settings-custom-posts.php"; require get_template_directory() . "/inc/modules/page-headers/settings/settings-custom-posts-archives.php"; } add_action( 'customize_register', 'sydney_load_cpt_page_header_settings' ); /** * Archive headers */ if ( !function_exists( 'sydney_archive_headers' ) ) : function sydney_archive_headers() { $archive_title_layout = get_theme_mod( 'archive_title_layout', 'layout1' ); if ( ( !is_category() && !is_tag() && !is_author() ) || 'layout1' === $archive_title_layout ) { return; } $container = get_theme_mod( 'archive_title_container', 'container' ); $parallax = get_theme_mod( 'archive_header_parallax', 'disabled' ); $valign = get_theme_mod( 'archive_header_vert_alignment', 'middle' ); $image_id = ''; if ( is_category() ) { $cat_id = get_queried_object_id(); $image_id = get_term_meta( $cat_id, 'sydney-cat-img-id', true ); } ?> <div class="page-banner archive-header header-parallax-<?php echo esc_attr( $parallax ); ?>"> <div class="<?php echo esc_attr( $container ); ?>"> <div class="page-banner-inner cat-banner-inner valign-<?php echo esc_attr( $valign ); ?>"> <?php if ( $image_id ) : ?> <?php echo wp_get_attachment_image( $image_id, 'full' ); ?> <div class="page-banner-overlay"></div> <?php endif; ?> <header class="page-header"> <div class="container"> <?php do_action( 'sydney_before_title' ); the_archive_title( '<h1 class="archive-title">', '</h1>' ); the_archive_description( '<div class="taxonomy-description">', '</div>' ); ?> </div> </header><!-- .page-header --> </div> </div> </div> <?php } add_action( 'sydney_before_main_container_start', 'sydney_archive_headers' ); endif; /** * Display page header custom content */ function sydney_page_header_custom_content( $type = 'post' ) { $enable = get_theme_mod( $type . '_header_custom_content_toggle', 0 ); if ( !$enable ) { return; } $content = get_theme_mod( $type . '_header_custom_content' ); echo '<div class="row page-header-custom-content"><div class="container">' . do_shortcode( $content ) . '</div></div>'; } /** * Dynamic styles for this module */ function sydney_page_headers_dynamic_styles( $custom ) { $post_type = get_post_type(); if ( is_singular() ) { $custom .= Sydney_Custom_CSS::get_background_color_css( $post_type . '_header_background', '', '.page-banner-inner .page-banner-overlay' ); $custom .= Sydney_Custom_CSS::get_min_height_css( $post_type . '_header_size', $defaults = array( 'desktop' => 600, 'tablet' => 300, 'mobile' => 200 ), '.page-banner-inner:not(.cat-banner-inner)' ); } else { if ( 'post' != $post_type ) { $custom .= Sydney_Custom_CSS::get_min_height_css( $post_type . '_archive_header_size', $defaults = array( 'desktop' => 400, 'tablet' => 300, 'mobile' => 200 ), '.page-banner-inner.cat-banner-inner' ); } } if ( 'post' === $post_type ) { $custom .= Sydney_Custom_CSS::get_background_color_css( 'archive_header_background', '', '.archive-header .page-banner-inner .page-banner-overlay' ); } else { $custom .= Sydney_Custom_CSS::get_background_color_css( $post_type . '_archive_header_background', '', '.archive-header .page-banner-inner .page-banner-overlay' ); $archive_header_alignment = get_theme_mod( $post_type . '_archive_header_alignment', 'left' ); $custom .= ".page-banner-inner.cat-banner-inner { text-align:" . esc_attr( $archive_header_alignment ) . ";}" . "\n"; } return $custom; } add_filter( 'sydney_custom_css', 'sydney_page_headers_dynamic_styles' ); /* * Header for all single post types */ function sydney_single_post_type_header( $post_type ) { if ( !is_singular( $post_type ) ) { //only for single posts return; } global $post; $layout = get_theme_mod( $post_type . '_header_layout', 'layout1' ); $disable_title = get_post_meta( $post->ID, '_sydney_page_disable_title', true ); if ( 'layout1' === $layout || $disable_title ) { //default layout return; } $single_post_meta_position = get_theme_mod( 'single_post_meta_position', 'below-title' ); //for posts only $container = get_theme_mod( $post_type . '_header_container', 'container' ); $parallax = get_theme_mod( $post_type . '_header_parallax', 'disabled' ); $valign = get_theme_mod( $post_type . '_header_vert_alignment', 'middle' ); $post_header_cc_placement = get_theme_mod( $post_type . '_header_cc_placement', 'below' ); ?> <div class="page-banner header-parallax-<?php echo esc_attr( $parallax ); ?>"> <div class="<?php echo esc_attr( $container ); ?>"> <div class="page-banner-inner valign-<?php echo esc_attr( $valign ); ?>"> <?php if ( has_post_thumbnail() ) : ?> <?php the_post_thumbnail( 'full', array( 'alt' => the_title_attribute( array( 'echo' => false, ) ), ) ); ?> <?php endif; ?> <?php if ( 'layout3' === $layout ) : ?> <div class="page-banner-overlay"></div> <header class="entry-header"> <?php if ( 'above' === $post_header_cc_placement ) : ?> <?php sydney_page_header_custom_content( $post_type ); ?> <?php endif; ?> <div class="row"> <div class="container"> <?php do_action( 'sydney_before_title' ); ?> <?php if ( 'post' === get_post_type() && 'above-title' === $single_post_meta_position ) : ?> <?php sydney_single_post_meta( 'entry-meta-above' ); ?> <?php endif; ?> <?php the_title( '<h1 class="title-post entry-title" ' . sydney_get_schema( "headline" ) . '>', '</h1>' ); ?> <?php if ( 'post' === get_post_type() && 'below-title' === $single_post_meta_position ) : ?> <?php sydney_single_post_meta( 'entry-meta-below' ); ?> <?php endif; ?> </div> </div> <?php if ( 'below' === $post_header_cc_placement ) : ?> <?php sydney_page_header_custom_content( $post_type ); ?> <?php endif; ?> </header><!-- .entry-header --> <?php endif; ?> </div> </div> </div> <?php } /** * Output the single header */ function sydney_render_single_header() { if ( !is_singular() ) { return; } $post_type = get_post_type(); //Remove unwanted post types $unset_types = array( 'product', 'attachment', 'e-landing-page', 'elementor_library', 'athemes_hf', ); if ( in_array( get_post_type(), $unset_types ) ) { return; } add_action( 'sydney_before_main_container_start', function() use ( $post_type ) { sydney_single_post_type_header( $post_type ); } ); } add_action( 'wp', 'sydney_render_single_header' ); /* * Header for custom post type archives */ function sydney_cpt_archive_headers( $post_type ) { $archive_title_layout = get_theme_mod( $post_type . '_archive_title_layout', 'layout1' ); if ( 'layout1' === $archive_title_layout ) { return; } $container = get_theme_mod( $post_type . '_archive_title_container', 'container' ); $parallax = get_theme_mod( $post_type . '_archive_header_parallax', 'disabled' ); $valign = get_theme_mod( $post_type . '_archive_header_vert_alignment', 'middle' ); $cat_id = get_queried_object_id(); $image_id = get_term_meta( $cat_id, 'sydney-cat-img-id', true ); ?> <div class="page-banner archive-header header-parallax-<?php echo esc_attr( $parallax ); ?>"> <div class="<?php echo esc_attr( $container ); ?>"> <div class="page-banner-inner cat-banner-inner valign-<?php echo esc_attr( $valign ); ?>"> <?php if ( $image_id ) : ?> <?php echo wp_get_attachment_image( $image_id, 'full' ); ?> <div class="page-banner-overlay"></div> <?php endif; ?> <header class="page-header"> <div class="container"> <?php do_action( 'sydney_before_title' ); the_archive_title( '<h1 class="archive-title">', '</h1>' ); the_archive_description( '<div class="taxonomy-description">', '</div>' ); ?> </div> </header><!-- .page-header --> </div> </div> </div> <?php } /** * Output the custom post archive header */ function sydney_render_cpt_archive_headers() { if ( !is_tax() ) { return; } $current_type = get_post_type(); $post_type = get_taxonomy( get_queried_object()->taxonomy )->object_type[0]; if ( $current_type !== $post_type ) { return; } //Remove unwanted post types $unset_types = array( 'product', 'attachment', 'e-landing-page', 'elementor_library', 'athemes_hf', ); if ( in_array( get_post_type(), $unset_types ) ) { return; } add_action( 'sydney_before_main_container_start', function() use ( $post_type ) { sydney_cpt_archive_headers( $post_type ); } ); //Disable default archive title add_filter( 'sydney_display_archive_title', '__return_false' ); } add_action( 'wp', 'sydney_render_cpt_archive_headers' );
[+]
..
[+]
settings
[-] class_sydney_archive_form_fields.php
[edit]
[-] page-headers.php
[edit]
[-] .htaccess.disabled
[edit]