AlkantarClanX12
Current Path : /home/thanudqk/siamfreetour.com/wp-content/themes/photofocus-light/ |
Current File : //home/thanudqk/siamfreetour.com/wp-content/themes/photofocus-light/functions.php |
<?php /* * This is the child theme for PhotoFocus Light theme. * * (Please see https://developer.wordpress.org/themes/advanced-topics/child-themes/#how-to-create-a-child-theme) */ function photofocus_light_enqueue_styles() { // Include parent theme CSS. wp_enqueue_style( 'photofocus-style', get_template_directory_uri() . '/style.css', null, date( 'Ymd-Gis', filemtime( get_template_directory() . '/style.css' ) ) ); // Include child theme CSS. wp_enqueue_style( 'photofocus-light-style', get_stylesheet_directory_uri() . '/style.css', array( 'photofocus-style' ), date( 'Ymd-Gis', filemtime( get_stylesheet_directory() . '/style.css' ) ) ); // Load the rtl. if ( is_rtl() ) { wp_enqueue_style( 'photofocus-rtl', get_template_directory_uri() . '/rtl.css', array( 'photofocus-style' ), $version ); } // Enqueue child block styles after parent block style. wp_enqueue_style( 'photofocus-light-block-style', get_stylesheet_directory_uri() . '/assets/css/child-blocks.css', array( 'photofocus-block-style' ), date( 'Ymd-Gis', filemtime( get_stylesheet_directory() . '/assets/css/child-blocks.css' ) ) ); } add_action( 'wp_enqueue_scripts', 'photofocus_light_enqueue_styles' ); /** * Add child theme editor styles */ function photofocus_light_editor_style() { add_editor_style( array( 'assets/css/child-editor-style.css', photofocus_fonts_url(), get_theme_file_uri( 'assets/css/font-awesome/css/font-awesome.css' ), ) ); } add_action( 'after_setup_theme', 'photofocus_light_editor_style', 11 ); /** * Enqueue editor styles for Gutenberg */ function photofocus_light_block_editor_styles() { // Enqueue child block editor style after parent editor block css. wp_enqueue_style( 'photofocus-light-block-editor-style', get_stylesheet_directory_uri() . '/assets/css/child-editor-blocks.css', array( 'photofocus-block-editor-style' ), date( 'Ymd-Gis', filemtime( get_stylesheet_directory() . '/assets/css/child-editor-blocks.css' ) ) ); } add_action( 'enqueue_block_editor_assets', 'photofocus_light_block_editor_styles', 11 ); /** * Adds custom classes to the array of body classes. * * @param array $classes Classes for the body element. * @return array */ function photofocus_light_body_classes( $classes ) { // Added color scheme to body class. $classes['color-scheme'] = 'color-scheme-light'; return $classes; } add_filter( 'body_class', 'photofocus_light_body_classes', 100 ); /** * Change default header text color */ function photofocus_light_header_default_color( $args ) { $args['default-image'] = get_theme_file_uri( 'assets/images/header-image.jpg' ); return $args; } add_filter( 'photofocus_custom_header_args', 'photofocus_light_header_default_color' ); /** * Override parent theme to add promotion headline section. */ function photofocus_sections( $selector = 'header' ) { get_template_part( 'template-parts/header/header', 'media' ); get_template_part( 'template-parts/slider/display', 'slider' ); get_template_part( 'template-parts/services/display', 'services' ); get_template_part( 'template-parts/hero-content/content','hero' ); get_template_part( 'template-parts/featured-content/display', 'featured' ); get_template_part( 'template-parts/promotion-headline/post-type-promotion' ); get_template_part( 'template-parts/portfolio/display', 'portfolio' ); get_template_part( 'template-parts/testimonial/display', 'testimonial' ); } /** * Default customizer file */ require trailingslashit( get_stylesheet_directory() ) . 'inc/customizer/customizer.php'; /** * Load Customizer Options */ require trailingslashit( get_stylesheet_directory() ) . 'inc/customizer/promotion-headline.php'; /** * Override Parent theme function */ function photofocus_header_media_text() { if ( ! photofocus_has_header_media_text() ) { // Bail early if header media text is disabled on front page return false; } $content_alignment = get_theme_mod( 'photofocus_header_media_content_alignment', 'content-align-right' ); $text_alignment = get_theme_mod( 'photofocus_header_media_text_alignment', 'text-align-center' ); $header_media_logo = get_theme_mod( 'photofocus_header_media_logo' ); $classes = array(); if( is_front_page() ) { $classes[] = $content_alignment; $classes[] = $text_alignment; } ?> <div class="custom-header-content sections header-media-section <?php echo esc_attr( implode( ' ', $classes ) ); ?>"> <div class="custom-header-content-wrapper"> <?php $header_media_subtitle = get_theme_mod( 'photofocus_header_media_sub_title' ); $enable_homepage_logo = get_theme_mod( 'photofocus_header_media_logo_option', 'homepage' ); if( is_front_page() ) : ?> <div class="section-subtitle"> <?php echo esc_html( $header_media_subtitle ); ?> </div> <?php endif; if ( photofocus_check_section( $enable_homepage_logo ) && $header_media_logo ) { ?> <div class="site-header-logo"> <img src="<?php echo esc_url( $header_media_logo ); ?>" title="<?php echo esc_url( home_url( '/' ) ); ?>" /> </div><!-- .site-header-logo --> <?php } ?> <?php $tag = 'h2'; if ( is_singular() || is_404() ) { $tag = 'h1'; } photofocus_header_title( '<div class="section-title-wrapper"><' . $tag . ' class="section-title entry-title">', '</' . $tag . '></div>' ); ?> <?php photofocus_header_description( '<div class="site-header-text">', '</div>' ); ?> <?php if ( is_front_page() ) : $header_media_url = get_theme_mod( 'photofocus_header_media_url', '#' ); $header_media_url_text = get_theme_mod( 'photofocus_header_media_url_text' ); ?> <?php if ( $header_media_url_text ) : ?> <span class="more-link"> <a href="<?php echo esc_url( $header_media_url ); ?>" target="<?php echo esc_attr( get_theme_mod( 'photofocus_header_url_target' ) ? '_blank' : '_self' ); ?>" class="readmore"><?php echo esc_html( $header_media_url_text ); ?><span class="screen-reader-text"><?php echo wp_kses_post( $header_media_url_text ); ?></span></a> </span> <?php endif; ?> <?php endif; ?> </div><!-- .custom-header-content-wrapper --> </div><!-- .custom-header-content --> <?php } // photofocus_header_media_text. /** * Override Parent function */ function photofocus_light_override_parent_custom_bg_color( $args ) { $args['default-color'] = '#ffffff'; return $args; } add_filter( 'photofocus_custom_background_args', 'photofocus_light_override_parent_custom_bg_color' ); /** * Override Parent function */ function photofocus_light_override_parent_custom_header_color( $args ) { $args['default-text-color'] = '#000000'; return $args; } add_filter( 'photofocus_custom_header_args', 'photofocus_light_override_parent_custom_header_color' );