Пример #1
0
 function wpex_site_tracking_header()
 {
     $tracking = wpex_option('tracking');
     if ($tracking !== '') {
         echo wpex_option('tracking');
     }
 }
Пример #2
0
    function wpex_search_overlay()
    {
        // Do nothing if the main search is disabled
        if (wpex_option('main_search', '1') !== '1') {
            return;
        }
        // Only display on header style 1
        if (wpex_option('header_style', 'one') !== 'one') {
            return;
        }
        ob_start();
        ?>
			
			<span class="search-overlay"></span>
			<section id="site-searchform" class="header-one-searchform">
				<div id="site-searchform-title"><?php 
        _e('Search', 'wpex');
        ?>
</div>
				<div class="site-searchform-inner clr">
					<form method="get" action="<?php 
        echo esc_url(home_url('/'));
        ?>
" role="search">
						<input type="search" name="s" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" autocomplete="off" />
					</form>
				</div><!-- .site-searchform-inner -->
			</section><!-- #site-searchform -->
		<?php 
        echo ob_get_clean();
    }
Пример #3
0
    function wpex_footer_callout()
    {
        // Lets bail if the callout is disabled for this page/post --> see previous function
        if (wpex_display_callout() == false) {
            return;
        }
        // Get theme options
        $callout_text = wpex_option('callout_text');
        $callout_link = wpex_option('callout_link');
        $callout_link_txt = wpex_option('callout_link_txt');
        $callout_rel = wpex_option('callout_button_rel', 'dofollow');
        $callout_target = wpex_option('callout_button_target', 'blank');
        $rel = $callout_rel == 'nofollow' ? 'rel="nofollow"' : '';
        ob_start();
        ?>
		
			<div id="footer-callout-wrap" class="clr">
				<div id="footer-callout" class="clr container">
					<div id="footer-callout-left" class="clr <?php 
        if (wpex_option('callout_link') == '') {
            echo 'full-width';
        }
        ?>
">
						<?php 
        // Echo the footer callout text
        echo $callout_text;
        ?>
					</div><!-- #footer-callout-left -->
					<?php 
        // Display footer callout button if callout link & text options are not blank in the admin
        if ($callout_link && $callout_link_txt) {
            ?>
						<div id="footer-callout-right" class="">
							<a href="<?php 
            echo $callout_link;
            ?>
" class="theme-button" title="<?php 
            echo $callout_link_txt;
            ?>
" target="_<?php 
            echo $callout_target;
            ?>
" <?php 
            echo $rel;
            ?>
><?php 
            echo $callout_link_txt;
            ?>
</a>
						</div><!-- #footer-callout-right -->
					<?php 
        }
        ?>
				</div><!-- #footer-callout -->
			</div><!-- #footer-callout-wrap -->
			
		<?php 
        echo ob_get_clean();
    }
Пример #4
0
 function wpex_get_sidebar($sidebar = 'sidebar')
 {
     // Pages
     $custom_pages_sidebar = wpex_option('pages_custom_sidebar', '1');
     if (is_singular('pages') && $custom_pages_sidebar == '1') {
         return 'pages_sidebar';
     }
     // Staff
     $custom_staff_sidebar = wpex_option('staff_custom_sidebar', '1');
     if (is_singular('staff') && $custom_staff_sidebar == '1') {
         return 'staff_sidebar';
     }
     // Portfolio
     $custom_portfolio_sidebar = wpex_option('portfolio_custom_sidebar', '1');
     if (is_singular('portfolio') && $custom_portfolio_sidebar == '1') {
         return 'portfolio_sidebar';
     }
     // WooCommerce
     if (class_exists('Woocommerce')) {
         $woo_custom_sidebar = wpex_option('woo_custom_sidebar', '1');
         if ($woo_custom_sidebar == '1' && is_woocommerce()) {
             return 'woo_sidebar';
         }
     }
     // Return the correct sidebar name & add useful hook
     return apply_filters('wpex_get_sidebar', $sidebar);
 }
 function wpex_post_entry_author_avatar_enabled()
 {
     // Theme settings
     $author_avatar_toggle = wpex_option('blog_entry_author_avatar');
     $blog_style = wpex_option('blog_style');
     if ($author_avatar_toggle !== '1') {
         return false;
     }
     if (!is_category() && $blog_style !== 'large-image-entry-style') {
         return false;
     }
     // Category settings
     if (is_category()) {
         $term = get_query_var('cat');
         $term_data = get_option("category_{$term}");
         if (isset($term_data['wpex_term_style'])) {
             if ($term_data['wpex_term_style'] !== '') {
                 $blog_style = $term_data['wpex_term_style'];
             }
         }
         if ($blog_style !== 'large-image-entry-style') {
             return false;
         }
     }
     // End if category check
     return true;
     // If all else fails return true
 }
 function wpex_blog_exclude_categories()
 {
     // Wait..we don't want to be in these plages? Lets leave now!
     if (is_admin()) {
         return;
     }
     if (is_search()) {
         return;
     }
     if (is_archive()) {
         return;
     }
     // Categories to exclude
     $cats_to_exclude = wpex_option('blog_cats_exclude');
     // Admin option is blank, so bail.
     if ($cats_to_exclude == '') {
         return;
     }
     // Blog template
     if (is_home() && !is_singular('page')) {
         $exclude = $cats_to_exclude;
     } else {
         return;
         // Do nothing, ok?
     }
     if ($cats_to_exclude) {
         set_query_var('category__not_in', $cats_to_exclude);
     }
 }
Пример #7
0
    function wpex_post_meta()
    {
        global $post;
        $post_id = $post->ID;
        $category = get_the_category();
        $fist_category = $category[0];
        ob_start();
        ?>
		
		<ul class="meta clr">
			<li class="meta-date"><span class="fa fa-clock-o"></span><?php 
        echo get_the_date();
        ?>
</li>
			<?php 
        if ($fist_category) {
            ?>
				<li class="meta-category"><span class="fa fa-folder-o"></span><a href="<?php 
            echo get_category_link($category[0]->term_id);
            ?>
" title="<?php 
            echo $category[0]->cat_name;
            ?>
"><?php 
            echo $category[0]->cat_name;
            ?>
</a></li>
			<?php 
        }
        ?>
			<?php 
        if (comments_open()) {
            ?>
				<li class="meta-comments comment-scroll"><span class="fa fa-comment-o"></span><?php 
            comments_popup_link(__('0 Comments', 'wpex'), __('1 Comment', 'wpex'), __('% Comments', 'wpex'), 'comments-link');
            ?>
</li>
			<?php 
        }
        ?>
			<?php 
        if (is_singular('post') && wpex_option('post_next_prev_meta', '1') == '1') {
            ?>
				<li id="single-post-next-prev" class="clr">
					<?php 
            next_post_link('%link', '<span class="theme-button"><span class="fa fa-chevron-left"></span></span>');
            ?>
					<?php 
            previous_post_link('%link', '<span class="theme-button"><span class="fa fa-chevron-right"></span></span>');
            ?>
				</li><!-- #single-post-next-prev -->
			<?php 
        }
        ?>
		</ul>
		
		<?php 
        echo ob_get_clean();
    }
Пример #8
0
 function wpex_custom_testimonials_args($args)
 {
     //post name based on theme options
     $post_type_name = wpex_option('testimonials_labels', __('Testimonials', 'wpex'));
     $post_slug = wpex_option('testimonials_slug', 'testimonial-item');
     $labels = array('name' => $post_type_name, 'singular_name' => $post_type_name . ' ' . __('Item', 'wpex'), 'add_new' => __('Add New Item', 'wpex'), 'add_new_item' => __('Add New', 'wpex') . ' ' . $post_type_name . ' ' . __('Item', 'wpex'), 'edit_item' => __('Edit New', 'wpex') . ' ' . $post_type_name . ' ' . __('Item', 'wpex'), 'new_item' => __('Add New', 'wpex') . ' ' . $post_type_name . ' ' . __('Item', 'wpex'), 'view_item' => __('View Item', 'wpex'), 'search_items' => __('Search', 'wpex') . $post_type_name, 'not_found' => __('No', 'wpex') . ' ' . $post_type_name . ' ' . __('items found', 'wpex'), 'not_found_in_trash' => __('No', 'wpex') . ' ' . $post_type_name . ' ' . __('items found in the trash', 'wpex'));
     $custom_args = array('labels' => $labels, 'rewrite' => array("slug" => $post_slug));
     return $custom_args + $args;
 }
Пример #9
0
 function wpex_remove_wp_ver_css_js($src)
 {
     if (wpex_option('remove_scripts_version', '1') == '1') {
         if (strpos($src, 'ver=')) {
             $src = remove_query_arg('ver', $src);
         }
     }
     return $src;
 }
Пример #10
0
 function wpex_custom_testimonials_category_args($args)
 {
     //post name based on theme options
     $post_type_name = wpex_option('testimonials_labels', 'Testimonials') ? wpex_option('testimonials_labels', 'Testimonials') : 'Testimonials';
     $tax_slug = wpex_option('testimonials_cat_slug', 'testimonials-category') ? wpex_option('testimonials_cat_slug', 'testimonials-category') : 'testimonials-category';
     $taxonomy_testimonials_category_labels = array('name' => $post_type_name . ' ' . __('Categories', 'wpex'), 'singular_name' => $post_type_name . ' ' . __('Category', 'wpex'), 'search_items' => __('Search', 'wpex') . ' ' . $post_type_name . ' ' . __('Category', 'wpex'), 'popular_items' => __('Popular', 'wpex') . ' ' . $post_type_name . ' ' . __('Categories', 'wpex'), 'all_items' => __('All', 'wpex') . ' ' . $post_type_name . ' ' . __('Categories', 'wpex'), 'parent_item' => __('Parent', 'wpex') . ' ' . $post_type_name . ' ' . __('Category', 'wpex'), 'parent_item_colon' => __('Parent', 'wpex') . ' ' . $post_type_name . ' ' . __('Category', 'wpex'), 'edit_item' => __('Edit', 'wpex') . ' ' . $post_type_name . ' ' . __('Category', 'wpex'), 'update_item' => __('Update', 'wpex') . ' ' . $post_type_name . ' ' . __('Category', 'wpex'), 'add_new_item' => __('Add New', 'wpex') . ' ' . $post_type_name . ' ' . __('Category', 'wpex'), 'new_item_name' => __('New', 'wpex') . ' ' . $post_type_name . ' ' . __('Category name', 'wpex'), 'separate_items_with_commas' => __('Seperate', 'wpex') . ' ' . $post_type_name . ' ' . __('categories with commas', 'wpex'), 'add_or_remove_items' => __('Add or remove', 'wpex') . ' ' . $post_type_name . ' ' . __('categories', 'wpex'), 'choose_from_most_used' => __('Choose from the most used', 'wpex') . ' ' . $post_type_name . ' ' . __('categories', 'wpex'), 'menu_name' => $post_type_name . ' ' . __('Categories', 'wpex'));
     $custom_taxonomy_testimonials_category_args = array('labels' => $taxonomy_testimonials_category_labels, 'rewrite' => array('slug' => $tax_slug));
     return $custom_taxonomy_testimonials_category_args + $args;
 }
Пример #11
0
 function wpex_get_post_layout_class()
 {
     // Vars
     $class = 'right-sidebar';
     $post_types = get_post_types('', 'names');
     $blog_archives_layout = wpex_option('blog_archives_layout', 'right-sidebar');
     // Loop through post types
     foreach ($post_types as $post_type) {
         if (is_singular($post_type)) {
             if ($post_type == 'post') {
                 $post_type = 'blog';
             }
             global $post;
             $post_id = $post->ID;
             $admin_id = $post_type . '_single_layout';
             $admin_setting = wpex_option($admin_id, 'right-sidebar');
             $meta = get_post_meta($post_id, 'wpex_post_layout', true);
             if ($meta !== '') {
                 $class = $meta;
             } else {
                 $class = $admin_setting;
             }
         }
     }
     // Archives
     if (is_archive() || is_author() || is_page_template('templates/blog.php')) {
         $class = $blog_archives_layout;
     }
     // Cats
     if (is_category()) {
         $term = get_query_var('cat');
         $term_data = get_option("category_{$term}");
         if ($term_data) {
             if ($term_data['wpex_term_layout'] !== '') {
                 $class = $term_data['wpex_term_layout'];
             }
         } else {
             $class = $blog_archives_layout;
         }
     }
     // Portfolio tax
     if (is_tax('portfolio_category') || is_tax('portfolio_tag')) {
         $class = wpex_option('portfolio_archive_layout', 'full-width');
     }
     // Staff tax
     if (is_tax('staff_category') || is_tax('staff_tag')) {
         $class = wpex_option('staff_archive_layout', 'full-width');
     }
     // Testimonials tax
     if (is_tax('testimonials_category') || is_tax('testimonials_tag')) {
         $class = wpex_option('testimonials_archive_layout', 'full-width');
     }
     // Return the correct class name
     $class = apply_filters('wpex_post_layout_class', $class);
     return $class;
 }
Пример #12
0
 function wpex_footer_copyright()
 {
     $output;
     $copyright = wpex_option('footer_copyright');
     $copyright_content = wpex_option('footer_copyright_text');
     if ($copyright !== '1') {
         return;
     }
     $output = do_shortcode($copyright_content);
     $output = apply_filters('wpex_copyright_info', $output);
     echo $output;
 }
Пример #13
0
 function wpex_get_header_style($style = 'one')
 {
     $style = wpex_option('header_style', 'one');
     if (is_singular()) {
         global $post;
         $post_id = $post->ID;
         $meta = get_post_meta($post_id, 'wpex_header_style', true);
         if ($meta) {
             $style = $meta;
         }
     }
     return $style;
 }
Пример #14
0
    function wpex_layout_css()
    {
        $custom_css = '';
        // Main Container With
        $main_container_width = wpex_option('main_container_width');
        if ($main_container_width !== '' && $main_container_width !== '980px') {
            $custom_css .= '@media only screen and (min-width: 960px) {
				.container, .wpb_row .wpb_row, .vc_row-fluid.container, .boxed-main-layout #wrap { width: ' . $main_container_width . '; }
				.boxed-main-layout .is-sticky #site-header { width: ' . $main_container_width . '; }
			}';
        }
        // Left container width
        $left_container_width = wpex_option('left_container_width');
        if ($left_container_width !== '' && $left_container_width !== '680px') {
            $custom_css .= '@media only screen and (min-width: 960px) {
				.content-area { width: ' . $left_container_width . '; }
			}';
        }
        // Sidebar width
        $sidebar_width = wpex_option('sidebar_width');
        if ($sidebar_width !== '' && $sidebar_width !== '260px') {
            $custom_css .= '@media only screen and (min-width: 960px) {#sidebar { width: ' . $sidebar_width . '; }}';
        }
        // Header Top Padding
        $header_top_padding = wpex_option('header_top_padding');
        if ($header_top_padding !== '' && $header_top_padding !== '30px') {
            $custom_css .= '#site-header-inner { padding-top: ' . intval($header_top_padding) . 'px; }';
        }
        // Header Bottom Padding
        $header_bottom_padding = wpex_option('header_bottom_padding');
        if ($header_bottom_padding !== '' && $header_bottom_padding !== '30px') {
            $custom_css .= '#site-header-inner { padding-bottom: ' . intval($header_bottom_padding) . 'px; }';
        }
        // Logo top margin
        $logo_top_margin = wpex_option('logo_top_margin');
        if ($logo_top_margin !== '' && $logo_top_margin !== '0px') {
            $custom_css .= '#site-logo { margin-top: ' . intval($logo_top_margin) . 'px; }';
        }
        // Logo bottom margin
        $logo_bottom_margin = wpex_option('logo_bottom_margin');
        if ($logo_bottom_margin !== '' && $logo_bottom_margin !== '0px') {
            $custom_css .= '#site-logo { margin-bottom: ' . intval($logo_bottom_margin) . 'px; }';
        }
        // trim white space for faster page loading
        $custom_css_trimmed = preg_replace('/\\s+/', ' ', $custom_css);
        // output css on front end
        $css_output = "<!-- Custom CSS -->\n<style type=\"text/css\">\n" . $custom_css_trimmed . "\n</style>";
        if (!empty($custom_css)) {
            echo $css_output;
        }
    }
Пример #15
0
    function wpex_mobile_menu()
    {
        // If responsive is disabled, bail
        if (wpex_option('responsive', '1') !== '1') {
            return false;
        }
        // Vars
        $mobile_menu_contact = wpex_option('mobile_menu_contact');
        $mobile_menu_rss = wpex_option('mobile_menu_rss');
        ob_start();
        ?>
		
		<!-- Mobile navigation -->
		<div id="sidr-close">
			<a href="#sidr-close" class="toggle-sidr-close"></a>
		</div>
		<div id="mobile-menu" class="clr">
			<a href="#sidr" class="mobile-menu-toggle"><span class="fa fa-bars"></span></a>
			<?php 
        // Display items from the mobile menu
        $menu_name = 'mobile_menu';
        if (($locations = get_nav_menu_locations()) && isset($locations[$menu_name])) {
            $menu = wp_get_nav_menu_object($locations[$menu_name]);
            $menu_items = wp_get_nav_menu_items($menu->term_id);
            foreach ((array) $menu_items as $key => $menu_item) {
                $title = $menu_item->title;
                $url = $menu_item->url;
                $attr_title = $menu_item->attr_title;
                ?>
					<a href="<?php 
                echo $url;
                ?>
" title="<?php 
                echo $attr_title;
                ?>
" class="mobile-menu-extra-icons mobile-menu-<?php 
                echo $title;
                ?>
"><span class="fa fa-<?php 
                echo $title;
                ?>
"></span></a>
				<?php 
            }
        }
        ?>
		</div><!-- #mobile-menu -->

		<?php 
        echo ob_get_clean();
    }
Пример #16
0
 function wpex_custom_css()
 {
     $custom_css = '';
     if (wpex_option('custom_css') !== '') {
         $custom_css .= wpex_option('custom_css');
     }
     // trim white space for faster page loading
     $custom_css_trimmed = preg_replace('/\\s+/', ' ', $custom_css);
     // output css on front end
     $css_output = "<!-- Custom CSS -->\n<style type=\"text/css\">\n" . $custom_css_trimmed . "\n</style>";
     if (!empty($custom_css)) {
         echo $css_output;
     }
 }
Пример #17
0
 function wpex_tweak_testimonials_args($args)
 {
     // Vars
     $search = wpex_option('testimonials_search', '1');
     $menu_icon = wpex_option('testimonials_admin_icon', false, 'url');
     // Tweaks
     if ($search !== '1') {
         $args['exclude_from_search'] = true;
     }
     if ($menu_icon !== '') {
         $args['menu_icon'] = $menu_icon;
     }
     return $args;
 }
Пример #18
0
 function wpex_responsive_widths()
 {
     if (wpex_option('custom_mobile_widths', '1') !== '1') {
         return;
     }
     $custom_css = '';
     // Tablet Widths
     $tablet_main_container_width = wpex_option('tablet_main_container_width');
     $tablet_main_container_width = $tablet_main_container_width !== '700px' ? $tablet_main_container_width : '';
     $tablet_left_container_width = wpex_option('tablet_left_container_width');
     $tablet_left_container_width = $tablet_left_container_width !== '440px' ? $tablet_left_container_width : '';
     $tablet_sidebar_width = wpex_option('tablet_sidebar_width');
     $tablet_sidebar_width = $tablet_sidebar_width !== '220px' ? $tablet_sidebar_width : '';
     if ($tablet_main_container_width || $tablet_left_container_width || $tablet_sidebar_width) {
         $custom_css .= '@media only screen and (min-width: 768px) and (max-width: 959px) {';
         if ($tablet_main_container_width) {
             $custom_css .= '.container, .wpb_row .wpb_row, .vc_row-fluid.container { width: ' . $tablet_main_container_width . '; }';
         }
         if ($tablet_left_container_width) {
             $custom_css .= '.content-area { width: ' . $tablet_left_container_width . ' !important; }';
         }
         if ($tablet_sidebar_width) {
             $custom_css .= '#sidebar { width: ' . $tablet_sidebar_width . ' !important; }';
         }
         $custom_css .= '}';
     }
     // Mobile Portrait
     $mobile_portrait_main_container_width = wpex_option('mobile_portrait_main_container_width');
     $mobile_portrait_main_container_width = $mobile_portrait_main_container_width !== '90%' ? $mobile_portrait_main_container_width : '';
     if ($mobile_portrait_main_container_width) {
         $custom_css .= '@media only screen and (max-width: 767px) { .container, .wpb_row .wpb_row, .vc_row-fluid.container { width: ' . $mobile_portrait_main_container_width . ' !important; min-width: 0; } }';
     }
     // Mobile Landscape
     $mobile_landscape_main_container_width = wpex_option('mobile_landscape_main_container_width');
     $mobile_landscape_main_container_width = $mobile_landscape_main_container_width !== '480px' ? $mobile_landscape_main_container_width : '';
     if ($mobile_landscape_main_container_width) {
         $custom_css .= '@media only screen and (min-width: 480px) and (max-width: 767px) { .container, .wpb_row .wpb_row, .vc_row-fluid.container { width: ' . $mobile_landscape_main_container_width . ' !important; } }';
     }
     // trim white space for faster page loading
     $custom_css_trimmed = preg_replace('/\\s+/', ' ', $custom_css);
     // output css on front end
     $css_output = "<!-- Custom CSS -->\n<style type=\"text/css\">\n" . $custom_css_trimmed . "\n</style>";
     if (!empty($custom_css)) {
         echo $css_output;
     }
 }
Пример #19
0
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     $id_field = $this->db_fields['id'];
     if (!empty($children_elements[$element->{$id_field}]) && $depth == 0) {
         $element->classes[] = 'dropdown';
         if (wpex_option('menu_arrow_down', '0') == '1') {
             $element->title .= ' <span class="nav-arrow fa fa-angle-down"></span>';
         }
     }
     if (!empty($children_elements[$element->{$id_field}]) && $depth > 0) {
         $element->classes[] = 'dropdown';
         if (wpex_option('menu_arrow_side', '1') == '1') {
             $element->title .= ' <span class="nav-arrow fa fa-angle-right"></span>';
         }
     }
     Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
Пример #20
0
 function wpex_post_entry_classes($classes)
 {
     // Post Data
     global $post;
     $post_id = $post->ID;
     $post_type = get_post_type($post_id);
     // Only add classes to standard post type
     if ($post_type !== 'post') {
         return $classes;
     }
     // Main vars
     $blog_style = 'large-image';
     $grid_columns = 'span_1_of_2';
     $admin_blog_style = wpex_option('blog_style', 'large-image');
     $admin_grid_columns = wpex_option('blog_grid_columns', '2');
     // Main Classes
     $classes[] = 'blog-entry clr';
     // Blog Styles
     if (is_category()) {
         $term = get_query_var('cat');
         $term_data = get_option("category_{$term}");
         $term_style = '';
         $grid_columns = '';
         if ($term_data) {
             if (isset($term_data['wpex_term_style'])) {
                 $term_style = $term_data['wpex_term_style'] !== '' ? $term_data['wpex_term_style'] . '' : '';
             }
             if (isset($term_data['wpex_term_grid_cols'])) {
                 $grid_columns = $term_data['wpex_term_grid_cols'] !== '' ? $term_data['wpex_term_grid_cols'] . '' : '';
             }
         }
         $blog_style = $term_style !== '' ? $term_style . '-entry-style' : $admin_blog_style;
         $grid_columns = $grid_columns !== '' ? $grid_columns : $admin_grid_columns;
     } else {
         $blog_style = $admin_blog_style;
         $grid_columns = $admin_grid_columns;
     }
     // Add columns for grid style entries
     if ($blog_style == 'grid-entry-style') {
         $classes[] = wpex_grid_class($grid_columns);
     }
     // Return classes based on admin setting
     $classes[] = $blog_style;
     return $classes;
 }
Пример #21
0
 function wpex_blog_wrap_classes($classes = false)
 {
     // Return custom class if set
     if ($classes !== false) {
         return $class;
     }
     // Admin defaults
     $style = wpex_option('blog_style');
     $pagination = wpex_option('blog_pagination_style');
     $author_avatars = wpex_option('blog_entry_author_avatar');
     // Category options
     if (is_category()) {
         // Get taxonomy meta
         $term = get_query_var('cat');
         $term_data = get_option("category_{$term}");
         if (isset($term_data['wpex_term_style'])) {
             $term_style = $term_data['wpex_term_style'] !== '' ? $term_data['wpex_term_style'] . '' : $wpex_term_style;
         }
         if (isset($term_data['wpex_term_pagination'])) {
             $term_pagination = $term_data['wpex_term_pagination'] !== '' ? $term_data['wpex_term_pagination'] . '' : '';
         }
         if ($term_style) {
             $style = $term_style . '-entry-style';
         }
         if ($term_pagination) {
             $pagination = $term_pagination;
         }
     }
     // Isotope classes
     if ($style == 'grid-entry-style') {
         $classes .= 'wpex-masonry-grid blog-masonry-grid ';
     }
     // Add some margin when author is enabled
     if ($style == 'grid-entry-style' && $author_avatars == '1') {
         $classes .= 'grid-w-avatars';
     }
     // Infinite scroll classes
     if ($pagination == 'infinite_scroll') {
         $classes .= 'infinite-scroll-wrap';
     }
     // Return classes -------------------------------------------------------------------------- >
     echo $classes;
 }
Пример #22
0
 function wpex_post_readmore_link($text = false)
 {
     global $post;
     $post_id = $post->ID;
     $permalink = get_permalink($post_id);
     $text = $text ? $text : apply_filters('wpex_post_readmore_link_text', __('Continue Reading', 'wpex') . ' &rarr;');
     $output = '';
     // Display read more link if entries are enabled and it's not a password protected post
     if (wpex_option('blog_exceprt', '1') == '1' && wpex_option('blog_entry_readmore', '1') == '1' && !post_password_required()) {
         // The readmore link output
         $output .= '<div class="blog-entry-readmore clr">';
         $output .= '<a href="' . $permalink . '" class="theme-button" title="' . $text . '">' . $text . '</a>';
         $output .= '</div>';
     } else {
         return;
         // nada
     }
     echo $output;
 }
Пример #23
0
 function wpex_woo_layout_class()
 {
     $woo_shop_layout = wpex_option('woo_shop_layout', 'full-width');
     $woo_product_layout = wpex_option('woo_product_layout', 'full-width');
     $classes = array();
     // Main Shop & archives
     if (is_shop() || is_product_category() || is_product_tag()) {
         $classes[] = $woo_shop_layout;
     }
     // Single Products
     if (is_singular('product')) {
         $classes[] = $woo_product_layout;
     }
     // Filter for devs
     $classes = apply_filters('wpex_woo_wrap_classes', $classes);
     // Ninja work
     $classes = implode(" ", $classes);
     // Return classes
     return $classes;
 }
Пример #24
0
    function wpex_cart_widget()
    {
        // WooCommerce is not active, so bail
        if (!class_exists('Woocommerce')) {
            return;
        }
        // If disabled bail
        if (wpex_option('woo_menu_icon', '1') !== '1') {
            return;
        }
        // Globals & vars
        global $woocommerce;
        $shop_page_url = get_permalink(woocommerce_get_page_id('shop'));
        $cart_contents_count = $woocommerce->cart->cart_contents_count;
        // Not needed on checkout
        if (is_checkout()) {
            return false;
        }
        // Not needed on cart page when items exist
        if (is_cart() && sizeof($cart_contents_count) !== 0) {
            return false;
        }
        ob_start();
        ?>
		
		<section id="current-shop-items" class="clr">
			<div id="current-shop-items-inner" class="clr">
				<?php 
        // Display WooCommerce cart
        if (version_compare(WOOCOMMERCE_VERSION, "2.0.0") >= 0) {
            the_widget('WC_Widget_Cart', 'title= ');
        } else {
            the_widget('WooCommerce_Widget_Cart', 'title= ');
        }
        ?>
			</div><!-- #current-shop-items-inner -->
		</section><!-- #current-shop-items -->
		
	<?php 
        echo ob_get_clean();
    }
Пример #25
0
 function wpex_custom_background()
 {
     // VARS
     $background_color = wpex_option('background_color');
     $background_image_toggle = wpex_option('background_image_toggle');
     $background_image = wpex_option('background_image', '', 'url');
     $background_style = wpex_option('background_style');
     $background_pattern_toggle = wpex_option('background_pattern_toggle');
     $background_pattern = wpex_option('background_pattern');
     $css = '';
     // Color
     if ($background_color) {
         $css .= 'body, .boxed-main-layout { background-color: ' . $background_color . '; }';
     }
     // Image
     if ($background_image && $background_image_toggle && $background_pattern_toggle !== '1') {
         $css .= 'body { background-image: url(' . $background_image . '); }';
         if ($background_style) {
             if ($background_style == 'stretched') {
                 $css .= 'body { -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; background-position: center center; background-attachment:fixed; background-repeat: no-repeat; }';
             }
             if ($background_style == 'repeat') {
                 $css .= 'body { background-repeat: repeat; }';
             }
             if ($background_style == 'fixed') {
                 $css .= 'body { background-repeat: no-repeat; background-position: center center; background-attachment:fixed; }';
             }
         }
     }
     // Pattern
     if ($background_pattern && $background_pattern_toggle == '1') {
         $css .= 'body { background-image: url(' . $background_pattern . '); background-repeat: repeat; }';
     }
     // trim white space for faster page loading
     $css = preg_replace('/\\s+/', ' ', $css);
     // output css on front end
     $output = "<!-- Custom CSS -->\n<style type=\"text/css\">\n" . $css . "\n</style>";
     if (!empty($output)) {
         echo $output;
     }
 }
Пример #26
0
 function wpex_body_classes($classes)
 {
     // WPExplorer class
     $classes[] = 'wpex-theme';
     // Layout Style
     if (!is_singular('page')) {
         $classes[] = wpex_option('main_layout_style', 'full-width') . '-main-layout';
     } else {
         global $post;
         $meta = get_post_meta($post->ID, 'wpex_main_layout', true);
         if ($meta !== '') {
             $classes[] = $meta . '-main-layout';
         } else {
             $classes[] = wpex_option('main_layout_style', 'full-width') . '-main-layout';
         }
     }
     // Responsive
     if (wpex_option('responsive', '1') == '1') {
         $classes[] = 'wpex-responsive';
     }
     // Remove header bottom margin
     if (is_singular()) {
         global $post;
         $disable_header_margin = get_post_meta($post->ID, 'wpex_disable_header_margin', true);
         $slider = get_post_meta($post->ID, 'wpex_post_slider_shortcode', true);
         if ($disable_header_margin == 'on' || $slider) {
             $classes[] = 'no-header-margin';
         }
     }
     // WooCommerce
     if (class_exists('Woocommerce')) {
         if (wpex_option('woo_shop_slider') !== '' && is_shop()) {
             $classes[] = 'page-with-slider';
         }
         if (wpex_option('woo_shop_title', '1') !== '1' && is_shop()) {
             $classes[] = 'page-without-title';
         }
     }
     return $classes;
 }
Пример #27
0
 function wpex_posts_per_page($value)
 {
     global $wpex_posts_per_page;
     // Portfolio Pagination
     if (is_tax('portfolio_category') || is_tax('portfolio_tag') || is_post_type_archive('portfolio')) {
         return wpex_option('portfolio_pagination', '8');
     }
     // Staff Pagination
     if (is_tax('staff_category') || is_tax('staff_tag') || is_post_type_archive('staff')) {
         return wpex_option('staff_pagination', '-1');
     }
     // Testimonials Pagination
     if (is_tax('testimonials_category') || is_tax('testimonials_tag') || is_post_type_archive('testimonials')) {
         return wpex_option('testimonials_pagination', '-1');
     }
     // Search pagination
     if (is_search()) {
         return wpex_option('search_pagination', '10');
     }
     // Category pagination
     $terms = get_terms('category');
     foreach ($terms as $term) {
         if (is_category($term->slug)) {
             $term_id = $term->term_id;
             $term_data = get_option("category_{$term_id}");
             if ($term_data) {
                 if (isset($term_data['wpex_term_posts_per_page'])) {
                     $term_posts_per_page = $term_data['wpex_term_posts_per_page'] !== '' ? $term_data['wpex_term_posts_per_page'] . '' : '';
                     return $term_posts_per_page !== '' ? $term_posts_per_page : $wpex_posts_per_page;
                 } else {
                     return $wpex_posts_per_page;
                 }
             } else {
                 return $wpex_posts_per_page;
             }
         }
     }
     // Everything else
     return $wpex_posts_per_page;
 }
Пример #28
0
    function wpex_retina_logo()
    {
        $logo_url = wpex_option('retina_logo', '', 'url');
        $logo_width = wpex_option('retina_logo_width');
        $logo_height = wpex_option('retina_logo_height');
        $logo_width = preg_replace('#[^0-9]#', '', strip_tags($logo_width));
        $logo_height = preg_replace('#[^0-9]#', '', strip_tags($logo_height));
        if ($logo_url !== '' && $logo_width !== '' && $logo_height !== '') {
            $output = '<!-- Retina Logo -->
			<script type="text/javascript">
				jQuery(function($){
					if (window.devicePixelRatio == 2) {
						$("#masthead .logo img").attr("src", "' . $logo_url . '");
						$("#masthead .logo img").attr("width", "' . $logo_width . '");
						$("#masthead .logo img").attr("height", "' . $logo_height . '");
					 }
				});
			</script>';
            $output = preg_replace('/\\s+/', ' ', $output);
            echo $output;
        }
    }
Пример #29
0
 function wpex_favicons_apple_icons()
 {
     // Vars
     $output = '';
     $favicon = wpex_option('favicon', '', 'url');
     $iphone_icon = wpex_option('iphone_icon', '', 'url');
     $iphone_icon_retina = wpex_option('iphone_icon_retina', '', 'url');
     $ipad_icon = wpex_option('ipad_icon', '', 'url');
     $ipad_icon_retina = wpex_option('ipad_icon_retina', '', 'url');
     // Favicon
     if ($favicon) {
         $output .= '<!-- Favicon -->';
         $output .= '<link rel="shortcut icon" href="' . $favicon . '">';
     }
     // Apple iPhone Icon
     if ($iphone_icon) {
         $output .= '<!-- Apple iPhone Icon -->';
         $output .= '<link rel="apple-touch-icon-precomposed" href="' . $iphone_icon . '">';
     }
     // Apple iPhone Retina Icon
     if ($iphone_icon_retina) {
         $output .= '<!-- Apple iPhone Retina Icon -->';
         $output .= '<link rel="apple-touch-icon-precomposed" sizes="114x114" href="' . $iphone_icon_retina . '">';
     }
     // Apple iPad Icon
     if ($ipad_icon) {
         $output .= '<!-- Apple iPhone Icon -->';
         $output .= '<link rel="apple-touch-icon-precomposed" sizes="72x72" href="' . $ipad_icon . '">';
     }
     // Apple iPad Retina Icon
     if ($ipad_icon_retina && !$iphone_icon_retina) {
         $output .= '<!-- Apple iPhone Icon -->';
         $output .= '<link rel="apple-touch-icon-precomposed" sizes="114x114" href="' . $ipad_icon_retina . '">';
     }
     echo $output;
 }
Пример #30
-1
 function woocommerce_output_upsells()
 {
     $woo_product_layout = wpex_option('woo_product_layout', 'full-width');
     $columns = wpex_option('woocommerce_upsell_columns', '4');
     if (is_singular() && $woo_product_layout != 'full-width') {
         $columns = wpex_option('woocommerce_with_sidebar_upsell_columns', '3');
     }
     woocommerce_upsell_display($columns, $columns);
 }