__( 'Main Menu', 'alpha-store' ), 'top_menu' => __( 'Top Menu', 'alpha-store' ), ) ); add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 300, 300, true ); add_image_size( 'alpha-store-single', 688, 325, true ); add_image_size( 'alpha-store-carousel', 270, 423, true ); add_image_size( 'alpha-store-category', 600, 600, true ); add_image_size( 'alpha-store-widget', 60, 60, true ); add_theme_support( 'custom-logo', array( 'height' => 100, 'width' => 400, 'flex-height' => true, 'flex-width' => true, ) ); add_theme_support( 'automatic-feed-links' ); add_theme_support( 'woocommerce' ); } endif; //////////////////////////////////////////////////////////////////// // Display a admin notices //////////////////////////////////////////////////////////////////// add_action( 'admin_notices', 'alpha_store_admin_notice' ); function alpha_store_admin_notice() { global $current_user; $user_id = $current_user->ID; /* Check that the user hasn't already clicked to ignore the message */ if ( !get_user_meta( $user_id, 'alpha_store_ignore_notice' ) ) { echo '

'; printf( __( 'Like Alpha Store theme? You will LOVE Alpha Store PRO! ', 'alpha-store' ) . '' . __( 'Click here for all the exciting features.', 'alpha-store' ) . '', '?alpha_store_notice_ignore=0' ); echo "

"; } } add_action( 'admin_init', 'alpha_store_notice_ignore' ); function alpha_store_notice_ignore() { global $current_user; $user_id = $current_user->ID; /* If user clicks to ignore the notice, add that to their user meta */ if ( isset( $_GET[ 'alpha_store_notice_ignore' ] ) && '0' == $_GET[ 'alpha_store_notice_ignore' ] ) { add_user_meta( $user_id, 'alpha_store_ignore_notice', 'true', true ); } } add_action( 'customize_controls_print_footer_scripts', 'alpha_store_pro_banner' ); function alpha_store_pro_banner() { echo ''; echo ''; } //////////////////////////////////////////////////////////////////// // Enqueue Styles (normal style.css and bootstrap.css) //////////////////////////////////////////////////////////////////// function alpha_store_theme_stylesheets() { wp_enqueue_style( 'alpha-store-bootstrap-css', get_template_directory_uri() . '/css/bootstrap.css', array(), '3.3.4', 'all' ); wp_enqueue_style( 'alpha-store-stylesheet', get_stylesheet_uri(), array(), '1.0.2', 'all' ); // load Font Awesome css wp_enqueue_style( 'alpha-store-font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css', array(), '4.4.0' ); wp_enqueue_style( 'alpha-store-flexslider-css', get_template_directory_uri() . '/css/flexslider.css', array(), '2.5.0' ); } add_action( 'wp_enqueue_scripts', 'alpha_store_theme_stylesheets' ); //////////////////////////////////////////////////////////////////// // Register Bootstrap JS with jquery //////////////////////////////////////////////////////////////////// function alpha_store_theme_js() { wp_enqueue_script( 'alpha-store-bootstrap-js', get_template_directory_uri() . '/js/bootstrap.js', array( 'jquery' ), '3.3.4' ); wp_enqueue_script( 'alpha-store-theme-js', get_template_directory_uri() . '/js/customscript.js', array( 'jquery' ), '1.0.2'); wp_enqueue_script( 'alpha-store-flexslider', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array( 'jquery' ), '2.5.0' ); } add_action( 'wp_enqueue_scripts', 'alpha_store_theme_js' ); //////////////////////////////////////////////////////////////////// // Register Custom Navigation Walker include custom menu widget to use walkerclass //////////////////////////////////////////////////////////////////// require_once(trailingslashit( get_template_directory() ) . 'lib/wp_bootstrap_navwalker.php'); //////////////////////////////////////////////////////////////////// // Register Widgets //////////////////////////////////////////////////////////////////// add_action( 'widgets_init', 'alpha_store_widgets_init' ); function alpha_store_widgets_init() { register_sidebar( array( 'name' => __( 'Homepage Sidebar', 'alpha-store' ), 'id' => 'alpha-store-home-sidebar', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Right Sidebar', 'alpha-store' ), 'id' => 'alpha-store-right-sidebar', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Left Sidebar', 'alpha-store' ), 'id' => 'alpha-store-left-sidebar', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Section', 'alpha-store' ), 'id' => 'alpha-store-footer-area', 'description' => __( 'Content Footer Section', 'alpha-store' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } //////////////////////////////////////////////////////////////////// // Register hook and action to set Main content area col-md- width based on sidebar declarations //////////////////////////////////////////////////////////////////// add_action( 'alpha_store_main_content_width_hook', 'alpha_store_main_content_width_columns' ); function alpha_store_main_content_width_columns() { $columns = '12'; if ( get_theme_mod( 'rigth-sidebar-check', 1 ) != 0 ) { $columns = $columns - absint( get_theme_mod( 'right-sidebar-size', 3 ) ); } if ( get_theme_mod( 'left-sidebar-check', 0 ) != 0 ) { $columns = $columns - absint( get_theme_mod( 'left-sidebar-size', 3 ) ); } echo $columns; } function alpha_store_main_content_width() { do_action( 'alpha_store_main_content_width_hook' ); } //////////////////////////////////////////////////////////////////// // Theme Info page //////////////////////////////////////////////////////////////////// if ( is_admin() ) { require_once(trailingslashit( get_template_directory() ) . 'lib/theme-info.php'); } //////////////////////////////////////////////////////////////////// // Set Content Width //////////////////////////////////////////////////////////////////// if ( !isset( $content_width ) ) $content_width = 800; //////////////////////////////////////////////////////////////////// // Schema.org microdata //////////////////////////////////////////////////////////////////// function alpha_store_tag_schema() { $schema = 'http://schema.org/'; // Is single post if ( is_single() ) { $type = 'WebPage'; } // Is author page elseif ( is_author() ) { $type = 'ProfilePage'; } // Is search results page elseif ( is_search() ) { $type = 'SearchResultsPage'; } else { $type = 'WebPage'; } echo 'itemscope itemtype="' . $schema . $type . '"'; } //////////////////////////////////////////////////////////////////// // Breadcrumbs //////////////////////////////////////////////////////////////////// function alpha_store_breadcrumb() { global $post, $wp_query; // schema link $schema_link = 'http://data-vocabulary.org/Breadcrumb'; $home = __( 'Home', 'alpha-store' ); $delimiter = ' » '; $homeLink = home_url(); if ( is_home() || is_front_page() ) { // no need for breadcrumbs in homepage } else { echo ''; } } //////////////////////////////////////////////////////////////////// // Display navigation to next/previous pages when applicable //////////////////////////////////////////////////////////////////// if ( !function_exists( 'alpha_store_content_nav' ) ) : function alpha_store_content_nav( $nav_id ) { global $wp_query, $post; // Don't print empty markup on single pages if there's nowhere to navigate. if ( is_single() ) { $previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( !$next && !$previous ) return; } // Don't print empty markup in archives if there's only one page. if ( $wp_query->max_num_pages < 2 && ( is_home() || is_archive() || is_search() ) ) return; $nav_class = ( is_single() ) ? 'post-navigation' : 'paging-navigation'; ?> __( 'Facebook', 'alpha-store' ), 'twp_social_twitter' => __( 'Twitter', 'alpha-store' ), 'twp_social_google' => __( 'Google-Plus', 'alpha-store' ), 'twp_social_instagram' => __( 'Instagram', 'alpha-store' ), 'twp_social_pin' => __( 'Pinterest', 'alpha-store' ), 'twp_social_youtube' => __( 'YouTube', 'alpha-store' ), 'twp_social_reddit' => __( 'Reddit', 'alpha-store' ), ); ?> str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?page=%#%', 'current' => max( 1, get_query_var( 'paged' ) ), 'total' => $wp_query->max_num_pages, 'prev_next' => false, 'type' => 'array', 'prev_next' => TRUE, 'prev_text' => __( '← Previous', 'alpha-store' ), 'next_text' => __( 'Next →', 'alpha-store' ), ) ); if ( is_array( $pages ) ) { $current_page = ( get_query_var( 'paged' ) == 0 ) ? 1 : get_query_var( 'paged' ); echo ''; } } //////////////////////////////////////////////////////////////////// // WooCommerce section //////////////////////////////////////////////////////////////////// if ( class_exists( 'WooCommerce' ) ) { //////////////////////////////////////////////////////////////////// // WooCommerce header cart //////////////////////////////////////////////////////////////////// if ( !function_exists( 'alpha_store_cart_link' ) ) { function alpha_store_cart_link() { ?> cart->get_cart_contents_count() ); ?>
cart->get_cart_subtotal() ); ?>
get_wishlist_url(); ?>
is_main_query() && $query->is_post_type_archive('product') ) { $query->set( 'posts_per_page', absint( get_theme_mod( 'archive_number_products', 24 ) ) ); } } //////////////////////////////////////////////////////////////////// // Change number of WooCommerce products per row //////////////////////////////////////////////////////////////////// add_filter( 'loop_shop_columns', 'alpha_store_loop_columns' ); if ( !function_exists( 'alpha_store_loop_columns' ) ) { function alpha_store_loop_columns() { return absint( get_theme_mod( 'archive_number_columns', 4 ) ); } } //////////////////////////////////////////////////////////////////// // Archive product wishlist button //////////////////////////////////////////////////////////////////// function alpha_store_wishlist_products() { if ( function_exists( 'YITH_WCWL' ) ) { global $product; $url = add_query_arg( 'add_to_wishlist', $product->id ); $id = $product->id; $wishlist_url = YITH_WCWL()->get_wishlist_url(); ?>
loading
is_search() ) { // category terms search. if ( isset( $_GET[ 'category' ] ) && !empty( $_GET[ 'category' ] ) ) { $query->set( 'tax_query', array( array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => array( $_GET[ 'category' ] ) ) ) ); } return $query; } } add_action( 'pre_get_posts', 'alpha_store_advanced_search_query', 1000 ); } //////////////////////////////////////////////////////////////////// // WooCommerce end //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// // Excerpt functions //////////////////////////////////////////////////////////////////// function alpha_store_excerpt_length( $length ) { return 25; } add_filter( 'excerpt_length', 'alpha_store_excerpt_length', 999 ); function alpha_store_excerpt_more( $more ) { return '...'; } add_filter('excerpt_more', 'alpha_store_excerpt_more');