function wpex_remove_cpt_slug($post_link, $post, $leavename)
 {
     // Theme post types
     $post_types = array('portfolio', 'staff', 'testimonials');
     // If not part of the theme post types return default post link
     if (!in_array($post->post_type, $post_types) || 'publish' != $post->post_status) {
         return $post_link;
     }
     // Loop through post types and remove the current slug
     foreach ($post_types as $post_type) {
         if ('portfolio' == $post_type) {
             $slug = wpex_get_mod('portfolio_slug', 'portfolio-item');
         }
         if ('staff' == $post_type) {
             $slug = wpex_get_mod('staff_slug', 'staff-member');
         }
         if ('testimonials' == $post_type) {
             $slug = wpex_get_mod('testimonials_slug', 'testimonial');
         }
         // Remove current slug
         $post_link = str_replace('/' . $slug . '/', '/', $post_link);
     }
     // Return new post link without slug
     return $post_link;
 }
Example #2
0
 /**
  * Localize scripts
  *
  * @since 2.1.0
  */
 public function localize($array)
 {
     // Add lightbox settings to array
     $array['iLightbox'] = array('auto' => wpex_get_mod('lightbox_auto', false), 'skin' => wpex_global_obj('lightbox_skin'), 'path' => 'horizontal', 'controls' => array('arrows' => wpex_get_mod('lightbox_arrows', true), 'thumbnail' => wpex_get_mod('lightbox_thumbnails', true), 'fullscreen' => wpex_get_mod('lightbox_fullscreen', true), 'mousewheel' => wpex_get_mod('lightbox_mousewheel', false)), 'effects' => array('loadedFadeSpeed' => 50, 'fadeSpeed' => 500), 'show' => array('title' => wpex_get_mod('lightbox_titles', true), 'speed' => 200), 'hide' => array('speed' => 200), 'overlay' => array('blur' => true, 'opacity' => 0.9), 'social' => array('start' => true, 'show' => 'mouseenter', 'hide' => 'mouseleave', 'buttons' => false));
     // Return array
     return $array;
 }
 /**
  * Remove slugs from the post types
  *
  * @since 2.0.0
  */
 public function remove_slugs($post_link, $post, $leavename)
 {
     // If not part of the theme post types return default post link
     if (!in_array($post->post_type, $this->post_types) || 'publish' != $post->post_status) {
         return $post_link;
     }
     // Get the post type slug
     if ('portfolio' == $post->post_type) {
         $slug = wpex_get_mod('portfolio_slug', 'portfolio-item');
         $slug = $slug ? $slug : 'portfolio-item';
     } elseif ('staff' == $post->post_type) {
         $slug = wpex_get_mod('staff_slug');
         $slug = $slug ? $slug : 'staff-member';
     } elseif ('testimonials' == $post->post_type) {
         $slug = wpex_get_mod('testimonials_slug', 'testimonial');
         $slug = $slug ? $slug : 'testimonial';
     } else {
         $slug = '';
     }
     // Remove current slug
     if ($slug) {
         $post_link = str_replace('/' . $slug . '/', '/', $post_link);
     }
     // Return new post link without slug
     return $post_link;
 }
Example #4
0
 /**
  * Alter main sidebar to display bbpress_sidebar sidebar
  *
  * @access public
  * @since  2.1.0
  */
 public function display_sidebar($sidebar)
 {
     if (is_bbpress() && wpex_get_mod('bbpress_custom_sidebar', true)) {
         $sidebar = 'bbpress_sidebar';
     }
     return $sidebar;
 }
Example #5
0
 /**
  * Generates the CSS output
  *
  * @since 2.0.0
  */
 public static function generate($output)
 {
     // Define main variables
     $css = '';
     // Fix for Fonts In the Visual Composer
     if (wpex_global_obj('vc_is_inline')) {
         $css .= '.wpb_row .fa:before { box-sizing:content-box!important; -moz-box-sizing:content-box!important; -webkit-box-sizing:content-box!important; }';
     }
     // Fixes for full-width layout when custom background is added
     if ('full-width' == wpex_global_obj('main_layout') && (wpex_get_mod('background_color') || wpex_get_mod('background_image'))) {
         $css .= '.wpex-sticky-header-holder{background:none;}';
     }
     // Remove header border if custom color is set
     if (wpex_get_mod('header_background')) {
         $css .= '.is-sticky #site-header{border-color:transparent;}';
     }
     // Overlay Header font size
     if (wpex_global_obj('has_overlay_header') && ($font_size = get_post_meta(wpex_global_obj('post_id'), 'wpex_overlay_header_font_size', true))) {
         $css .= '#site-navigation, #site-navigation .dropdown-menu a{font-size:' . intval($font_size) . 'px;}';
     }
     /*-----------------------------------------------------------------------------------*/
     /*  - Return CSS
     			/*-----------------------------------------------------------------------------------*/
     if (!empty($css)) {
         $output .= '/*ADVANCED STYLING CSS*/' . $css;
     }
     // Return output css
     return $output;
 }
Example #6
0
 /**
  * Filter the ancestors of the yoast seo breadcrumbs
  * Adds the portfolio, staff, testimonials and blog links
  *
  * @version 3.3.0
  */
 static function wpseo_breadcrumb_links($links)
 {
     global $post;
     $new_breadcrumb = '';
     // Loop through items
     $types = array('portfolio', 'staff', 'testimonials', 'post');
     foreach ($types as $type) {
         if (is_singular($type)) {
             if ('post' == $type) {
                 $type = 'blog';
             }
             $page_id = wpex_parse_obj_id(wpex_get_mod($type . '_page'), 'page');
             if ($page_id) {
                 $page_title = get_the_title($page_id);
                 $page_permalink = get_permalink($page_id);
                 if ($page_permalink && $page_title) {
                     $new_breadcrumb[] = array('url' => $page_permalink, 'text' => $page_title);
                 }
             }
         }
     }
     // End foreach loop
     // Combine new crumb
     if ($new_breadcrumb) {
         array_splice($links, 1, -2, $new_breadcrumb);
     }
     // Return links
     return $links;
 }
        /**
         * Generates the CSS output
         *
         * @since 2.0.0
         */
        public static function generate($output)
        {
            // Define main variables
            $css = '';
            /*-----------------------------------------------------------------------------------*/
            /*  - Logo Max Widths
            			/*-----------------------------------------------------------------------------------*/
            // Desktop
            if ($width = wpex_get_mod('logo_max_width')) {
                $css .= '@media only screen and (min-width: 960px) {
							#site-logo img {
								max-width: ' . wpex_sanitize_data($width, 'px_pct') . ';
							}
						}';
            }
            // Tablet Portrait
            if ($width = wpex_get_mod('logo_max_width_tablet_portrait')) {
                $css .= '@media only screen and (min-width: 768px) and (max-width: 959px) {
							#site-logo img {
								max-width: ' . wpex_sanitize_data($width, 'px_pct') . ';
							}
						}';
            }
            // Phone
            if ($width = wpex_get_mod('logo_max_width_phone')) {
                $css .= '@media only screen and (max-width: 767px) {
							#site-logo img {
								max-width: ' . wpex_sanitize_data($width, 'px_pct') . ';
							}
						}';
            }
            /*-----------------------------------------------------------------------------------*/
            /*  - Other
            			/*-----------------------------------------------------------------------------------*/
            // Fixes for full-width layout when custom background is added
            if ('full-width' == wpex_global_obj('main_layout') && (wpex_get_mod('background_color') || wpex_get_mod('background_image'))) {
                $css .= '.wpex-sticky-header-holder{background:none;}';
            }
            // Fix for Fonts In the Visual Composer
            if (wpex_global_obj('vc_is_inline')) {
                $css .= '.wpb_row .fa:before { box-sizing:content-box!important; -moz-box-sizing:content-box!important; -webkit-box-sizing:content-box!important; }';
            }
            // Remove header border if custom color is set
            if (wpex_get_mod('header_background')) {
                $css .= '.is-sticky #site-header{border-color:transparent;}';
            }
            // Overlay Header font size
            if (wpex_global_obj('has_overlay_header') && ($font_size = get_post_meta(wpex_global_obj('post_id'), 'wpex_overlay_header_font_size', true))) {
                $css .= '#site-navigation, #site-navigation .dropdown-menu a{font-size:' . intval($font_size) . 'px;}';
            }
            /*-----------------------------------------------------------------------------------*/
            /*  - Return CSS
            			/*-----------------------------------------------------------------------------------*/
            if (!empty($css)) {
                $output .= '/*ADVANCED STYLING CSS*/' . $css;
            }
            // Return output css
            return $output;
        }
Example #8
0
/**
 * Sets the correct layout for posts
 *
 * @since Total 1.0.0
 */
function wpex_post_layout($post_id = '')
{
    // Get ID if not defined
    $post_id = $post_id ? $post_id : wpex_get_the_id();
    // Define variables
    $class = 'right-sidebar';
    $meta = get_post_meta($post_id, 'wpex_post_layout', true);
    // Check meta first to override and return (prevents filters from overriding meta)
    if ($meta) {
        return $meta;
    }
    // Singular Page
    if (is_page()) {
        // Blog template
        if (is_page_template('templates/blog.php')) {
            $class = wpex_get_mod('blog_archives_layout', 'right-sidebar');
        }
        // Landing Page
        if (is_page_template('templates/landing-page.php')) {
            $class = 'full-width';
        } elseif (is_attachment()) {
            $class = 'full-width';
        } else {
            $class = wpex_get_mod('page_single_layout', 'right-sidebar');
        }
    } elseif (is_singular('post')) {
        $class = wpex_get_mod('blog_single_layout', 'right-sidebar');
    } elseif (is_singular('attachment')) {
        $class = 'full-width';
    } elseif (is_home()) {
        $class = wpex_get_mod('blog_archives_layout', 'right-sidebar');
    } elseif (is_search()) {
        $class = wpex_get_mod('search_layout', 'right-sidebar');
    } elseif (is_category()) {
        $class = wpex_get_mod('blog_archives_layout', 'right-sidebar');
        $term = get_query_var('cat');
        $term_data = get_option("category_{$term}");
        if ($term_data) {
            if (!empty($term_data['wpex_term_layout'])) {
                $class = $term_data['wpex_term_layout'];
            }
        }
    } elseif (wpex_is_blog_query()) {
        $class = wpex_get_mod('blog_archives_layout', 'right-sidebar');
    } elseif (is_404()) {
        $class = 'full-width';
    } else {
        $class = 'right-sidebar';
    }
    // Class should never be empty
    if (empty($class)) {
        $class = 'right-sidebar';
    }
    // Apply filters for child theme editing
    $class = apply_filters('wpex_post_layout_class', $class);
    // Return correct classname
    return $class;
}
 function wpex_overlay_style($style = '')
 {
     $style = $style ? $style : get_post_type();
     if ('portfolio' == $style) {
         $style = wpex_get_mod('portfolio_entry_overlay_style');
     } elseif ('staff' == $style) {
         $style = wpex_get_mod('staff_entry_overlay_style');
     }
     return apply_filters('wpex_overlay_style', $style);
 }
Example #10
0
 /**
  * Registers the custom taxonomy
  *
  * @since 2.0.0
  */
 public static function register()
 {
     $name = wpex_get_mod('post_series_labels');
     $name = $name ? $name : esc_html__('Post Series', 'total');
     $slug = wpex_get_mod('post_series_slug');
     $slug = $slug ? $slug : 'post-series';
     // Apply filters
     $args = apply_filters('wpex_taxonomy_post_series_args', array('labels' => array('name' => $name, 'singular_name' => $name, 'menu_name' => $name, 'search_items' => esc_html__('Search', 'total'), 'popular_items' => esc_html__('Popular', 'total'), 'all_items' => esc_html__('All', 'total'), 'parent_item' => esc_html__('Parent', 'total'), 'parent_item_colon' => esc_html__('Parent', 'total'), 'edit_item' => esc_html__('Edit', 'total'), 'update_item' => esc_html__('Update', 'total'), 'add_new_item' => esc_html__('Add New', 'total'), 'new_item_name' => esc_html__('New', 'total'), 'separate_items_with_commas' => esc_html__('Separate with commas', 'total'), 'add_or_remove_items' => esc_html__('Add or remove', 'total'), 'choose_from_most_used' => esc_html__('Choose from the most used', 'total')), 'public' => true, 'show_in_nav_menus' => true, 'show_ui' => true, 'show_tagcloud' => true, 'hierarchical' => true, 'rewrite' => array('slug' => $slug), 'query_var' => true));
     // Register the taxonomy
     register_taxonomy('post_series', array('post'), $args);
 }
Example #11
0
 /**
  * Returns the current skin
  *
  * @since 1.6.3
  */
 public function get_current_skin()
 {
     // Check URL
     if (!empty($_GET['theme_skin'])) {
         return $_GET['theme_skin'];
     }
     // Apply filters
     $skin = apply_filters('wpex_active_skin', wpex_get_mod('theme_skin', 'base'));
     // Sanitize and return
     return $skin ? $skin : 'base';
 }
Example #12
0
 /**
  * The function responsible for creating the actual meta box.
  *
  * @since 1.0.0
  */
 public function post_meta($post)
 {
     // Disable on footer builder
     $footer_builder_page = wpex_get_mod('footer_builder_page_id');
     if ('page' == get_post_type($post->ID) && $footer_builder_page == $post->ID) {
         return;
     }
     // Add metabox
     $obj = get_post_type_object($post->post_type);
     add_meta_box('wpex-metabox', $obj->labels->singular_name . ' ' . esc_html__('Settings', 'total'), array($this, 'display_meta_box'), $post->post_type, 'normal', 'high');
 }
 /**
  * Returns active lightbox skin
  *
  * @since 2.1.0
  */
 public static function active_skin()
 {
     // Get skin from Customizer setting
     $skin = wpex_get_mod('lightbox_skin', 'minimal');
     // Sanitize
     $skin = $skin ? $skin : 'minimal';
     // Apply filters
     $skin = apply_filters('wpex_lightbox_skin', $skin);
     // Return
     return $skin;
 }
 /**
  * Start things up
  *
  * @since 1.6.0
  */
 public function __construct()
 {
     // Get options
     $this->options = wpex_get_mod('login_page_design', array('enabled' => true, 'logo' => '', 'logo_height' => '', 'background_color' => '', 'background_img' => '', 'background_style' => '', 'form_background_color' => '', 'form_background_opacity' => '', 'form_text_color' => '', 'form_top' => '', 'form_border_radius' => ''));
     // Add actions
     add_action('admin_menu', array($this, 'add_page'));
     add_action('admin_init', array($this, 'register_settings'));
     add_action('admin_enqueue_scripts', array($this, 'scripts'));
     add_action('admin_print_styles-' . WPEX_ADMIN_PANEL_HOOK_PREFIX . '-admin-login', array($this, 'admin_styles'), 40);
     add_action('login_head', array($this, 'output_css'));
     add_action('login_headerurl', array($this, 'logo_link'));
 }
    function wpex_wcmenucart_menu_item()
    {
        // Vars
        global $woocommerce;
        $icon_style = wpex_get_mod('woo_menu_icon_style', 'drop-down');
        $custom_link = wpex_get_mod('woo_menu_icon_custom_link');
        $header_style = wpex_global_obj('header_style');
        // URL
        if ('custom-link' == $icon_style && $custom_link) {
            $url = esc_url($custom_link);
        } else {
            $cart_id = woocommerce_get_page_id('cart');
            if (function_exists('icl_object_id')) {
                $cart_id = icl_object_id($cart_id, 'page');
            }
            $url = get_permalink($cart_id);
        }
        // Cart total
        $display = wpex_get_mod('woo_menu_icon_display', 'icon_count');
        if ('icon_total' == $display) {
            $cart_extra = WC()->cart->get_cart_total();
            $cart_extra = str_replace('amount', 'wcmenucart-details', $cart_extra);
        } elseif ('icon_count' == $display) {
            $cart_extra = '<span class="wcmenucart-details count">' . WC()->cart->cart_contents_count . '</span>';
        } else {
            $cart_extra = '';
        }
        // Cart Icon
        $cart_icon = '<span class="fa fa-shopping-cart"></span><span class="wcmenucart-text">' . _x('Shop', 'Navbar Cart Text For Vertical Nav', 'wpex') . '</span>';
        $cart_icon = apply_filters('wpex_menu_cart_icon_html', $cart_icon);
        ob_start();
        ?>

			<a href="<?php 
        echo $url;
        ?>
" class="wcmenucart" title="<?php 
        _e('Your Cart', 'wpex');
        ?>
">
				<span class="link-inner">
					<span class="wcmenucart-count"><?php 
        echo $cart_icon;
        echo $cart_extra;
        ?>
</span>
				</span>
			</a>
			
		<?php 
        return ob_get_clean();
    }
Example #16
0
 /**
  * Generates the CSS output
  *
  * @since 2.0.0
  */
 public function generate($output)
 {
     // Get custom accent
     $custom_accent = wpex_get_mod('accent_color');
     // Return if accent color is empty or equal to default
     if (!$custom_accent || $this->default_accent == $custom_accent) {
         return $output;
     }
     // Define css var
     $css = '';
     // Get arrays
     $texts = $this->arrays('texts');
     $backgrounds = $this->arrays('backgrounds');
     $borders = $this->arrays('borders');
     // Texts
     if (!empty($texts)) {
         $css .= implode(',', $texts) . '{color:' . $custom_accent . ';}';
     }
     // Backgrounds
     if (!empty($backgrounds)) {
         $css .= implode(',', $backgrounds) . '{background-color:' . $custom_accent . ';}';
     }
     // Borders
     if (!empty($borders)) {
         foreach ($borders as $key => $val) {
             if (is_array($val)) {
                 $css .= $key . '{';
                 foreach ($val as $key => $val) {
                     $css .= 'border-' . $val . '-color:' . $custom_accent . ';';
                 }
                 $css .= '}';
             } else {
                 $css .= $val . '{border-color:' . $custom_accent . ';}';
             }
         }
     }
     // Return CSS
     if (!empty($css)) {
         $output .= '/*ACCENT COLOR*/' . $css;
     }
     // Return output css
     return $output;
 }
/**
 * Returns correct togglebar classes
 *
 * @since Total 1.0.0
 */
function wpex_toggle_bar_classes()
{
    // Add default classes
    $classes = array('clr');
    // Add animation classes
    if ($animation = wpex_get_mod('toggle_bar_animation', 'fade')) {
        $classes[] = 'toggle-bar-' . $animation;
    }
    // Add visibility classes
    if ($visibility = wpex_get_mod('toggle_bar_visibility', 'always-visible')) {
        $classes[] = $visibility;
    }
    // Apply filters for child theming
    $classes = apply_filters('wpex_toggle_bar_active', $classes);
    // Turn classes into space seperated string
    $classes = implode(' ', $classes);
    // Return classes
    return $classes;
}
 /**
  * Start things up
  *
  * @since 3.0.0
  */
 public function __construct()
 {
     // Give values to vars
     $this->customizer_dir_uri = WPEX_FRAMEWORK_DIR_URI . 'customizer/';
     $this->customizer_dir = WPEX_FRAMEWORK_DIR . 'customizer/';
     // Check if the customizer admin panel is enabled
     $this->admin_enabled = wpex_get_mod('customizer_panel_enable', true);
     // Add admin panel if enabled
     if (is_admin() && $this->admin_enabled) {
         add_action('admin_menu', array($this, 'add_admin_page'), 40);
         add_action('admin_init', array($this, 'admin_options'));
         add_action('admin_print_styles-' . WPEX_ADMIN_PANEL_HOOK_PREFIX . '-customizer', array($this, 'admin_styles'), 40);
     }
     // Create an array of registered theme customizer panels
     $this->panels = apply_filters('wpex_customizer_panels', array('general' => array('title' => __('General Theme Options', 'wpex')), 'layout' => array('title' => __('Layout', 'wpex')), 'typography' => array('title' => __('Typography', 'wpex')), 'togglebar' => array('title' => __('Toggle Bar', 'wpex'), 'is_section' => true), 'topbar' => array('title' => __('Top Bar', 'wpex'), 'is_section' => true), 'header' => array('title' => __('Header', 'wpex')), 'navbar' => array('title' => __('Navbar', 'wpex'), 'is_section' => true), 'mobile_menu' => array('title' => __('Mobile Menu', 'wpex'), 'is_section' => true), 'sidebar' => array('title' => __('Sidebar', 'wpex'), 'is_section' => true), 'blog' => array('title' => __('Blog', 'wpex')), 'portfolio' => array('title' => __('Portfolio', 'wpex'), 'condition' => WPEX_PORTFOLIO_IS_ACTIVE), 'staff' => array('title' => __('Staff', 'wpex'), 'condition' => WPEX_STAFF_IS_ACTIVE), 'testimonials' => array('title' => __('Testimonials', 'wpex'), 'condition' => WPEX_TESTIMONIALS_IS_ACTIVE, 'is_section' => true), 'woocommerce' => array('title' => __('WooCommerce', 'wpex'), 'condition' => WPEX_WOOCOMMERCE_ACTIVE), 'callout' => array('title' => __('Callout', 'wpex'), 'is_section' => true), 'footer_widgets' => array('title' => __('Footer Widgets', 'wpex'), 'is_section' => true), 'footer_bottom' => array('title' => __('Footer Bottom', 'wpex'), 'is_section' => true), 'visual_composer' => array('title' => __('Visual Composer', 'wpex'), 'is_section' => true, 'condition' => WPEX_VC_ACTIVE)));
     // Get enabled panels
     $this->enabled_panels = get_option('wpex_customizer_panels', $this->panels);
     // Add sections (stores all sections in array if not already saved in DB)
     if (!$this->sections) {
         $this->add_sections();
     }
     // Add custom controls and callbacks
     add_action('customize_register', array($this, 'controls_callbacks'));
     // Remove core panels and sections
     add_action('customize_register', array($this, 'remove_core_sections'), 11);
     // Add theme customizer sections and panels
     add_action('customize_register', array($this, 'add_customizer_panels_sections'), 40);
     // Adds CSS for customizer custom controls
     add_action('customize_controls_print_styles', array($this, 'customize_controls_print_styles'));
     // Include Typography & Styling Classes
     require_once WPEX_FRAMEWORK_DIR . 'customizer/settings/typography.php';
     // Get inline CSS cache - humm, not sure if I really want to add this
     // Could cause issues for people and they don't know what's up
     //$this->inline_css_cache = get_option( 'wpex_customizer_inline_css_cache' );
     // Add inline CSS to header = Run Last to make sure it overrides custom CSS
     add_action('wpex_head_css', array($this, 'add_inline_css'), 999);
     // Reset CSS cache
     add_action('customize_save_after', array($this, 'reset_inline_css_cache'));
     add_action('switch_theme', array($this, 'reset_inline_css_cache'));
     if (!empty($_GET['wpex_clear_customizer_cache'])) {
         $this->reset_inline_css_cache();
     }
 }
 /**
  * Start things up
  *
  * @since 1.6.0
  */
 public function __construct()
 {
     // Update vars
     $this->vc_theme_mode = wpex_get_mod('visual_composer_theme_mode', true);
     $this->remove_vc_design_options = apply_filters('wpex_remove_vc_design_options', true);
     // Include helper functions and classes
     require_once WPEX_FRAMEWORK_DIR . 'visual-composer/vc-helpers.php';
     // Override editor logo
     add_filter('vc_nav_front_logo', array($this, 'nav_logo'));
     // Remove design options tab
     if ($this->remove_vc_design_options) {
         add_filter('vc_settings_page_show_design_tabs', '__return_false');
         delete_option('wpb_js_use_custom');
     }
     // Add actions
     add_action('wp_enqueue_scripts', array($this, 'load_composer_front_css'), 0);
     add_action('wp_enqueue_scripts', array($this, 'load_remove_styles'));
     add_action('admin_menu', array(__CLASS__, 'remove_welcome'), 999);
     add_action('wp_footer', array($this, 'remove_footer_scripts'));
     add_action('admin_enqueue_scripts', array($this, 'admin_scripts'));
     add_action('admin_init', array($this, 'disable_updater'), 99);
     add_action('init', array($this, 'init'), 20);
     add_action('wpex_head_css', array($this, 'vc_css_ids'));
     // Add filters
     add_filter('vc_font_container_get_allowed_tags', array($this, 'font_container_tags'));
     add_filter('vc_font_container_get_fonts_filter', array($this, 'font_container_fonts'));
     // Remove actions
     remove_action('vc_activation_hook', 'vc_page_welcome_set_redirect');
     remove_action('init', 'vc_page_welcome_redirect');
     // Register accent colors
     add_filter('wpex_accent_texts', array($this, 'accent_texts'));
     add_filter('wpex_accent_borders', array($this, 'accent_borders'));
     add_filter('wpex_accent_backgrounds', array($this, 'accent_backgrounds'));
     // Add new shortcode param
     add_shortcode_param('vcex_textarea_html', array($this, 'vcex_textarea_html'));
     // Extend the Visual Composer (add new modules)
     if (wpex_get_mod('extend_visual_composer', true)) {
         add_action('after_setup_theme', array($this, 'map_custom_shortcodes'));
     }
 }
Example #20
0
	<?php 
}
?>

	<div class="entry-content entry clr">

		<?php 
// Output page content
the_content();
?>

		<?php 
// Output page pagination
wp_link_pages(array('before' => '<div class="page-links clr">', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>'));
?>

	</div><!-- .entry-content -->

	<?php 
// Get social sharing template part
get_template_part('partials/social', 'share');
?>

</article><!-- #post -->

<?php 
// Display comments if enabled
if (wpex_get_mod('page_comments')) {
    comments_template();
}
Example #21
0
/**
 * Enqueues a Google Font
 *
 * @since 2.1.0
 */
function wpex_enqueue_google_font($font)
{
    // Get list of all Google Fonts
    $google_fonts = wpex_google_fonts_array();
    // Make sure font is in our list of fonts
    if (!$google_fonts || !in_array($font, $google_fonts)) {
        return;
    }
    // Sanitize handle
    $handle = trim($font);
    $handle = strtolower($handle);
    $handle = str_replace(' ', '-', $handle);
    // Sanitize font name
    $font = trim($font);
    $font = str_replace(' ', '+', $font);
    // Subset
    $subset = wpex_get_mod('google_font_subsets', 'latin');
    $subset = $subset ? $subset : 'latin';
    $subset = '&amp;subset=' . $subset;
    // Enqueue style
    wp_enqueue_style('wpex-google-font-' . $handle, '//fonts.googleapis.com/css?family=' . str_replace(' ', '%20', $font) . ':100italic,200italic,300italic,400italic,600italic,700italic,800italic,900italic,900,800,700,600,500,400,300,200,100' . $subset, false, false, 'all');
}
 /**
  * Settings page output
  *
  * @since 1.6.0
  */
 public function output_favicons()
 {
     $output = '';
     // Favicon - Standard
     if ($icon = wpex_get_mod('favicon')) {
         $output .= '<link rel="shortcut icon" href="' . esc_url($this->sanitize_val($icon, 'image')) . '">';
     }
     // Apple iPhone Icon - 57px
     if ($icon = wpex_get_mod('iphone_icon')) {
         $output .= '<link rel="apple-touch-icon-precomposed" href="' . esc_url($this->sanitize_val($icon, 'image')) . '">';
     }
     // Apple iPad Icon - 76px
     if ($icon = wpex_get_mod('ipad_icon')) {
         $output .= '<link rel="apple-touch-icon-precomposed" sizes="76x76" href="' . esc_url($this->sanitize_val($icon, 'image')) . '">';
     }
     // Apple iPhone Retina Icon - 120px
     if ($icon = wpex_get_mod('iphone_icon_retina')) {
         $output .= '<link rel="apple-touch-icon-precomposed" sizes="120x120" href="' . esc_url($this->sanitize_val($icon, 'image')) . '">';
     }
     // Apple iPad Retina Icon - 114px
     if ($icon = wpex_get_mod('ipad_icon_retina')) {
         $output .= '<link rel="apple-touch-icon-precomposed" sizes="114x114" href="' . esc_url($this->sanitize_val($icon, 'image')) . '">';
     }
     // Output favicons into the WP_Head
     echo $output;
 }
    public static function content_id_field_callback()
    {
        ?>

		<?php 
        // Get footer builder page ID
        $page_id = wpex_get_mod('footer_builder_page_id');
        ?>

		<?php 
        // Display dropdown of pages
        wp_dropdown_pages(array('echo' => true, 'selected' => $page_id, 'name' => 'footer_builder[content_id]', 'show_option_none' => __('None - Display Widgetized Footer', 'wpex')));
        ?>
		<br />

		<p class="description"><?php 
        _e('Select your custom page for your footer layout.', 'wpex');
        ?>
</p>

		<?php 
        // If page_id is defined display edit and preview links
        if ($page_id) {
            ?>

			<br />

			<a href="<?php 
            echo admin_url('post.php?post=' . $page_id . '&action=edit');
            ?>
" class="button" target="_blank">
				<?php 
            _e('Backend Edit', 'wpex');
            ?>
			</a>

			<?php 
            if (WPEX_VC_ACTIVE) {
                ?>

				<a href="<?php 
                echo admin_url('post.php?vc_action=vc_inline&post_id=' . $page_id . '&post_type=page');
                ?>
" class="button" target="_blank">
					<?php 
                _e('Frontend Edit', 'wpex');
                ?>
				</a>

			<?php 
            }
            ?>

			<a href="<?php 
            echo get_permalink($page_id);
            ?>
" class="button" target="_blank">
				<?php 
            _e('Preview', 'wpex');
            ?>
			</a>

		<?php 
        }
        ?>
		
	<?php 
    }
Example #24
0
" title="<?php 
    wpex_esc_title();
    ?>
" rel="bookmark">

	<?php 
}
?>

		<?php 
echo $thumbnail;
?>

		<?php 
// Inside overlay HTML
wpex_overlay('inside_link');
?>

	<?php 
// Close link around staff item if enabled
if (wpex_get_mod('staff_links_enable', true)) {
    echo '</a>';
}
?>

	<?php 
// Outside overlay HTML
wpex_overlay('outside_link');
?>

</div><!-- .staff-entry-media -->
Example #25
0
 /**
  * Disables the next/previous links if disabled via the customizer.
  *
  * @since 2.0.0
  */
 public static function next_prev($return)
 {
     if (is_woocommerce() && is_singular('product') && !wpex_get_mod('woo_next_prev', true)) {
         $return = false;
     }
     return $return;
 }
Example #26
0
if (!defined('ABSPATH')) {
    exit;
}
// Return if disabled
if (!wpex_get_mod('blog_post_meta', true)) {
    return;
}
// Get meta sections
$sections = wpex_blog_single_meta_sections();
// Return if sections are empty
if (empty($sections)) {
    return;
}
// Add class for meta with title
$classes = 'meta clr';
if ('custom_text' == wpex_get_mod('blog_single_header', 'custom_text')) {
    $classes .= ' meta-with-title';
}
?>

<ul class="<?php 
echo esc_attr($classes);
?>
">

	<?php 
// Loop through meta sections
foreach ($sections as $section) {
    ?>

		<?php 
    ?>
	</div><!-- #top-bar-social-alt -->

<?php 
    return;
}
?>

<?php 
// Return if there aren't any profiles defined and define var
if (!($profiles = wpex_get_mod('top_bar_social_profiles'))) {
    return;
}
// Get theme mods
$style = wpex_get_mod('top_bar_social_style', '');
$link_target = wpex_get_mod('top_bar_social_target', 'blank');
$link_target = 'blank' == $link_target || '_blank' == $link_target ? ' target="_blank"' : '';
if ($style == 'colored-icons') {
    $colored_icons_url = apply_filters('top_bar_social_img_url', get_template_directory_uri() . '/images/social');
}
?>

<div id="top-bar-social" class="clr <?php 
echo $classes;
?>
 social-style-<?php 
echo $style;
?>
">

	<?php 
Example #28
0
<?php

/**
 * The Scroll-Top Button
 *
 * @package Total WordPress theme
 * @subpackage Partials
 * @version 3.3.0
 */
// Exit if accessed directly
if (!defined('ABSPATH')) {
    exit;
}
// Get arrow
$arrow = wpex_get_mod('scroll_top_arrow');
$arrow = $arrow ? $arrow : 'chevron-up';
?>

<a href="#" id="site-scroll-top"><span class="fa fa-<?php 
echo esc_attr($arrow);
?>
"></span></a>
Example #29
0
 /**
  * Run image resizing function
  *
  * @since 1.0.0
  */
 public function process($args)
 {
     // Args must be an array
     if (!is_array($args)) {
         print_r('Fatal Error: Image resize args are not an array, you must update your template files.');
         return false;
     }
     // Default args
     $defaults = array('image' => null, 'width' => '9999', 'height' => '9999', 'crop' => 'center-center', 'retina' => false, 'return' => 'array');
     // Parse args
     $args = wp_parse_args($args, $defaults);
     // Extract args
     extract($args);
     // If URL isn't defined return
     if (!$image) {
         return;
     }
     // Sanitize inputs
     $width = intval($width);
     $height = intval($height);
     // Set width and height to '9999' if empty
     $width = $width ? $width : '9999';
     $height = $height ? $height : '9999';
     // Set crop to center-center if empty
     $crop = $crop ? $crop : 'center-center';
     // Sanitize crop and add crop suffix
     $crop_suffix = '';
     $crop = $height >= '9999' ? false : $crop;
     // Define upload path & dir
     $upload_info = wp_upload_dir();
     $upload_dir = $upload_info['basedir'];
     $upload_url = $upload_info['baseurl'];
     // Define path of image
     $rel_path = str_replace($upload_url, '', $image);
     $img_path = $upload_dir . $rel_path;
     // Add crop_suffix if $crop isn't false or empty and image resizing is enabled
     if ($crop && wpex_get_mod('image_resizing', true)) {
         if (is_array($crop)) {
             $crop_suffix = array_combine($crop, $crop);
             $crop_suffix = implode('-', $crop_suffix);
         } elseif ('center-center' != $crop) {
             $crop_suffix = $crop;
             $crop = explode('-', $crop);
         }
     }
     // If image width and height are both 9999 and size is empty return full image
     if ('9999' == $width && '9999' == $height) {
         // Return for retina images
         if ($retina) {
             return;
         }
         // Set main image to the full URL
         $img_url = $image;
         // Get width and height
         $info = pathinfo($img_path);
         $ext = $info['extension'];
         list($orig_w, $orig_h) = getimagesize($img_path);
     } else {
         // Set resize dimensions
         $resize_width = $width;
         $resize_height = $height;
         // If $img_url isn't local return full image
         if (strpos($image, $upload_url) === false) {
             $img_url = $image;
         } else {
             // Check if img path exists, and is an image indeed if not return full img
             if (!file_exists($img_path) or !getimagesize($img_path)) {
                 $img_url = $image;
             } else {
                 // Get image info
                 $info = pathinfo($img_path);
                 $ext = $info['extension'];
                 list($orig_w, $orig_h) = getimagesize($img_path);
                 // Get image size after cropping
                 $dims = image_resize_dimensions($orig_w, $orig_h, $resize_width, $resize_height, $crop);
                 $dst_w = $dims[4];
                 $dst_h = $dims[5];
                 // Can't resize, so return original url
                 if (!$dims) {
                     // Set values equal to original image
                     $img_url = $image;
                     $dst_w = $orig_w;
                     $dst_h = $orig_h;
                     // Return false for retina
                     if ($retina) {
                         return false;
                     }
                 } else {
                     // Define image saving destination
                     $dst_rel_path = str_replace('.' . $ext, '', $rel_path);
                     // Suffix
                     $suffix = $dst_w . 'x' . $dst_h;
                     // Sanitize suffix
                     $suffix = $crop_suffix ? $crop_suffix . '-' . $suffix : $suffix;
                     // Check original image destination
                     $destfilename = $upload_dir . $dst_rel_path . '-' . $suffix . '.' . $ext;
                     // Set dimensions for retina images
                     if ($retina) {
                         // Check if we should actually create a retina version
                         if ($dims && file_exists($destfilename) && getimagesize($destfilename)) {
                             // Return if the destination width or height aren't at least 2x as big
                             if ($orig_w < $dst_w * 2 || $orig_h < $dst_h * 2) {
                                 return false;
                             }
                             // Set retina version to @2x the output of the default cropped image
                             $dims = image_resize_dimensions($orig_w, $orig_h, $dst_w * 2, $dst_h * 2, $crop);
                             $dst_w = $dims[4];
                             $dst_h = $dims[5];
                             // Return if retina version can't be created
                             if (!$dims) {
                                 return false;
                             }
                             // Set correct resize dims for retina images
                             $resize_width = $resize_width * 2;
                             $resize_height = $resize_height * 2;
                             // Tweak suffix
                             $suffix .= '@2x';
                             $suffix = $crop_suffix ? $crop_suffix . '-' . $suffix : $suffix;
                         } else {
                             return false;
                         }
                     }
                     // The full destination filename for the cropped image
                     $destfilename = $upload_dir . $dst_rel_path . '-' . $suffix . '.' . $ext;
                     //  Check if cache exists
                     if (file_exists($destfilename) && getimagesize($destfilename)) {
                         // Set image url
                         $img_url = $upload_url . $dst_rel_path . '-' . $suffix . '.' . $ext;
                     } else {
                         $editor = wp_get_image_editor($img_path);
                         // Return full image if there is an error
                         if (is_wp_error($editor) || is_wp_error($editor->resize($resize_width, $resize_height, $crop))) {
                             $img_url = $image;
                         } else {
                             // Get resized file
                             $filename = $editor->generate_filename($suffix);
                             $editor = $editor->save($filename);
                             // Return the resized image URL
                             if (!is_wp_error($editor)) {
                                 $path = str_replace($upload_dir, '', $editor['path']);
                                 $img_url = $upload_url . $path;
                             } else {
                                 $img_url = $image;
                             }
                         }
                     }
                     // End cache check
                 }
                 // End $dims check
             }
             // End file exists check
         }
         // End local image check
     }
     // End image dims check
     // Validate url
     $img_url = !empty($img_url) ? $img_url : $image;
     // Validate width
     if (!empty($dst_w)) {
         $dst_w = $dst_w;
     } elseif (isset($orig_w)) {
         $dst_w = $orig_w;
     } else {
         $dst_w = '';
     }
     // Validate height
     if (!empty($dst_h)) {
         $dst_h = $dst_h;
     } elseif (isset($orig_h)) {
         $dst_h = $orig_h;
     } else {
         $dst_h = '';
     }
     // Return Image data
     if ('array' == $return) {
         return array('url' => $img_url, 'width' => $dst_w, 'height' => $dst_h);
     } else {
         return $img_url;
     }
 }
 /**
  * Return the widget_areas array.
  *
  * @since 1.6.0
  */
 public function get_widget_areas()
 {
     // If the single instance hasn't been set, set it now.
     if (!empty($this->widget_areas)) {
         return $this->widget_areas;
     }
     // Get widget areas saved in theem mod
     $widget_areas = wpex_get_mod('widget_areas');
     // If theme mod isn't empty set to class widget area var
     if (!empty($widget_areas) && is_array($widget_areas)) {
         $this->widget_areas = array_unique(array_merge($this->widget_areas, $widget_areas));
     }
     // Return widget areas
     return $this->widget_areas;
 }