for posts and comments. add_theme_support( 'automatic-feed-links' ); // Enable support for Post Thumbnails, and declare two sizes. add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 672, 372, true ); add_image_size( 'basetheme-full-width', 1038, 576, true ); // This theme uses wp_nav_menu() in two locations. register_nav_menus( array( 'primary' => __( 'Top primary menu', 'basetheme' ), 'secondary' => __( 'Secondary menu in left sidebar', 'basetheme' ), 'topmenu' => __( 'Topbar Menu in Topbar sidebar', 'basetheme' ) ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) ); /* * Enable support for Post Formats. * See https://codex.wordpress.org/Post_Formats */ add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery', ) ); // This theme allows users to set a custom background. add_theme_support( 'custom-background', apply_filters( 'basetheme_fnc_custom_background_args', array( 'default-color' => 'f5f5f5', ) ) ); // add support for display browser title add_theme_support( 'title-tag' ); // This theme uses its own gallery styles. add_filter( 'use_default_gallery_style', '__return_false' ); basetheme_fnc_get_load_plugins(); } endif; // basetheme_fnc_setup add_action( 'after_setup_theme', 'basetheme_fnc_setup' ); /** * batch including all files in a path. * * @param String $path : PATH_DIR/*.php or PATH_DIR with $ifiles not empty */ function basetheme_pbr_includes( $path, $ifiles=array() ){ if( !empty($ifiles) ){ foreach( $ifiles as $key => $file ){ $file = $path.'/'.$file; if(is_file($file)){ require($file); } } }else { $files = glob($path); foreach ($files as $key => $file) { if(is_file($file)){ require($file); } } } } /** * Get Theme Option Value. * @param String $name : name of prameters */ function basetheme_fnc_theme_options($name, $default = false) { // get the meta from the database $options = ( get_option( 'pbr_theme_options' ) ) ? get_option( 'pbr_theme_options' ) : null; // d( $options ); // return the option if it exists if ( isset( $options[$name] ) ) { return apply_filters( 'pbr_theme_options_$name', $options[ $name ] ); } if( get_option( $name ) ){ return get_option( $name ); } // return default if nothing else return apply_filters( 'pbr_theme_options_$name', $default ); } /** * Adjust content_width value for image attachment template. * * @since PrestaBase 1.0 */ function basetheme_fnc_content_width() { if ( is_attachment() && wp_attachment_is_image() ) { $GLOBALS['content_width'] = 810; } } add_action( 'template_redirect', 'basetheme_fnc_content_width' ); /** * Require function for including 3rd plugins * */ basetheme_pbr_includes( get_template_directory() . '/inc/plugins/*.php' ); function basetheme_fnc_get_load_plugins(){ $plugins[] =(array( 'name' => 'MetaBox', // The plugin name 'slug' => 'meta-box', // The plugin slug (typically the folder name) 'required' => true, // If false, the plugin is only 'recommended' instead of required )); $plugins[] =(array( 'name' => 'WooCommerce', // The plugin name 'slug' => 'woocommerce', // The plugin slug (typically the folder name) 'required' => true, // If false, the plugin is only 'recommended' instead of required )); $plugins[] =(array( 'name' => 'YITH WooCommerce Zoom Magnifier', // The plugin name 'slug' => 'yith-woocommerce-zoom-magnifier', // The plugin slug (typically the folder name) 'required' => true )); $plugins[] =(array( 'name' => 'MailChimp', // The plugin name 'slug' => 'mailchimp-for-wp', // The plugin slug (typically the folder name) 'required' => true )); $plugins[] =(array( 'name' => 'Contact Form 7', // The plugin name 'slug' => 'contact-form-7', // The plugin slug (typically the folder name) 'required' => true, // If false, the plugin is only 'recommended' instead of required )); $plugins[] =(array( 'name' => 'PBR Theme Framework', // The plugin name 'slug' => 'pbrframework', // The plugin slug (typically the folder name) 'required' => true , 'source' => 'http://www.prestabrain.com/thememods/pbrframework.zip' )); if( function_exists("tgmpa") ){ tgmpa( $plugins ); } } /* Back end */ if( is_admin() ) { basetheme_pbr_includes( get_template_directory() . '/inc/classes/admin/*.php' ); } /** * Register three PrestaBase widget areas. * * @since PrestaBase 1.0 */ function basetheme_fnc_registart_widgets_sidebars() { register_sidebar( array( 'name' => __( 'Sidebar Default', 'basetheme' ), 'id' => 'sidebar-default', 'description' => __( 'Appears on posts and pages in the sidebar.', 'basetheme'), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Blog Left Sidebar' , 'basetheme'), 'id' => 'blog-sidebar-left', 'description' => __( 'Appears on posts and pages in the sidebar.', 'basetheme'), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Blog Right Sidebar', 'basetheme'), 'id' => 'blog-sidebar-right', 'description' => __( 'Appears on posts and pages in the sidebar.', 'basetheme'), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Footer 1' , 'basetheme'), 'id' => 'footer-1', 'description' => __( 'Appears in the footer section of the site.', 'basetheme'), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Footer 2' , 'basetheme'), 'id' => 'footer-2', 'description' => __( 'Appears in the footer section of the site.', 'basetheme'), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Footer 3' , 'basetheme'), 'id' => 'footer-3', 'description' => __( 'Appears in the footer section of the site.', 'basetheme'), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Footer 4' , 'basetheme'), 'id' => 'footer-4', 'description' => __( 'Appears in the footer section of the site.', 'basetheme'), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Footer 5' , 'basetheme'), 'id' => 'footer-5', 'description' => __( 'Appears in the footer section of the site.', 'basetheme'), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Mass Header Body' , 'basetheme'), 'id' => 'mass-header-body', 'description' => __( 'Appears in the top of header section of the site.', 'basetheme'), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Mass Footer Body' , 'basetheme'), 'id' => 'mass-footer-body', 'description' => __( 'Appears in the end of footer section of the site.', 'basetheme'), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Top HightLight' , 'basetheme'), 'id' => 'top-highlight-sidebar', 'description' => __( 'Appears in the top of main content section of the site.', 'basetheme'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Main Content Sidebar' , 'basetheme'), 'id' => 'main-content-sidebar', 'description' => __( 'Appears in the main column of the site.', 'basetheme'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Promo Sidebar' , 'basetheme'), 'id' => 'promo-sidebar', 'description' => __( 'Appears in the main content of the site.', 'basetheme'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Left One Half Sidebar' , 'basetheme'), 'id' => 'left-one-half-sidebar', 'description' => __( 'Appears wih one half of main content of the site.', 'basetheme'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Right One Half Sidebar' , 'basetheme'), 'id' => 'right-one-half-sidebar', 'description' => __( 'Appears wih one half of main content of the site.', 'basetheme'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Full Width Sidebar' , 'basetheme'), 'id' => 'fullwidth-sidebar', 'description' => __( 'Appears in the main content of the site.', 'basetheme'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Left One Third Sidebar' , 'basetheme'), 'id' => 'left-one-third-sidebar', 'description' => __( 'Appears in the main content of the site.', 'basetheme'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Right One Third Sidebar' , 'basetheme'), 'id' => 'right-one-third-sidebar', 'description' => __( 'Appears in the main content of the site.', 'basetheme'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Center One Third Sidebar' , 'basetheme'), 'id' => 'center-one-third-sidebar', 'description' => __( 'Appears in the main content of the site.', 'basetheme'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Contact Left Sidebar' , 'basetheme'), 'id' => 'contact-left-sidebar', 'description' => __( 'Appears in the contact page of the site.', 'basetheme'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Contact Right Sidebar' , 'basetheme'), 'id' => 'contact-right-sidebar', 'description' => __( 'Appears in the contact page of the site.', 'basetheme'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'WooCommerce Sidebar' , 'basetheme'), 'id' => 'woocommerce-sidebar', 'description' => __( 'Appears in the shop page of the site.', 'basetheme'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Parallax Sidebar' , 'basetheme'), 'id' => 'parallax-sidebar', 'description' => __( 'Appears in the about page of the site.', 'basetheme'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'About Main Sidebar' , 'basetheme'), 'id' => 'about-main-sidebar', 'description' => __( 'Appears in the about page of the site.', 'basetheme'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); } add_action( 'widgets_init', 'basetheme_fnc_registart_widgets_sidebars' ); /** * Register Roboto Google font for PrestaBase. * * @since PrestaBase 1.0 * * @return string */ function basetheme_fnc_font_url() { $fonts_url = ''; /* Translators: If there are characters in your language that are not * supported by Lora, translate this to 'off'. Do not translate * into your own language. */ $lora = _x( 'on', 'Hind font: on or off', 'basetheme' ); /* Translators: If there are characters in your language that are not * supported by Open Sans, translate this to 'off'. Do not translate * into your own language. */ $roboto = _x( 'on', 'Roboto font: on or off', 'basetheme' ); if ( 'off' !== $lora || 'off' !== $roboto ) { $font_families = array(); if ( 'off' !== $lora ) { $font_families[] = 'Montserrat:400,700'; } if ( 'off' !== $roboto ) { $font_families[] = 'Roboto:400,400italic,300,300italic,900,700italic,700,500'; } $query_args = array( 'family' => ( implode( '|', $font_families ) ), 'subset' => urlencode( 'latin,latin-ext' ), ); $protocol = is_ssl() ? 'https:' : 'http:'; $fonts_url = add_query_arg( $query_args, $protocol .'//fonts.googleapis.com/css' ); } return esc_url_raw( $fonts_url ); } /** * Enqueue scripts and styles for the front end. * * @since PrestaBase 1.0 */ function basetheme_fnc_scripts() { // Add Lato font, used in the main stylesheet. wp_enqueue_style( 'basetheme-roboto', basetheme_fnc_font_url(), array(), null ); // Add Genericons font, used in the main stylesheet. wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.0.3' ); // Load our main stylesheet. wp_enqueue_style( 'basetheme-style', get_stylesheet_uri() ); // Load the Internet Explorer specific stylesheet. wp_enqueue_style( 'basetheme-ie', get_template_directory_uri() . '/css/ie.css', array( 'basetheme-style' ), '20131205' ); wp_style_add_data( 'basetheme-ie', 'conditional', 'lt IE 9' ); // Load FlexSlider stylesheet wp_enqueue_style('basetheme-flexslider', get_template_directory_uri() . '/css/flexslider.css'); wp_enqueue_style('basetheme-fonticon', get_template_directory_uri() . '/css/font-awesome.css'); wp_enqueue_script( 'basetheme-bootstrap-min', get_template_directory_uri() . '/js/bootstrap.min.js', array( 'jquery' ), '20130402' ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } if ( is_singular() && wp_attachment_is_image() ) { wp_enqueue_script( 'basetheme-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20130402' ); } if ( is_active_sidebar( 'sidebar-3' ) ) { wp_enqueue_script( 'jquery-masonry' ); } if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) { wp_enqueue_script( 'basetheme-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20131205', true ); wp_localize_script( 'basetheme-slider', 'featuredSliderDefaults', array( 'prevText' => __( 'Previous', 'basetheme' ), 'nextText' => __( 'Next', 'basetheme' ) ) ); } wp_enqueue_script( 'basetheme-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150315', true ); wp_enqueue_script( 'basetheme-owl-carousel', get_template_directory_uri() . '/js/owl-carousel/owl.carousel.js', array( 'jquery' ), '20150315', true ); wp_enqueue_script('basetheme-flexslider', get_template_directory_uri() . '/js/jquery.flexslider.js', array('jquery'), '2.2.0', true); wp_enqueue_script('basetheme-custom-js', get_template_directory_uri() . '/js/custom.js', array('jquery'), '2.2.0', true); } add_action( 'wp_enqueue_scripts', 'basetheme_fnc_scripts' ); /** * Enqueue Google fonts style to admin screen for custom header display. * * @since PrestaBase 1.0 */ function basetheme_fnc_admin_fonts() { wp_enqueue_style( 'basetheme-lato', basetheme_fnc_font_url(), array(), null ); } add_action( 'admin_print_scripts-appearance_page_custom-header', 'basetheme_fnc_admin_fonts' ); /** * Implement rick meta box for post and page, custom post types. These 're used with metabox plugins */ if( is_admin() ){ basetheme_pbr_includes( get_template_directory() . '/inc/admin/metabox/*.php' ); } basetheme_pbr_includes( get_template_directory() . '/inc/classes/*.php' ); basetheme_pbr_includes( get_template_directory() . '/inc/*.php' ); /** * Register Widget */ //require get_template_directory() . '/includes/widgets.php'; basetheme_pbr_includes( get_template_directory() . '/inc/widgets/*.php' ); function basetheme_widgets() { register_widget( 'Prestabase_Articles_List_Widget' ); register_widget( 'Prestabase_Tagline_Widget' ); register_widget( 'Prestabase_Our_Service_Widget' ); register_widget( 'Prestabase_Products_List_Widget' ); register_widget( 'Prestabase_Products_Tabs_Widget' ); register_widget( 'Prestabase_Products_Category_Widget' ); // register_widget( 'Prestabase_Brands_Widget' ); // register_widget( 'Prestabase_Testimonials_Widget' ); // register_widget( 'Prestabase_Our_Team_Widget' ); } add_action( 'widgets_init', 'basetheme_widgets' ); function base_get_page_layout() { global $post; $layout = get_post_meta( $post->ID, 'layout_skin', 1 ); if ('right' == $layout) { $layout = 'right-sidebar'; } elseif ('left' == $layout) { $layout = 'left-sidebar'; } else { $layout = 'full-width'; } return 'templates/' . $layout; } function search_by_cat() { global $wp_query; if (is_search() && $_GET['post_type'] == 'product' && isset($_GET['product_category'])) { $cat = $_GET['product_category']; $cat = $cat ? $cat : ''; $wp_query->query_vars['product_cat'] = $cat; } } add_action('pre_get_posts', 'search_by_cat'); if(!function_exists('basetheme_pagination_nav')) { function basetheme_pagination_nav($per_page, $total, $max_num_pages=''){ ?>
'pull-left')); ?>
get( 'paged' ) ); $first = ( $per_page * $paged ) - $per_page + 1; $last = min( $total, $wp_query->get( 'posts_per_page' ) * $paged ); if ( 1 == $total ) { _e( 'Showing the single result', 'basetheme' ); } elseif ( $total <= $per_page || -1 == $per_page ) { printf( __( 'Showing all %d results', 'basetheme' ), $total ); } else { // $s = __( 'Showing %1$d – %2$d of %3$d results', '%1$d = first, %2$d = last, %3$d = total', 'basetheme' ); // printf( $s, $first, $last, $total ); } ?>
'')) { global $wp_query, $wp_rewrite; $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1; if($pages==''){ global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages) { $pages = 1; } } $pagination = array( 'base' => @add_query_arg('paged','%#%'), 'format' => '', 'total' => $pages, 'current' => $current, 'prev_text' => $prev, 'next_text' => $next, 'type' => 'array' ); if( $wp_rewrite->using_permalinks() ) $pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' ); if(isset( $_GET['s'])){ $cq = $_GET['s']; $sq = str_replace(" ", "+", $cq); } if( !empty($wp_query->query_vars['s']) ){ $pagination['add_args'] = array( 's' => $sq); } if(paginate_links( $pagination )!=''){ $paginations = paginate_links( $pagination ); echo ''; } } } if(!function_exists('basetheme_cartdropdown')){ function basetheme_cartdropdown(){ if(PBR_WOOCOMMERCE_ACTIVED){ global $woocommerce; ?>
%d '.__('items', 'basetheme').' - ', ' %d '.__('item', 'basetheme').' - ', $woocommerce->cart->cart_contents_count, 'basetheme'), $woocommerce->cart->cart_contents_count);?> cart->get_cart_total() ); ?>
'primary', 'theme_location' => 'primary', 'depth' => 2, 'container' => 'div', 'container_class' => 'collapse navbar-collapse navbar-ex1-collapse', 'menu_class' => 'nav navbar-nav', 'fallback_cb' => 'PrestaBase_Bootstrap_navwalker::fallback', 'walker' => new PrestaBase_Bootstrap_navwalker() )); } }