frontend->get_builder_content_for_display( $post_id_header ); }else if ( nighty_is_elementor_active() && !isset( $header_split[1] ) ) { return get_template_part( 'template-parts/header', $header_split[0] ); }else if ( !nighty_is_elementor_active() ) { return get_template_part( 'template-parts/header', 'default' ); } } public function nighty_render_footer(){ $current_id = nighty_get_current_id(); // Get Footer default from customizer $global_footer = get_theme_mod('global_footer', 'default' ); // Footer in Metabox of Post, Page $meta_footer = get_post_meta( $current_id, 'ova_met_footer_version', 'true' ); if( $current_id != '' && $meta_footer != 'global' && $meta_footer != '' ){ $footer = $meta_footer; }else if( nighty_is_blog_archive() ){ $footer = get_theme_mod('blog_footer', 'default'); }else if( is_singular('post') ){ $footer = get_theme_mod('single_footer', 'default'); }else if( is_singular('product') ){ $footer = get_theme_mod('woo_single_footer', 'default'); }else{ $footer = $global_footer; } $footer_split = explode(',', apply_filters( 'nighty_footer_customize', $footer, $footer )); if ( nighty_is_elementor_active() && isset( $footer_split[1] ) ) { $post_id_footer = nighty_get_id_by_slug( $footer_split[1] ); // Check WPML if( function_exists( 'icl_object_id' ) ){ $post_id_footer = icl_object_id($post_id_footer, 'ova_framework_hf_el', false); if ( ! $post_id_footer ) { $post_id_footer = nighty_get_id_by_slug( $footer_split[1] ); } } return Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $post_id_footer ); }else if ( nighty_is_elementor_active() && !isset( $footer_split[1] ) ) { get_template_part( 'template-parts/footer', $footer_split[0] ); }else if( !nighty_is_elementor_active() ){ get_template_part( 'template-parts/footer', 'default' ); } } function nighty_list_header() { $hf_header_array['default'] = esc_html__( 'Default', 'nighty' ); if ( ! nighty_is_elementor_active() ) return $hf_header_array; $args_hf = array( 'post_type' => 'ova_framework_hf_el', 'post_status' => 'publish', 'posts_per_page' => '-1', 'meta_query' => array( array( 'key' => 'hf_options', 'value' => 'header', 'compare' => '=', ), ) ); $hf = get_posts( $args_hf ); foreach ( $hf as $post ) { setup_postdata( $post ); $hf_header_array[ 'ova,'.$post->post_name ] = get_the_title( $post->ID ); } wp_reset_postdata(); return $hf_header_array; } function nighty_list_footer() { $hf_footer_array['default'] = esc_html__( 'Default', 'nighty' ); if ( ! nighty_is_elementor_active() ) return $hf_footer_array; $args_hf = array( 'post_type' => 'ova_framework_hf_el', 'post_status' => 'publish', 'posts_per_page' => '-1', 'meta_query' => array( array( 'key' => 'hf_options', 'value' => 'footer', 'compare' => '=', ), ) ); $hf = get_posts( $args_hf ); foreach ( $hf as $post ) { setup_postdata( $post ); $hf_footer_array[ 'ova,'.$post->post_name ] = get_the_title( $post->ID ); } wp_reset_postdata(); return $hf_footer_array; } function nighty_define_layout(){ return array( 'layout_1c' => esc_html__('No Sidebar', 'nighty'), 'layout_2r' => esc_html__('Right Sidebar', 'nighty'), 'layout_2l' => esc_html__('Left Sidebar', 'nighty'), ); } function nighty_get_layout(){ $layout = ''; $width_sidebar = get_theme_mod( 'global_sidebar_width', '320' ); if( is_singular( 'post' ) ){ $layout = get_theme_mod( 'single_layout', 'layout_2r' ); }else if( nighty_is_blog_archive() ){ $layout = get_theme_mod( 'blog_layout', 'layout_2r' ); }else if( nighty_is_woo_active() && is_product() ){ $layout = get_theme_mod( 'woo_product_layout', 'woo_layout_1c' ); $width_sidebar = get_theme_mod( 'woo_sidebar_width', '320' ); } else if( nighty_is_woo_active() && ( is_product_category() || is_product_tag() || is_shop() ) ){ $layout = get_theme_mod( 'woo_archive_layout', 'woo_layout_1c' ); $width_sidebar = get_theme_mod( 'woo_sidebar_width', '320' ); } $current_id = nighty_get_current_id(); if( $current_id ){ $layout_in_post = get_post_meta( $current_id, 'ova_met_main_layout', true ); if( $layout_in_post != 'global' && $layout_in_post != '' ){ $layout = $layout_in_post; } } // Check if page is posts (settings >> reading >> posts page) if( get_option( 'page_for_posts' ) == $current_id ){ $layout_in_post = get_post_meta( $current_id, 'ova_met_main_layout', true ); if( $layout_in_post == 'global' ){ $layout = get_theme_mod( 'blog_layout', 'layout_2r' ); } } if( isset( $_GET['layout_sidebar'] ) ){ $layout = $_GET['layout_sidebar']; } if( !$layout ){ $layout = get_theme_mod( 'global_layout', 'layout_2r' ); $width_sidebar = get_theme_mod( 'global_sidebar_width', '320' ); } // Check if Woo Sidebar is inactive if( nighty_is_woo_active() && ( is_product_category() || is_product_tag() || is_shop() ) ){ if( !is_active_sidebar('woo-sidebar') ){ $layout = 'woo_layout_1c'; $width_sidebar = 0; } }else if( nighty_is_woo_active() && is_product() ){ if( !is_active_sidebar('woo-sidebar') ){ $layout = 'woo_layout_1c'; $width_sidebar = 0; } }else if( !is_active_sidebar('main-sidebar') ){ $layout = 'layout_1c'; $width_sidebar = 0; } return array( $layout, $width_sidebar ); } function nighty_wide_site(){ $current_id = nighty_get_current_id(); $width_site = get_post_meta( $current_id, 'ova_met_wide_site', true ); if( $current_id && $width_site != 'global' ){ $width = $width_site; }else{ $width = get_theme_mod( 'global_wide_site', 'wide' ); } return $width; } function nighty_theme_sidebar(){ $layout_sidebar = apply_filters( 'nighty_get_layout', '' ); return $layout_sidebar[0]; } function nighty_define_wide_boxed(){ return array( 'wide' => esc_html__('Wide', 'nighty'), 'boxed' => esc_html__('Boxed', 'nighty'), ); } function nighty_blog_template(){ $blog_template = get_theme_mod( 'blog_template', 'default' ); if( isset( $_GET['blog_template'] ) ){ $blog_template = $_GET['blog_template']; } return $blog_template; } function nighty_comment_form_defaults( $defaults ){ $defaults['comment_field'] = sprintf( '

%s

', '' ); return $defaults; } function nighty_comment_form_default_fields( $fields ){ $commenter = wp_get_current_commenter(); $req = get_option( 'require_name_email' ); $html_req = ( $req ? " required='required'" : '' ); $html5 = true; $fields['author'] = sprintf( '

%s

', sprintf( '', esc_attr( $commenter['comment_author'] ), $html_req ) ); $fields['email'] = sprintf( '

%s

', sprintf( '', ( $html5 ? 'type="email"' : 'type="text"' ), esc_attr( $commenter['comment_author_email'] ), $html_req ) ); $fields['url'] = sprintf( '

%s

', sprintf( '', ( $html5 ? 'type="url"' : 'type="text"' ), esc_attr( $commenter['comment_author_url'] ) ) ); return $fields; } function nighty_theme_background() { $class = ''; $current_id = nighty_get_current_id(); $primary_background = get_post_meta( $current_id, 'ova_met_primary_background', true ); if ( ! $primary_background ) $primary_background = 'global'; if ( $primary_background === 'global' ) $class = 'ova_primary_background'; return $class; } } } new Nighty_Hooks();