450, 'height' => 200, 'flex-width' => true, 'flex-height' => true, ); add_theme_support( 'custom-logo', $custom_logo_defaults ); // Add theme support for Custom Header. $custom_header_defaults = array( 'width' => 1300, 'height' => 500, 'flex-width' => true, 'flex-height' => true, 'default-image' => esc_url( get_template_directory_uri() ) .'/assets/images/ashe_bg.jpg', 'default-text-color' => '111', ); add_theme_support( 'custom-header', $custom_header_defaults ); // Add theme support for Custom Background. $custom_background_defaults = array( 'default-color' => '', ); add_theme_support( 'custom-background', $custom_background_defaults ); // Set the default content width. $GLOBALS['content_width'] = 960; // This theme uses wp_nav_menu() in two locations register_nav_menus( array( 'top' => __( 'Top Menu', 'ashe' ), 'main' => __( 'Main Menu', 'ashe' ), 'footer' => __( 'Footer Menu', 'ashe' ), ) ); // Switch default core markup for search form, comment form, and comments to output valid HTML5 add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'gallery', 'caption', ) ); // Gutenberg Embeds add_theme_support( 'responsive-embeds' ); // WooCommerce add_theme_support( 'woocommerce' ); add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); // Theme Activation Notice add_action( 'admin_notices', 'ashe_activation_notice' ); } add_action( 'after_setup_theme', 'ashe_setup' ); /* ** Notice after Theme Activation and Update. */ function ashe_activation_notice() { if ( isset($_GET['page']) ) { return; } global $pagenow; global $current_user; $user_id = $current_user->ID; $theme_data = wp_get_theme(); $theme_vers = str_replace( '.', '_', $theme_data->get( 'Version' ) ); if ( ! get_user_meta( $user_id, esc_html( $theme_data->get( 'TextDomain' ) ) . $theme_vers .'_notice_ignore' ) ) { echo '
'; printf( '', '?' . esc_html( $theme_data->get( 'TextDomain' ) ) . $theme_vers .'_notice_ignore=0' ); echo '

'; /* translators: %1$s: theme name, %2$s link */ printf( __( 'Thank you for choosing %1$s! To fully take advantage of the best our theme can offer please make sure you visit our Welcome page', 'ashe' ), esc_html( $theme_data->Name ), esc_url( admin_url( 'themes.php?page=about-ashe' ) ) ); echo '

'; echo '

'; /* translators: %s theme name */ printf( esc_html__( 'Get started with %s', 'ashe' ), esc_html( $theme_data->Name ) ); echo '

'; echo '
'; } } function ashe_notice_ignore() { global $current_user; $theme_data = wp_get_theme(); $user_id = $current_user->ID; $theme_vers = str_replace( '.', '_', $theme_data->get( 'Version' ) ); /* If user clicks to ignore the notice, add that to their user meta */ if ( isset( $_GET[ esc_html( $theme_data->get( 'TextDomain' ) ) . $theme_vers .'_notice_ignore' ] ) && '0' == $_GET[ esc_html( $theme_data->get( 'TextDomain' ) ) . $theme_vers .'_notice_ignore' ] ) { add_user_meta( $user_id, esc_html( $theme_data->get( 'TextDomain' ) ) . $theme_vers .'_notice_ignore', 'true', true ); } } add_action( 'admin_init', 'ashe_notice_ignore' ); function ashe_erase_ignored_notice() { global $current_user; $theme_data = wp_get_theme(); $user_id = $current_user->ID; $theme_vers = str_replace( '.', '_', $theme_data->get( 'Version' ) ); delete_user_meta( $user_id, esc_html( $theme_data->get( 'TextDomain' ) ) . $theme_vers .'_notice_ignore' ); } add_action('after_switch_theme', 'ashe_erase_ignored_notice'); function ashe_admin_scripts() { // Theme Activation Notice wp_enqueue_style( 'ashe-admin', get_theme_file_uri( '/assets/css/admin.css' ) ); } add_action( 'admin_enqueue_scripts', 'ashe_admin_scripts' ); /** ** Add a pingback url auto-discovery header for singularly identifiable articles. */ function ashe_pingback_header() { if ( is_singular() && pings_open() ) { printf( '' . "\n", get_bloginfo( 'pingback_url' ) ); } } add_action( 'wp_head', 'ashe_pingback_header' ); /* ** Enqueue scripts and styles */ function ashe_scripts() { // Theme Stylesheet wp_enqueue_style( 'ashe-style', get_stylesheet_uri(), array(), '1.9.7' ); // FontAwesome Icons wp_enqueue_style( 'fontawesome', get_theme_file_uri( '/assets/css/font-awesome.css' ) ); // Fontello Icons wp_enqueue_style( 'fontello', get_theme_file_uri( '/assets/css/fontello.css' ) ); // Slick Slider wp_enqueue_style( 'slick', get_theme_file_uri( '/assets/css/slick.css' ) ); // Scrollbar wp_enqueue_style( 'scrollbar', get_theme_file_uri( '/assets/css/perfect-scrollbar.css' ) ); // WooCommerce if ( class_exists( 'WooCommerce' ) ) { wp_enqueue_style( 'ashe-woocommerce', get_theme_file_uri( '/assets/css/woocommerce.css' ) ); } // Theme Responsive CSS wp_enqueue_style( 'ashe-responsive', get_theme_file_uri( '/assets/css/responsive.css' ), array(), '1.9.7' ); // Enqueue Custom Scripts wp_enqueue_script( 'ashe-plugins', get_theme_file_uri( '/assets/js/custom-plugins.js' ), array( 'jquery' ), '1.8.2', true ); wp_enqueue_script( 'ashe-custom-scripts', get_theme_file_uri( '/assets/js/custom-scripts.js' ), array( 'jquery' ), '1.9.7', true ); // Comment reply link if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'ashe_scripts' ); /* ** Enqueue Google Fonts */ function ashe_playfair_font_url() { $font_url = ''; if ( 'off' !== _x( 'on', 'Google font: on or off', 'ashe' ) ) { $font_url = add_query_arg( 'family', urlencode( 'Playfair Display:400,700' ), "//fonts.googleapis.com/css" ); } return $font_url; } function ashe_opensans_font_url() { $font_url = ''; if ( 'off' !== _x( 'on', 'Google font: on or off', 'ashe' ) ) { $font_url = add_query_arg( 'family', urlencode( 'Open Sans:400italic,400,600italic,600,700italic,700' ), "//fonts.googleapis.com/css" ); } return $font_url; } function ashe_kalam_font_url() { $font_url = ''; if ( 'off' !== _x( 'on', 'Google font: on or off', 'ashe' ) ) { $font_url = add_query_arg( 'family', urlencode( 'Kalam' ), "//fonts.googleapis.com/css" ); } return $font_url; } function ashe_rokkitt_font_url() { $font_url = ''; if ( 'off' !== _x( 'on', 'Google font: on or off', 'ashe' ) ) { $font_url = add_query_arg( 'family', urlencode( 'Rokkitt' ), "//fonts.googleapis.com/css" ); } return $font_url; } function ashe_gfonts_scripts() { wp_enqueue_style( 'ashe-playfair-font', ashe_playfair_font_url(), array(), '1.0.0' ); wp_enqueue_style( 'ashe-opensans-font', ashe_opensans_font_url(), array(), '1.0.0' ); // Load Kalam if selected if ( ashe_options( 'typography_logo_family' ) == 'Kalam' || ashe_options( 'typography_nav_family' ) == 'Kalam' ) { wp_enqueue_style( 'ashe-kalam-font', ashe_kalam_font_url(), array(), '1.0.0' ); } // Load Rokkitt if selected if ( ashe_options( 'typography_logo_family' ) == 'Rokkitt' || ashe_options( 'typography_nav_family' ) == 'Rokkitt' ) { wp_enqueue_style( 'ashe-rokkitt-font', ashe_rokkitt_font_url(), array(), '1.0.0' ); } } add_action( 'wp_enqueue_scripts', 'ashe_gfonts_scripts' ); /* ** Register widget areas. */ function ashe_widgets_init() { register_sidebar( array( 'name' => __( 'Right Sidebar', 'ashe' ), 'id' => 'sidebar-right', 'description' => __( 'Add widgets here to appear in your sidebar.', 'ashe' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Left Sidebar', 'ashe' ), 'id' => 'sidebar-left', 'description' => __( 'Add widgets here to appear in your sidebar.', 'ashe' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Sidebar Alt', 'ashe' ), 'id' => 'sidebar-alt', 'description' => __( 'Add widgets here to appear in your alternative/fixed sidebar.', 'ashe' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Widgets', 'ashe' ), 'id' => 'footer-widgets', 'description' => __( 'Add widgets here to appear in your footer.', 'ashe' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'ashe_widgets_init' ); /* ** Custom Image Sizes */ add_image_size( 'ashe-slider-full-thumbnail', 1080, 540, true ); add_image_size( 'ashe-full-thumbnail', 1140, 0, true ); add_image_size( 'ashe-list-thumbnail', 300, 300, true ); add_image_size( 'ashe-grid-thumbnail', 500, 330, true ); add_image_size( 'ashe-single-navigation', 75, 75, true ); /* ** Top Menu Fallback */ function ashe_top_menu_fallback() { if ( current_user_can( 'edit_theme_options' ) ) { echo ''; } } /* ** Main Menu Fallback */ function ashe_main_menu_fallback() { if ( ashe_is_preview() ) { echo ''; } else { if ( current_user_can( 'edit_theme_options' ) ) { echo ''; } } } /* ** Custom Excerpt Length */ function ashe_excerpt_length( $link ) { if ( is_admin() ) { return $link; } $link = sprintf( '', esc_url( get_permalink( get_the_ID() ) ), /* translators: %s: Name of current post */ sprintf( __( 'Continue reading "%s"', 'ashe' ), get_the_title( get_the_ID() ) ) ); return 2000; } add_filter( 'excerpt_length', 'ashe_excerpt_length', 999 ); function ashe_new_excerpt( $link ) { if ( is_admin() ) { return $link; } $link = sprintf( '', esc_url( get_permalink( get_the_ID() ) ), /* translators: %s: Name of current post */ sprintf( __( 'Continue reading "%s"', 'ashe' ), get_the_title( get_the_ID() ) ) ); return '...'; } add_filter( 'excerpt_more', 'ashe_new_excerpt' ); if ( ! function_exists( 'ashe_excerpt' ) ) { function ashe_excerpt( $limit = 50 ) { echo '

'. wp_trim_words(get_the_excerpt(), $limit) .'

'; } } /* ** Custom Functions */ // HEX to RGBA Converter function ashe_hex2rgba( $color, $opacity = 1 ) { // remove '#' from string $color = substr( $color, 1 ); // get values from string $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] ); // convert HEX to RGB $rgb = array_map( 'hexdec', $hex ); // convert HEX to RGBA $output = 'rgba('. implode( ",", $rgb ) .', '. $opacity .')'; return $output; } // Social Media if ( ! function_exists( 'ashe_social_media' ) ) { function ashe_social_media( $social_class='' ) { ?>
term_id; $args = array( 'post_type' => 'post', 'category__in' => array( $first_category ), 'post__not_in' => array( $post->ID ), 'orderby' => 'rand', 'posts_per_page' => 3, 'ignore_sticky_posts' => 1, 'meta_query' => array( array( 'key' => '_thumbnail_id', 'compare' => 'EXISTS' ), ) ); if ( ashe_is_preview() ) { array_pop($args); } $similar_posts = new WP_Query( $args ); if ( $similar_posts->have_posts() ) { ?> '; $html .= ''; $html .= ''; $html .= ''; $html .= ''; return $html; } add_filter( 'get_search_form', 'ashe_custom_search_form' ); /* ** Post Share */ function ashe_post_sharing_check() { if ( ashe_options( 'blog_page_show_facebook' ) || ashe_options( 'blog_page_show_twitter' ) || ashe_options( 'blog_page_show_pinterest' ) || ashe_options( 'blog_page_show_google' ) || ashe_options( 'blog_page_show_linkedin' ) || ashe_options( 'blog_page_show_tumblr' ) || ashe_options( 'blog_page_show_reddit' ) ) { return true; } return false; } if ( ! function_exists( 'ashe_post_sharing' ) ) { function ashe_post_sharing() { global $post; ?>
ID)) ).'&description='.get_the_title(); ?>
  • >

  • >

    $depth, 'max_depth' => $args['max_depth']) ) ); ?>
    comment_approved == '0' ) : ?>

    '; echo '
    '; } add_action( 'woocommerce_before_main_content', 'ashe_woocommerce_output_content_wrapper', 5 ); // wrap woocommerce content - end function ashe_woocommerce_output_content_wrapper_end() { echo '
    '; echo ''; } add_action( 'woocommerce_after_main_content', 'ashe_woocommerce_output_content_wrapper_end', 50 ); // Remove Default Sidebar remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 ); // Change product grid columns if ( ! function_exists('ashe_woocommerce_grid_columns') ) { function ashe_woocommerce_grid_columns() { return 3; } } add_filter('loop_shop_columns', 'ashe_woocommerce_grid_columns'); // Change related products grid columns add_filter( 'woocommerce_output_related_products_args', 'ashe_related_products_args' ); function ashe_related_products_args( $args ) { $args['posts_per_page'] = 3; $args['columns'] = 3; return $args; } // Remove Breadcrumbs if ( ! function_exists('ashe_remove_wc_breadcrumbs') ) { function ashe_remove_wc_breadcrumbs() { remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 ); } } add_action( 'init', 'ashe_remove_wc_breadcrumbs' ); // Shop Per Page function ashe_set_shop_post_per_page() { return 9; } add_filter( 'loop_shop_per_page', 'ashe_set_shop_post_per_page', 20 ); // Pagination remove_action( 'woocommerce_pagination', 'woocommerce_pagination', 10 ); function ashe_woocommerce_pagination() { get_template_part( 'templates/grid/blog', 'pagination' ); } add_action( 'woocommerce_pagination', 'ashe_woocommerce_pagination', 10 ); /* ** Incs: Theme Customizer */ // Customizer require get_parent_theme_file_path( '/inc/customizer/customizer-repeater/inc/customizer.php' ); require get_parent_theme_file_path( '/inc/customizer/customizer.php' ); require get_parent_theme_file_path( '/inc/customizer/customizer-defaults.php' ); require get_parent_theme_file_path( '/inc/customizer/dynamic-css.php' ); require get_parent_theme_file_path( '/inc/customizer/css/theme-skins.php' ); require get_parent_theme_file_path( '/inc/preview/demo-preview.php' ); // About Ashe require get_parent_theme_file_path( '/inc/about/about-ashe.php' ); /* ** TGM Plugin Activation Class */ require_once get_parent_theme_file_path( '/inc/tgm/class-tgm-plugin-activation.php' ); function ashe_register_recommended_plugins() { $plugins = array( array( 'name' => 'Elementor', 'slug' => 'elementor', 'required' => false, ), ); $config = array( 'id' => 'ashe', 'default_path' => '', 'menu' => 'tgmpa-install-plugins', 'has_notices' => true, 'dismissable' => true, 'dismiss_msg' => '', 'is_automatic' => false, 'message' => '', ); tgmpa( $plugins, $config ); } add_action( 'tgmpa_register', 'ashe_register_recommended_plugins' );