From 19bad6faacaf38d31a8d483bb842102408ff7f30 Mon Sep 17 00:00:00 2001 From: themeegg Date: Wed, 4 Jul 2018 09:04:42 +0545 Subject: [PATCH] title style added --- inc/admin/assets/eggnews-sanitize.php | 10 + inc/admin/assets/panels/design-panel.php | 28 + inc/eggnews-functions.php | 1136 +++++++++++----------- inc/extras.php | 10 + languages/eggnews.pot | 64 +- readme.txt | 4 +- style.css | 2 +- 7 files changed, 679 insertions(+), 575 deletions(-) diff --git a/inc/admin/assets/eggnews-sanitize.php b/inc/admin/assets/eggnews-sanitize.php index af424fb..25f099b 100644 --- a/inc/admin/assets/eggnews-sanitize.php +++ b/inc/admin/assets/eggnews-sanitize.php @@ -165,3 +165,13 @@ function eggnews_website_skin_sanitize( $input ) { function eggnews_links_sanitize() { return false; } + +// site title design +function eggnews_sanitize_title_design( $input ) { + $valid_keys = eggnews_site_title_design(); + if ( array_key_exists( $input, $valid_keys ) ) { + return $input; + } else { + return ''; + } +} \ No newline at end of file diff --git a/inc/admin/assets/panels/design-panel.php b/inc/admin/assets/panels/design-panel.php index 0fee84b..7b36ac4 100644 --- a/inc/admin/assets/panels/design-panel.php +++ b/inc/admin/assets/panels/design-panel.php @@ -357,6 +357,34 @@ function eggnews_design_settings_register( $wp_customize ) { ), ) ); + /* --------------------------------------------------------------------------------------------------------------- */ + /** + * Title Style + */ + $wp_customize->add_section( + 'eggnews_site_title_design', array( + 'title' => __( 'Title Style', 'eggnews' ), + 'description' => __( 'Design option of title style', 'eggnews'), + 'priority' => 26, + 'panel' => 'eggnews_design_settings_panel', + ) + ); + + $wp_customize->add_setting( + 'site_title_design_options', array( + 'default' => 'default', + 'sanitize_callback' => 'eggnews_sanitize_title_design', + ) + ); + $wp_customize->add_control( + 'site_title_design_options', array( + 'type' => 'radio', + 'priority' => 10, + 'label' => __( 'Title design styles', 'eggnews' ), + 'section' => 'eggnews_site_title_design', + 'choices' => eggnews_site_title_design(), + ) + ); } diff --git a/inc/eggnews-functions.php b/inc/eggnews-functions.php index bebfb46..baad4bf 100644 --- a/inc/eggnews-functions.php +++ b/inc/eggnews-functions.php @@ -10,143 +10,147 @@ /** * Enqueue Scripts and styles for admin */ -function eggnews_admin_scripts_style( $hook ) { +function eggnews_admin_scripts_style($hook) +{ - global $eggnews_version; + global $eggnews_version; - if ( 'widgets.php' != $hook && 'customize.php' != $hook ) { - return; - } + if ('widgets.php' != $hook && 'customize.php' != $hook) { + return; + } - if ( function_exists( 'wp_enqueue_media' ) ) { - wp_enqueue_media(); - } + if (function_exists('wp_enqueue_media')) { + wp_enqueue_media(); + } - wp_register_script( 'eggnews-media-uploader', get_template_directory_uri() . '/inc/admin/js/media-uploader.js', array( 'jquery' ), 1.70 ); - wp_enqueue_script( 'eggnews-media-uploader' ); - wp_localize_script( 'eggnews-media-uploader', 'eggnews_l10n', array( - 'upload' => esc_html__( 'Upload', 'eggnews' ), - 'remove' => esc_html__( 'Remove', 'eggnews' ) - ) ); + wp_register_script('eggnews-media-uploader', get_template_directory_uri() . '/inc/admin/js/media-uploader.js', array('jquery'), 1.70); + wp_enqueue_script('eggnews-media-uploader'); + wp_localize_script('eggnews-media-uploader', 'eggnews_l10n', array( + 'upload' => esc_html__('Upload', 'eggnews'), + 'remove' => esc_html__('Remove', 'eggnews') + )); - wp_enqueue_script( 'eggnews-admin-script', get_template_directory_uri() . '/inc/admin/js/admin-script.js', array( 'jquery' ), esc_attr( $eggnews_version ), true ); + wp_enqueue_script('eggnews-admin-script', get_template_directory_uri() . '/inc/admin/js/admin-script.js', array('jquery'), esc_attr($eggnews_version), true); - wp_enqueue_style( 'eggnews-admin-style', get_template_directory_uri() . '/inc/admin/css/admin-style.css', array(), esc_attr( $eggnews_version ) ); + wp_enqueue_style('eggnews-admin-style', get_template_directory_uri() . '/inc/admin/css/admin-style.css', array(), esc_attr($eggnews_version)); } -add_action( 'admin_enqueue_scripts', 'eggnews_admin_scripts_style' ); +add_action('admin_enqueue_scripts', 'eggnews_admin_scripts_style'); /** * Enqueue scripts and styles. */ -function eggnews_scripts() { +function eggnews_scripts() +{ - global $eggnews_version; + global $eggnews_version; - $query_args = array( - 'family' => 'Poppins', - ); + $query_args = array( + 'family' => 'Poppins', + ); - wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/assets/lib/font-awesome/css/font-awesome.min.css', array(), '4.7.0' ); + wp_enqueue_style('font-awesome', get_template_directory_uri() . '/assets/lib/font-awesome/css/font-awesome.min.css', array(), '4.7.0'); - wp_enqueue_style( 'eggnews-google-font', add_query_arg( $query_args, "https://fonts.googleapis.com/css" ) ); + wp_enqueue_style('eggnews-google-font', add_query_arg($query_args, "https://fonts.googleapis.com/css")); - wp_enqueue_style( 'eggnews-style-1', get_template_directory_uri() . '/assets/css/eggnews.css', array(), esc_attr( $eggnews_version ) ); + wp_enqueue_style('eggnews-style-1', get_template_directory_uri() . '/assets/css/eggnews.css', array(), esc_attr($eggnews_version)); - wp_enqueue_style( 'eggnews-style', get_stylesheet_uri(), array(), esc_attr( $eggnews_version ) ); + wp_enqueue_style('eggnews-style', get_stylesheet_uri(), array(), esc_attr($eggnews_version)); - wp_enqueue_style( 'eggnews-responsive', get_template_directory_uri() . '/assets/css/eggnews-responsive.css', array(), esc_attr( $eggnews_version ) ); + wp_enqueue_style('eggnews-responsive', get_template_directory_uri() . '/assets/css/eggnews-responsive.css', array(), esc_attr($eggnews_version)); - wp_enqueue_script( 'jquery-bxslider', get_template_directory_uri() . '/assets/lib/bxslider/jquery.bxslider.min.js', array( 'jquery' ), '4.2.12', true ); + wp_enqueue_script('jquery-bxslider', get_template_directory_uri() . '/assets/lib/bxslider/jquery.bxslider.min.js', array('jquery'), '4.2.12', true); - // Start : Owl Carousel + // Start : Owl Carousel - wp_register_style( 'owl-carousel2-style', get_template_directory_uri() . '/assets/lib/owl/assets/owl.carousel.css', array(), esc_attr( $eggnews_version ) ); + wp_register_style('owl-carousel2-style', get_template_directory_uri() . '/assets/lib/owl/assets/owl.carousel.css', array(), esc_attr($eggnews_version)); - wp_register_style( 'owl-carousel2-theme', get_template_directory_uri() . '/assets/lib/owl/assets/owl.theme.default.css', array(), esc_attr( $eggnews_version ) ); + wp_register_style('owl-carousel2-theme', get_template_directory_uri() . '/assets/lib/owl/assets/owl.theme.default.css', array(), esc_attr($eggnews_version)); - wp_register_script( 'owl-carousel2-script', get_template_directory_uri() . '/assets/lib/owl/owl.carousel.min.js', array( 'jquery' ), esc_attr( $eggnews_version ), true ); + wp_register_script('owl-carousel2-script', get_template_directory_uri() . '/assets/lib/owl/owl.carousel.min.js', array('jquery'), esc_attr($eggnews_version), true); - //End : Owl Carousel + //End : Owl Carousel - $menu_sticky_option = get_theme_mod( 'eggnews_sticky_option', 'enable' ); - if ( $menu_sticky_option != 'disable' ) { - wp_enqueue_script( 'jquery-sticky', get_template_directory_uri() . '/assets/lib/sticky/jquery.sticky.js', array( 'jquery' ), '20150416', true ); + $menu_sticky_option = get_theme_mod('eggnews_sticky_option', 'enable'); + if ($menu_sticky_option != 'disable') { + wp_enqueue_script('jquery-sticky', get_template_directory_uri() . '/assets/lib/sticky/jquery.sticky.js', array('jquery'), '20150416', true); - wp_enqueue_script( 'eggnews-sticky-menu-setting', get_template_directory_uri() . '/assets/lib/sticky/sticky-setting.js', array( 'jquery-sticky' ), '20150309', true ); - } + wp_enqueue_script('eggnews-sticky-menu-setting', get_template_directory_uri() . '/assets/lib/sticky/sticky-setting.js', array('jquery-sticky'), '20150309', true); + } - wp_enqueue_script( 'eggnews-custom-script', get_template_directory_uri() . '/assets/js/custom-script.js', array( 'jquery-bxslider' ), esc_attr( $eggnews_version ), true ); + wp_enqueue_script('eggnews-custom-script', get_template_directory_uri() . '/assets/js/custom-script.js', array('jquery-bxslider'), esc_attr($eggnews_version), true); - if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { - wp_enqueue_script( 'comment-reply' ); - } + if (is_singular() && comments_open() && get_option('thread_comments')) { + wp_enqueue_script('comment-reply'); + } } -add_action( 'wp_enqueue_scripts', 'eggnews_scripts' ); +add_action('wp_enqueue_scripts', 'eggnews_scripts'); /*------------------------------------------------------------------------------------------------*/ /** * Current date at top header */ -add_action( 'eggnews_current_date', 'eggnews_current_date_hook' ); -if ( ! function_exists( 'eggnews_current_date_hook' ) ): - function eggnews_current_date_hook() { - $date_option = get_theme_mod( 'eggnews_header_date', 'enable' ); - if ( $date_option != 'disable' ) { - ?> -
- -
- +
+ +
+ -
-
- -
- have_posts() ) { - echo '
    '; - while ( $ticker_query->have_posts() ) { - $ticker_query->the_post(); - ?> -
  • -
    -
    -
  • - '; - } - ?> -
-
-
-
- +
+
+ +
+ have_posts()) { + echo '
    '; + while ($ticker_query->have_posts()) { + $ticker_query->the_post(); + ?> +
  • +
    +
    +
  • + '; + } + ?> +
+
+
+
+ 0 ) ); - foreach ( $eggnews_categories as $eggnews_category ) { - $eggnews_category_array[ $eggnews_category->term_id ] = $eggnews_category->cat_name; - } - - return $eggnews_category_array; - } +if (!function_exists('eggnews_category_array')) : + function eggnews_category_array() + { + $eggnews_categories = get_categories(array('hide_empty' => 0)); + foreach ($eggnews_categories as $eggnews_category) { + $eggnews_category_array[$eggnews_category->term_id] = $eggnews_category->cat_name; + } + + return $eggnews_category_array; + } endif; /** @@ -171,546 +176,575 @@ function eggnews_category_array() { * * @since 1.2.3 */ -if ( ! function_exists( 'eggnews_category_dropdown' ) ) : - function eggnews_category_dropdown() { - $eggnews_categories = get_categories( array( 'hide_empty' => 0 ) ); - $eggnews_category_dropdown['0'] = esc_html__( 'Select Category', 'eggnews' ); - foreach ( $eggnews_categories as $eggnews_category ) { - $eggnews_category_dropdown[ $eggnews_category->term_id ] = $eggnews_category->cat_name; - } - - return $eggnews_category_dropdown; - } +if (!function_exists('eggnews_category_dropdown')) : + function eggnews_category_dropdown() + { + $eggnews_categories = get_categories(array('hide_empty' => 0)); + $eggnews_category_dropdown['0'] = esc_html__('Select Category', 'eggnews'); + foreach ($eggnews_categories as $eggnews_category) { + $eggnews_category_dropdown[$eggnews_category->term_id] = $eggnews_category->cat_name; + } + + return $eggnews_category_dropdown; + } endif; -if ( ! function_exists( 'eggnews_tags_dropdown' ) ) : - function eggnews_tags_dropdown() { - $eggnews_tags = get_tags( array( 'hide_empty' => 0 ) ); - $eggnews_tags_dropdown['0'] = esc_html__( 'Select Tags', 'eggnews' ); - foreach ( $eggnews_tags as $eggnews_tag ) { - $eggnews_tags_dropdown[ $eggnews_tag->term_id ] = $eggnews_tag->name; - } +if (!function_exists('eggnews_tags_dropdown')) : + function eggnews_tags_dropdown() + { + $eggnews_tags = get_tags(array('hide_empty' => 0)); + $eggnews_tags_dropdown['0'] = esc_html__('Select Tags', 'eggnews'); + foreach ($eggnews_tags as $eggnews_tag) { + $eggnews_tags_dropdown[$eggnews_tag->term_id] = $eggnews_tag->name; + } - return $eggnews_tags_dropdown; - } + return $eggnews_tags_dropdown; + } endif; -if ( ! function_exists( 'eggnews_category_dropdown_parameter' ) ) : - function eggnews_category_dropdown_parameter() { - $eggnews_category_dropdown_parameter = array( - '1' => __( 'Category in - All post from either or selected category', 'eggnews' ), - '2' => __( 'Category and - All post that must have all selected category', 'eggnews' ), - '3' => __( 'Category not in - All posts except selected category', 'eggnews' ), - ); - - return $eggnews_category_dropdown_parameter; - } +if (!function_exists('eggnews_category_dropdown_parameter')) : + function eggnews_category_dropdown_parameter() + { + $eggnews_category_dropdown_parameter = array( + '1' => __('Category in - All post from either or selected category', 'eggnews'), + '2' => __('Category and - All post that must have all selected category', 'eggnews'), + '3' => __('Category not in - All posts except selected category', 'eggnews'), + ); + + return $eggnews_category_dropdown_parameter; + } endif; -if ( ! function_exists( 'eggnews_tags_dropdown_parameter' ) ) : - function eggnews_tags_dropdown_parameter() { - $eggnews_tag_dropdown_parameter = array( - '1' => __( 'Tag in - All post from either or selected tag', 'eggnews' ), - '2' => __( 'Tag and - All post that must have all selected tag', 'eggnews' ), - '3' => __( 'Tag not in - All posts except selected tag', 'eggnews' ), - ); - - return $eggnews_tag_dropdown_parameter; - } +if (!function_exists('eggnews_tags_dropdown_parameter')) : + function eggnews_tags_dropdown_parameter() + { + $eggnews_tag_dropdown_parameter = array( + '1' => __('Tag in - All post from either or selected tag', 'eggnews'), + '2' => __('Tag and - All post that must have all selected tag', 'eggnews'), + '3' => __('Tag not in - All posts except selected tag', 'eggnews'), + ); + + return $eggnews_tag_dropdown_parameter; + } endif; /* * Feature slider layout */ -if ( ! function_exists( 'eggnews_feature_slider_layout' ) ) : - - function eggnews_feature_slider_layout() { - return apply_filters( 'eggnews_feature_slider_layout', array( - 'left' => __( 'Left Slider', 'eggnews' ), - 'right' => __( 'Right Slider', 'eggnews' ), - 'center' => __( 'Center Slider', 'eggnews' ), - 'slider_only' => __( 'Slider Only', 'eggnews' ), - ) ); +if (!function_exists('eggnews_feature_slider_layout')) : + + function eggnews_feature_slider_layout() + { + return apply_filters('eggnews_feature_slider_layout', array( + 'left' => __('Left Slider', 'eggnews'), + 'right' => __('Right Slider', 'eggnews'), + 'center' => __('Center Slider', 'eggnews'), + 'slider_only' => __('Slider Only', 'eggnews'), + )); } endif; //no of columns $eggnews_grid_columns = array( - '1' => esc_html__( 'Select No. of Columns', 'eggnews' ), - '2' => esc_html__( '2 Columns', 'eggnews' ), - '3' => esc_html__( '3 Columns', 'eggnews' ), - '4' => esc_html__( '4 Columns', 'eggnews' ) + '1' => esc_html__('Select No. of Columns', 'eggnews'), + '2' => esc_html__('2 Columns', 'eggnews'), + '3' => esc_html__('3 Columns', 'eggnews'), + '4' => esc_html__('4 Columns', 'eggnews') ); /*------------------------------------------------------------------------------------------------*/ /** * Custom function for wp_query args */ -if ( ! function_exists( 'eggnews_query_args' ) ): - function eggnews_query_args( $cat_id, $post_count = null, $category_parameter = 1, $eggnews_tag_id = 0, $tag_parameter = 1 ) { - - $parameter_query = 'category__in'; - - if ( $category_parameter === 1 ) { - $parameter_query = 'category__in'; - } else if ( $category_parameter === 2 ) { - $parameter_query = 'category__and'; - } else if ( $category_parameter === 3 ) { - $parameter_query = 'category__not_in'; - } - if ( is_array( $cat_id ) ) { - if ( count( $cat_id ) == 1 && $cat_id[0] === 0 ) { - $eggnews_args = array( - 'post_type' => 'post', - 'posts_per_page' => $post_count, - 'ignore_sticky_posts' => 1 - ); - } else { - $eggnews_args = array( - 'post_type' => 'post', - $parameter_query => $cat_id, - 'posts_per_page' => $post_count - ); - } - } else if ( ! empty( $cat_id ) ) { - $eggnews_args = array( - 'post_type' => 'post', - 'cat' => $cat_id, - 'posts_per_page' => $post_count - ); - } else { - $eggnews_args = array( - 'post_type' => 'post', - 'posts_per_page' => $post_count, - 'ignore_sticky_posts' => 1 - ); - } - - $tag_parameter_query = 'tag__in'; - - if ( $tag_parameter === 1 ) { - $tag_parameter_query = 'tag__in'; - } else if ( $tag_parameter === 2 ) { - $tag_parameter_query = 'tag__and'; - } else if ( $tag_parameter === 3 ) { - $tag_parameter_query = 'tag__not_in'; - } - if ( is_array( $eggnews_tag_id ) ) { - if ( count( $eggnews_tag_id ) == 1 && $eggnews_tag_id[0] === 0 ) { - - } else { - $eggnews_args[ $tag_parameter_query ] = $eggnews_tag_id; - - } - } else if ( $eggnews_tag_id !== 0 ) { - $eggnews_args['tag_id'] = $eggnews_tag_id; - - } - - return $eggnews_args; - } +if (!function_exists('eggnews_query_args')): + function eggnews_query_args($cat_id, $post_count = null, $category_parameter = 1, $eggnews_tag_id = 0, $tag_parameter = 1) + { + + $parameter_query = 'category__in'; + + if ($category_parameter === 1) { + $parameter_query = 'category__in'; + } else if ($category_parameter === 2) { + $parameter_query = 'category__and'; + } else if ($category_parameter === 3) { + $parameter_query = 'category__not_in'; + } + if (is_array($cat_id)) { + if (count($cat_id) == 1 && $cat_id[0] === 0) { + $eggnews_args = array( + 'post_type' => 'post', + 'posts_per_page' => $post_count, + 'ignore_sticky_posts' => 1 + ); + } else { + $eggnews_args = array( + 'post_type' => 'post', + $parameter_query => $cat_id, + 'posts_per_page' => $post_count + ); + } + } else if (!empty($cat_id)) { + $eggnews_args = array( + 'post_type' => 'post', + 'cat' => $cat_id, + 'posts_per_page' => $post_count + ); + } else { + $eggnews_args = array( + 'post_type' => 'post', + 'posts_per_page' => $post_count, + 'ignore_sticky_posts' => 1 + ); + } + + $tag_parameter_query = 'tag__in'; + + if ($tag_parameter === 1) { + $tag_parameter_query = 'tag__in'; + } else if ($tag_parameter === 2) { + $tag_parameter_query = 'tag__and'; + } else if ($tag_parameter === 3) { + $tag_parameter_query = 'tag__not_in'; + } + if (is_array($eggnews_tag_id)) { + if (count($eggnews_tag_id) == 1 && $eggnews_tag_id[0] === 0) { + + } else { + $eggnews_args[$tag_parameter_query] = $eggnews_tag_id; + + } + } else if ($eggnews_tag_id !== 0) { + $eggnews_args['tag_id'] = $eggnews_tag_id; + + } + + return $eggnews_args; + } endif; /*------------------------------------------------------------------------------------------------*/ /** * block widget title */ -if ( ! function_exists( 'eggnews_block_title' ) ): - function eggnews_block_title( $block_title, $block_cat_id ) { - $block_cat_name = get_cat_name( $block_cat_id ); - $cat_id_class = ''; - if ( ! empty( $block_cat_id ) ) { - $cat_id_class = 'teg-cat-' . $block_cat_id; - $cat_link = get_category_link( $block_cat_id ); - } - if ( ! empty( $block_title ) ) { - $teg_widget_title = $block_title; - } elseif ( ! empty( $block_cat_name ) ) { - $teg_widget_title = $block_cat_name; - } else { - $teg_widget_title = ''; - } - if ( empty( $teg_widget_title ) ) { - return; - } - ?> -
-

- - - -

-
- +
+

+ + + +

+
+ ID; - $categories_list = get_the_category( $post_id ); - if ( ! empty( $categories_list ) ) { - ?> -
- name; - $cat_id = $cat_data->term_id; - $cat_link = get_category_link( $cat_id ); - ?> - - -
- ID; + $categories_list = get_the_category($post_id); + if (!empty($categories_list)) { + ?> +
+ name; + $cat_id = $cat_data->term_id; + $cat_link = get_category_link($cat_id); + ?> + + +
+ '; - } - if ( ! empty( $social_tw_link ) ) { - echo ''; - } - if ( ! empty( $social_gp_link ) ) { - echo ''; - } - if ( ! empty( $social_lnk_link ) ) { - echo ''; - } - if ( ! empty( $social_yt_link ) ) { - echo ''; - } - if ( ! empty( $social_vm_link ) ) { - echo ''; - } - if ( ! empty( $social_pin_link ) ) { - echo ''; - } - if ( ! empty( $social_insta_link ) ) { - echo ''; - } - } +if (!function_exists('eggnews_social_icons')): + function eggnews_social_icons() + { + $social_fb_link = get_theme_mod('social_fb_link', ''); + $social_tw_link = get_theme_mod('social_tw_link', ''); + $social_gp_link = get_theme_mod('social_gp_link', ''); + $social_lnk_link = get_theme_mod('social_lnk_link', ''); + $social_yt_link = get_theme_mod('social_yt_link', ''); + $social_vm_link = get_theme_mod('social_vm_link', ''); + $social_pin_link = get_theme_mod('social_pin_link', ''); + $social_insta_link = get_theme_mod('social_insta_link', ''); + + $social_fb_icon = 'fa-facebook'; + $social_fb_icon = apply_filters('eggnews_social_fb_icon', $social_fb_icon); + + $social_tw_icon = 'fa-twitter'; + $social_tw_icon = apply_filters('eggnews_social_tw_icon', $social_tw_icon); + + $social_gp_icon = 'fa-google-plus'; + $social_gp_icon = apply_filters('eggnews_social_gp_icon', $social_gp_icon); + + $social_lnk_icon = 'fa-linkedin'; + $social_lnk_icon = apply_filters('eggnews_social_lnk_icon', $social_lnk_icon); + + $social_yt_icon = 'fa-youtube'; + $social_yt_icon = apply_filters('eggnews_social_yt_icon', $social_yt_icon); + + $social_vm_icon = 'fa-vimeo'; + $social_vm_icon = apply_filters('eggnews_social_vm_icon', $social_vm_icon); + + $social_pin_icon = 'fa-pinterest'; + $social_pin_icon = apply_filters('eggnews_social_pin_icon', $social_pin_icon); + + $social_insta_icon = 'fa-instagram'; + $social_insta_icon = apply_filters('eggnews_social_insta_icon', $social_insta_icon); + + if (!empty($social_fb_link)) { + echo ''; + } + if (!empty($social_tw_link)) { + echo ''; + } + if (!empty($social_gp_link)) { + echo ''; + } + if (!empty($social_lnk_link)) { + echo ''; + } + if (!empty($social_yt_link)) { + echo ''; + } + if (!empty($social_vm_link)) { + echo ''; + } + if (!empty($social_pin_link)) { + echo ''; + } + if (!empty($social_insta_link)) { + echo ''; + } + } endif; /*------------------------------------------------------------------------------------------------*/ /** * Top header social icon section */ -add_action( 'eggnews_top_social_icons', 'eggnews_top_social_icons_hook' ); -if ( ! function_exists( 'eggnews_top_social_icons_hook' ) ): - function eggnews_top_social_icons_hook() { - $top_social_icons = get_theme_mod( 'eggnews_header_social_option', 'enable' ); - if ( $top_social_icons != 'disable' ) { - ?> -
- -
- +
+ +
+ object ) { - $category = get_category( $item->object_id ); - $classes[] = 'teg-cat-' . $category->term_id; - } +function eggnews_category_nav_class($classes, $item) +{ + if ('category' == $item->object) { + $category = get_category($item->object_id); + $classes[] = 'teg-cat-' . $category->term_id; + } - return $classes; + return $classes; } -add_filter( 'nav_menu_css_class', 'eggnews_category_nav_class', 10, 2 ); +add_filter('nav_menu_css_class', 'eggnews_category_nav_class', 10, 2); /*------------------------------------------------------------------------------------------------*/ /** * Generate darker color * Source: http://stackoverflow.com/questions/3512311/how-to-generate-lighter-darker-color-with-php */ -if ( ! function_exists( 'eggnews_hover_color' ) ) : - function eggnews_hover_color( $hex, $steps ) { - // Steps should be between -255 and 255. Negative = darker, positive = lighter - $steps = max( - 255, min( 255, $steps ) ); - - // Normalize into a six character long hex string - $hex = str_replace( '#', '', $hex ); - if ( strlen( $hex ) == 3 ) { - $hex = str_repeat( substr( $hex, 0, 1 ), 2 ) . str_repeat( substr( $hex, 1, 1 ), 2 ) . str_repeat( substr( $hex, 2, 1 ), 2 ); - } - - // Split into three parts: R, G and B - $color_parts = str_split( $hex, 2 ); - $return = '#'; - - foreach ( $color_parts as $color ) { - $color = hexdec( $color ); // Convert to decimal - $color = max( 0, min( 255, $color + $steps ) ); // Adjust color - $return .= str_pad( dechex( $color ), 2, '0', STR_PAD_LEFT ); // Make two char hex code - } - - return $return; - } +if (!function_exists('eggnews_hover_color')) : + function eggnews_hover_color($hex, $steps) + { + // Steps should be between -255 and 255. Negative = darker, positive = lighter + $steps = max(-255, min(255, $steps)); + + // Normalize into a six character long hex string + $hex = str_replace('#', '', $hex); + if (strlen($hex) == 3) { + $hex = str_repeat(substr($hex, 0, 1), 2) . str_repeat(substr($hex, 1, 1), 2) . str_repeat(substr($hex, 2, 1), 2); + } + + // Split into three parts: R, G and B + $color_parts = str_split($hex, 2); + $return = '#'; + + foreach ($color_parts as $color) { + $color = hexdec($color); // Convert to decimal + $color = max(0, min(255, $color + $steps)); // Adjust color + $return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code + } + + return $return; + } endif; /*------------------------------------------------------------------------------------------------*/ /** * Function define about page/post/archive sidebar */ -if ( ! function_exists( 'eggnews_sidebar' ) ): - function eggnews_sidebar() { - global $post; - if ( is_single() || is_page() ) { - $sidebar_meta_option = get_post_meta( $post->ID, 'eggnews_sidebar_location', true ); - } - - if ( is_home() ) { - $set_id = get_option( 'page_for_posts' ); - $sidebar_meta_option = get_post_meta( $set_id, 'eggnews_sidebar_location', true ); - } - - if ( empty( $sidebar_meta_option ) || is_archive() || is_search() ) { - $sidebar_meta_option = 'default_sidebar'; - } - - $eggnews_archive_sidebar = get_theme_mod( 'eggnews_archive_sidebar', 'right_sidebar' ); - $eggnews_post_default_sidebar = get_theme_mod( 'eggnews_default_post_sidebar', 'right_sidebar' ); - $eggnews_page_default_sidebar = get_theme_mod( 'eggnews_default_page_sidebar', 'right_sidebar' ); - - if ( $sidebar_meta_option == 'default_sidebar' ) { - if ( is_single() ) { - if ( $eggnews_post_default_sidebar == 'right_sidebar' ) { - get_sidebar(); - } elseif ( $eggnews_post_default_sidebar == 'left_sidebar' ) { - get_sidebar( 'left' ); - } - } elseif ( is_page() ) { - if ( $eggnews_page_default_sidebar == 'right_sidebar' ) { - get_sidebar(); - } elseif ( $eggnews_page_default_sidebar == 'left_sidebar' ) { - get_sidebar( 'left' ); - } - } elseif ( $eggnews_archive_sidebar == 'right_sidebar' ) { - get_sidebar(); - } elseif ( $eggnews_archive_sidebar == 'left_sidebar' ) { - get_sidebar( 'left' ); - } - } elseif ( $sidebar_meta_option == 'right_sidebar' ) { - get_sidebar(); - } elseif ( $sidebar_meta_option == 'left_sidebar' ) { - get_sidebar( 'left' ); - } - } +if (!function_exists('eggnews_sidebar')): + function eggnews_sidebar() + { + global $post; + if (is_single() || is_page()) { + $sidebar_meta_option = get_post_meta($post->ID, 'eggnews_sidebar_location', true); + } + + if (is_home()) { + $set_id = get_option('page_for_posts'); + $sidebar_meta_option = get_post_meta($set_id, 'eggnews_sidebar_location', true); + } + + if (empty($sidebar_meta_option) || is_archive() || is_search()) { + $sidebar_meta_option = 'default_sidebar'; + } + + $eggnews_archive_sidebar = get_theme_mod('eggnews_archive_sidebar', 'right_sidebar'); + $eggnews_post_default_sidebar = get_theme_mod('eggnews_default_post_sidebar', 'right_sidebar'); + $eggnews_page_default_sidebar = get_theme_mod('eggnews_default_page_sidebar', 'right_sidebar'); + + if ($sidebar_meta_option == 'default_sidebar') { + if (is_single()) { + if ($eggnews_post_default_sidebar == 'right_sidebar') { + get_sidebar(); + } elseif ($eggnews_post_default_sidebar == 'left_sidebar') { + get_sidebar('left'); + } + } elseif (is_page()) { + if ($eggnews_page_default_sidebar == 'right_sidebar') { + get_sidebar(); + } elseif ($eggnews_page_default_sidebar == 'left_sidebar') { + get_sidebar('left'); + } + } elseif ($eggnews_archive_sidebar == 'right_sidebar') { + get_sidebar(); + } elseif ($eggnews_archive_sidebar == 'left_sidebar') { + get_sidebar('left'); + } + } elseif ($sidebar_meta_option == 'right_sidebar') { + get_sidebar(); + } elseif ($sidebar_meta_option == 'left_sidebar') { + get_sidebar('left'); + } + } endif; /*------------------------------------------------------------------------------------------------*/ /** * Get author info */ -add_action( 'eggnews_author_box', 'eggnews_author_box_hook' ); -if ( ! function_exists( 'eggnews_author_box_hook' ) ): - function eggnews_author_box_hook() { - global $post; - $author_id = $post->post_author; - $author_avatar = get_avatar( $author_id, '132' ); - $author_nickname = get_the_author_meta( 'display_name' ); - $eggnews_author_option = get_theme_mod( 'eggnews_author_box_option', 'show' ); - if ( $eggnews_author_option != 'hide' ) { - ?> -
-
- -
-
- -
- -
-
- post_author; + $author_avatar = get_avatar($author_id, '132'); + $author_nickname = get_the_author_meta('display_name'); + $eggnews_author_option = get_theme_mod('eggnews_author_box_option', 'show'); + if ($eggnews_author_option != 'hide') { + ?> +
+
+ +
+
+ +
+ +
+
+ -