'Main Menu', ) ); //////////////////////////////////////////////////////////////////// // Register Widgets //////////////////////////////////////////////////////////////////// add_action( 'widgets_init', 'maxstore_widgets_init' ); function maxstore_widgets_init() { register_sidebar( array( 'name' => __( 'Right Sidebar', 'maxstore' ), 'id' => 'right-sidebar', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

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

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Footer Section', 'maxstore' ), 'id' => 'footer_area', 'description' => __( 'Content Footer Section', 'maxstore' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_widget( 'maxstore_posts_widget' ); } //////////////////////////////////////////////////////////////////// // Register hook and action to set Main content area col-md- width based on sidebar declarations //////////////////////////////////////////////////////////////////// add_action( 'maxstore_main_content_width_hook', 'maxstore_main_content_width_columns'); function maxstore_main_content_width_columns () { $columns = '12'; if (get_theme_mod( 'rigth-sidebar-check', 1 ) != 0 ) { $columns = $columns - get_theme_mod( 'right-sidebar-size', 3 ); } if (get_theme_mod( 'left-sidebar-check', 0 ) != 0 ) { $columns = $columns - get_theme_mod( 'left-sidebar-size', 3 ); } echo $columns; } function maxstore_main_content_width() { do_action('maxstore_main_content_width_hook'); } //////////////////////////////////////////////////////////////////// // Add support for a featured image and the size //////////////////////////////////////////////////////////////////// add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size(300,300, true); add_image_size( 'twp-widget', 640, 280, true ); add_image_size( 'twp-single', 848, 400, true ); add_image_size( 'twp-home-top', 300, 300, true ); //////////////////////////////////////////////////////////////////// // Adds RSS feed links to for posts and comments. //////////////////////////////////////////////////////////////////// add_theme_support( 'automatic-feed-links' ); //////////////////////////////////////////////////////////////////// // Set Content Width //////////////////////////////////////////////////////////////////// if ( ! isset( $content_width ) ) $content_width = 800; //////////////////////////////////////////////////////////////////// // Schema.org microdata //////////////////////////////////////////////////////////////////// function maxstore_tag_schema() { $schema = 'http://schema.org/'; // Is single post if(is_single()) { $type = "Article"; } // 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 maxstore_breadcrumb () { global $post,$wp_query; //schema link $schema_link = 'http://data-vocabulary.org/Breadcrumb'; $home = __('Home', 'maxstore'); $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( 'maxstore_content_nav' ) ) : function maxstore_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', 'maxstore' ), 'twp_social_twitter' => __( 'Twitter', 'maxstore' ), 'twp_social_google' => __( 'Google-Plus' , 'maxstore' ), 'twp_social_instagram' => __( 'Instagram', 'maxstore' ), 'twp_social_pin' => __( 'Pinterest', 'maxstore' ), 'twp_social_youtube' => __( 'YouTube', 'maxstore' ), 'twp_social_reddit' => __( 'Reddit', 'maxstore' ), ); ?> 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','maxstore' ), 'next_text' => __('Next →','maxstore' ), )); if (is_array($pages)) { $current_page = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged'); echo ''; } } //////////////////////////////////////////////////////////////////// // Load TGM Plugin Activation //////////////////////////////////////////////////////////////////// require_once dirname( __FILE__ ) . '/inc/class-tgm-plugin-activation.php'; add_action( 'tgmpa_register', 'maxstore_register_required_plugins' ); function maxstore_register_required_plugins() { $plugins = array( array( 'name' => 'CMB2', 'slug' => 'cmb2', 'required' => true, 'force_activation' => false, 'force_deactivation' => false, ), array( 'name' => 'WooCommerce', 'slug' => 'woocommerce', 'required' => true, 'force_activation' => false, 'force_deactivation' => false, ), ); $config = array( 'domain' => 'maxstore', 'default_path' => '', 'parent_menu_slug' => 'themes.php', 'parent_url_slug' => 'themes.php', 'menu' => 'install-required-plugins', 'has_notices' => true, 'is_automatic' => false, 'message' => '', 'strings' => array( 'page_title' => __( 'Install Required Plugins', 'maxstore' ), 'menu_title' => __( 'Install Plugins', 'maxstore' ), 'installing' => __( 'Installing Plugin: %s', 'maxstore' ), 'oops' => __( 'Something went wrong with the plugin API.', 'maxstore' ), 'notice_can_install_required' => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.', 'maxstore' ), 'notice_can_install_recommended' => _n_noop( 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.', 'maxstore' ), 'notice_cannot_install' => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.', 'maxstore' ), 'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.', 'maxstore' ), 'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.', 'maxstore' ), 'notice_cannot_activate' => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.', 'maxstore' ), 'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.', 'maxstore' ), 'notice_cannot_update' => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.', 'maxstore' ), 'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins', 'maxstore' ), 'activate_link' => _n_noop( 'Activate installed plugin', 'Activate installed plugins', 'maxstore' ), 'return' => __( 'Return to Required Plugins Installer', 'maxstore' ), 'plugin_activated' => __( 'Plugin activated successfully.', 'maxstore' ), 'complete' => __( 'All plugins installed and activated successfully. %s', 'maxstore' ), 'nag_type' => 'updated', 'dismiss' => __( 'Dismiss this notice', 'maxstore' ), ) ); tgmpa( $plugins, $config ); } //////////////////////////////////////////////////////////////////// // WooCommerce section //////////////////////////////////////////////////////////////////// if ( class_exists( 'WooCommerce' ) ) { //////////////////////////////////////////////////////////////////// // WooCommerce header cart //////////////////////////////////////////////////////////////////// add_action( 'after_setup_theme', 'maxstore_woocommerce_support' ); function maxstore_woocommerce_support() { add_theme_support( 'woocommerce' ); } if ( ! function_exists( 'maxstore_cart_link' ) ) { function maxstore_cart_link() { ?> cart->get_cart_contents_count();?>cart->get_cart_subtotal() ); ?>
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', 'maxstore_advanced_search_query', 1000); } //////////////////////////////////////////////////////////////////// // WooCommerce end //////////////////////////////////////////////////////////////////// ?>