Ejemplo n.º 1
0
    function vcex_login_form_shortcode($atts, $content = NULL)
    {
        // Shortcode params
        extract(shortcode_atts(array('unique_id' => '', 'redirect' => ''), $atts));
        // Enable output buffer
        ob_start();
        // If user is logged return text
        if (is_user_logged_in() && !wpex_is_front_end_composer()) {
            return $content;
        } else {
            // Redirection URL
            if ($redirect == '') {
                $redirect = site_url($_SERVER['REQUEST_URI']);
            }
            // Form args
            $args = array('echo' => true, 'redirect' => $redirect, 'form_id' => 'vcex-loginform', 'label_username' => __('Username', 'wpex'), 'label_password' => __('Password', 'wpex'), 'label_remember' => __('Remember Me', 'wpex'), 'label_log_in' => __('Log In', 'wpex'), 'remember' => true, 'value_username' => NULL, 'value_remember' => false);
            ?>

				<div class="vcex-login-form clr">
					<?php 
            wp_login_form($args);
            ?>
				</div><!-- .vcex-login-form -->

			<?php 
        }
        ?>

		<?php 
        // Return content
        return ob_get_clean();
    }
Ejemplo n.º 2
0
 function vcex_spacing_shortcode($atts)
 {
     extract(shortcode_atts(array('size' => '20px', 'class' => '', 'visibility' => ''), $atts));
     $classes = 'vcex-spacing';
     if ($class) {
         $add_classes .= ' ' . $class;
     }
     if ($visibility) {
         $add_classes .= ' ' . $visibility;
     }
     if (wpex_is_front_end_composer()) {
         return '<div class="vc-spacing-shortcode ' . $classes . '" style="height: ' . $size . '"></div>';
     } else {
         return '<hr class="' . $classes . '" style="height: ' . $size . '" />';
     }
 }
Ejemplo n.º 3
0
/**
 * Check if the post edit links should display on the page
 *
 * @since 2.0.0
 */
function wpex_has_post_edit()
{
    // Display by default
    $return = true;
    // If not singular we can bail completely
    if (!is_singular()) {
        return false;
    }
    // Don't show on front-end composer
    if (wpex_is_front_end_composer()) {
        return;
    }
    // Not needed for these pages
    if (function_exists('is_cart') && is_cart()) {
        return;
    }
    if (function_exists('is_checkout') && is_checkout()) {
        return;
    }
    // Apply filters and return
    return apply_filters('wpex_has_post_edit', $return);
}
Ejemplo n.º 4
0
    function vcex_portfolio_carousel_shortcode($atts)
    {
        extract(shortcode_atts(array('unique_id' => '', 'classes' => '', 'style' => 'default', 'term_slug' => '', 'include_categories' => '', 'exclude_categories' => '', 'count' => '8', 'center' => 'false', 'timeout_duration' => '5000', 'items' => '4', 'items_margin' => '15', 'infinite_loop' => 'true', 'items_scroll' => '1', 'auto_play' => 'false', 'arrows' => 'true', 'order' => 'DESC', 'orderby' => 'date', 'orderby_meta_key' => '', 'thumbnail_link' => '', 'img_width' => '9999', 'img_height' => '9999', 'title' => 'true', 'excerpt' => 'true', 'excerpt_length' => '30', 'custom_excerpt_trim' => 'true', 'filter_content' => 'false', 'offset' => 0, 'taxonomy' => '', 'terms' => '', 'img_hover_style' => '', 'img_rendering' => '', 'overlay_style' => '', 'content_background' => '', 'content_heading_margin' => '', 'content_heading_weight' => '', 'content_heading_transform' => '', 'content_margin' => '', 'content_font_size' => '', 'content_padding' => '', 'content_border' => '', 'content_color' => '', 'content_opacity' => '', 'content_heading_color' => '', 'content_heading_size' => '', 'content_alignment' => '', 'tablet_items' => '3', 'mobile_landscape_items' => '2', 'mobile_portrait_items' => '1'), $atts));
        // Turn output buffer on
        ob_start();
        // Global post
        global $post;
        // Include categories
        $include_categories = '' != $include_categories ? $include_categories : $term_slug;
        $include_categories = 'all' == $include_categories ? '' : $include_categories;
        $filter_cats_include = '';
        if ($include_categories) {
            $include_categories = explode(',', $include_categories);
            $filter_cats_include = array();
            foreach ($include_categories as $key) {
                $key = get_term_by('slug', $key, 'portfolio_category');
                $filter_cats_include[] = $key->term_id;
            }
        }
        // Exclude categories
        $filter_cats_exclude = '';
        if ($exclude_categories) {
            $exclude_categories = explode(',', $exclude_categories);
            if (!empty($exclude_categories) && is_array($exclude_categories)) {
                $filter_cats_exclude = array();
                foreach ($exclude_categories as $key) {
                    $key = get_term_by('slug', $key, 'portfolio_category');
                    $filter_cats_exclude[] = $key->term_id;
                }
                $exclude_categories = array('taxonomy' => 'portfolio_category', 'field' => 'slug', 'terms' => $exclude_categories, 'operator' => 'NOT IN');
            } else {
                $exclude_categories = '';
            }
        }
        // Start Tax Query
        if (!empty($include_categories) && is_array($include_categories)) {
            $include_categories = array('taxonomy' => 'portfolio_category', 'field' => 'slug', 'terms' => $include_categories, 'operator' => 'IN');
        } else {
            $include_categories = '';
        }
        // Meta key for orderby
        if ($orderby_meta_key && ('meta_value_num' == $orderby || 'meta_value' == $orderby)) {
            $meta_key = $orderby_meta_key;
        } else {
            $meta_key = NULL;
        }
        // The Query
        $wpex_query = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => $count, 'offset' => $offset, 'order' => $order, 'orderby' => $orderby, 'filter_content' => $filter_content, 'no_found_rows' => true, 'meta_key' => $meta_key, 'tax_query' => array('relation' => 'AND', $include_categories, $exclude_categories)));
        //Output posts
        if ($wpex_query->posts) {
            // Output js for front-end editor
            vcex_front_end_carousel_js();
            // Give caroufredsel a unique name
            $rand_num = rand(1, 100);
            $unique_carousel_id = 'carousel-' . $rand_num;
            // Prevent auto play in visual composer
            if (wpex_is_front_end_composer()) {
                $auto_play = 'false';
            }
            // Overlay Style
            if (empty($overlay_style)) {
                $overlay_style = 'none';
            } else {
                $overlay_style = $overlay_style;
            }
            // Item Margin
            if ('no-margins' == $style) {
                $items_margin = '0';
            }
            // Items to scroll fallback for old setting
            if ('page' == $items_scroll) {
                $items_scroll = $items;
            }
            // Unique ID
            if ($unique_id) {
                $unique_id = ' id="' . $unique_id . '"';
            }
            // Main Classes
            $main_classes = 'wpex-carousel wpex-carousel-portfolio clr owl-carousel';
            if ($style) {
                $main_classes .= ' wpex-carousel-' . $style;
            }
            if ($classes) {
                $main_classes .= ' ' . $classes;
            }
            // Entry media classes
            $media_classes = 'wpex-carousel-entry-media clr';
            if ($img_hover_style) {
                $media_classes .= ' vcex-img-hover-parent vcex-img-hover-' . $img_hover_style;
            }
            if ($img_rendering) {
                $media_classes .= ' vcex-image-rendering-' . $img_rendering;
            }
            if ($overlay_style) {
                $media_classes .= ' ' . wpex_overlay_classname($overlay_style);
            }
            // Content Design
            $content_style = '';
            if ($content_background) {
                $content_style .= 'background:' . $content_background . ';';
            }
            if ($content_padding) {
                $content_style .= 'padding:' . $content_padding . ';';
            }
            if ($content_margin) {
                $content_style .= 'margin:' . $content_margin . ';';
            }
            if ($content_border) {
                $content_style .= 'border:' . $content_border . ';';
            }
            if ($content_font_size) {
                $content_style .= 'font-size:' . $content_font_size . ';';
            }
            if ($content_color) {
                $content_style .= 'color:' . $content_color . ';';
            }
            if ($content_opacity) {
                $content_style .= 'opacity:' . $content_opacity . ';';
            }
            if ($content_alignment) {
                $content_style .= 'text-align:' . $content_alignment . ';';
            }
            if ($content_style) {
                $content_style = ' style="' . $content_style . '"';
            }
            // Title design
            $heading_style = '';
            if ($content_heading_margin) {
                $heading_style .= 'margin: ' . $content_heading_margin . ';';
            }
            if ($content_heading_transform) {
                $heading_style .= 'text-transform: ' . $content_heading_transform . ';';
            }
            if ($content_heading_weight) {
                $heading_style .= 'font-weight: ' . $content_heading_weight . ';';
            }
            if ($content_heading_size) {
                $heading_style .= 'font-size: ' . $content_heading_size . ';';
            }
            if ($heading_style) {
                $heading_style = ' style="' . $heading_style . '"';
            }
            // Heading color
            if ($content_heading_color) {
                $content_heading_color = ' style="color: ' . $content_heading_color . ';"';
            }
            ?>

			<div class="<?php 
            echo $main_classes;
            ?>
"<?php 
            echo $unique_id;
            ?>
 data-items="<?php 
            echo $items;
            ?>
" data-slideby="<?php 
            echo $items_scroll;
            ?>
" data-nav="<?php 
            echo $arrows;
            ?>
" data-autoplay="<?php 
            echo $auto_play;
            ?>
" data-loop="<?php 
            echo $infinite_loop;
            ?>
" data-autoplay-timeout="<?php 
            echo $timeout_duration;
            ?>
" data-center="<?php 
            echo $center;
            ?>
" data-margin="<?php 
            echo intval($items_margin);
            ?>
" data-items-tablet="<?php 
            echo $tablet_items;
            ?>
" data-items-mobile-landscape="<?php 
            echo $mobile_landscape_items;
            ?>
" data-items-mobile-portrait="<?php 
            echo $mobile_portrait_items;
            ?>
">
				<?php 
            // Loop through posts
            foreach ($wpex_query->posts as $post) {
                setup_postdata($post);
                // Post VARS
                $postid = $post->ID;
                $featured_img_url = wp_get_attachment_url(get_post_thumbnail_id($postid));
                $permalink = get_permalink($postid);
                $post_title = esc_attr(the_title_attribute('echo=0'));
                // Crop featured images if necessary
                if ('9999' == $img_height) {
                    $img_crop = false;
                } else {
                    $img_crop = true;
                }
                $featured_img = wpex_image_resize($featured_img_url, $img_width, $img_height, $img_crop, 'array');
                ?>
		
					<div class="wpex-carousel-slide">
						<?php 
                // Media Wrap
                if (has_post_thumbnail()) {
                    ?>
							<div class="<?php 
                    echo $media_classes;
                    ?>
">
								<?php 
                    // No links
                    if ('none' == $thumbnail_link) {
                        ?>
									<img src="<?php 
                        echo $featured_img['url'];
                        ?>
" alt="<?php 
                        echo $post_title;
                        ?>
" width="<?php 
                        echo $featured_img['width'];
                        ?>
" height="<?php 
                        echo $featured_img['height'];
                        ?>
" />
								<?php 
                    } elseif ('lightbox' == $thumbnail_link) {
                        ?>
									<a href="<?php 
                        echo $featured_img_url;
                        ?>
" title="<?php 
                        echo $post_title;
                        ?>
" class="wpex-carousel-entry-img wpex-lightbox">
										<img src="<?php 
                        echo $featured_img['url'];
                        ?>
" alt="<?php 
                        echo $post_title;
                        ?>
" width="<?php 
                        echo $featured_img['width'];
                        ?>
" height="<?php 
                        echo $featured_img['height'];
                        ?>
" />
								<?php 
                    } else {
                        ?>
									<a href="<?php 
                        echo $permalink;
                        ?>
" title="<?php 
                        echo $post_title;
                        ?>
" class="wpex-carousel-entry-img">
										<img src="<?php 
                        echo $featured_img['url'];
                        ?>
" alt="<?php 
                        echo $post_title;
                        ?>
" width="<?php 
                        echo $featured_img['width'];
                        ?>
" height="<?php 
                        echo $featured_img['height'];
                        ?>
" />
								<?php 
                    }
                    ?>
								<?php 
                    // Overlay & close link
                    if ('none' != $thumbnail_link) {
                        // Inner Overlay
                        if ($overlay_style) {
                            wpex_overlay('inside_link', $overlay_style);
                        }
                        // Close link
                        echo '</a><!-- .wpex-carousel-entry-img -->';
                        // Outside Overlay
                        if ($overlay_style) {
                            wpex_overlay('outside_link', $overlay_style);
                        }
                    }
                    ?>
							</div><!-- .wpex-carousel-entry-media -->
						<?php 
                }
                ?>

						<?php 
                // Title
                if ('true' == $title || 'true' == $excerpt) {
                    ?>
							<div class="wpex-carousel-entry-details clr"<?php 
                    echo $content_style;
                    ?>
>
								<?php 
                    // Title
                    if ('true' == $title && $post_title) {
                        ?>
									<div class="wpex-carousel-entry-title"<?php 
                        echo $heading_style;
                        ?>
>
										<a href="<?php 
                        echo $permalink;
                        ?>
" title="<?php 
                        echo $post_title;
                        ?>
"<?php 
                        echo $content_heading_color;
                        ?>
><?php 
                        echo $post_title;
                        ?>
</a>
									</div>
								<?php 
                    }
                    // Excerpt
                    if ('true' == $excerpt) {
                        if ('true' == $custom_excerpt_trim) {
                            $custom_excerpt_trim = true;
                        } else {
                            $custom_excerpt_trim = false;
                        }
                        $excerpt_array = array('length' => intval($excerpt_length), 'readmore' => false, 'trim_custom_excerpts' => $custom_excerpt_trim);
                        // Generate excerpt
                        $get_excerpt = vcex_get_excerpt($excerpt_array);
                        if ($get_excerpt) {
                            ?>
										<div class="wpex-carousel-entry-excerpt clr">
											<?php 
                            echo $get_excerpt;
                            ?>
										</div><!-- .wpex-carousel-entry-excerpt -->
									<?php 
                        }
                        ?>
								<?php 
                    }
                    ?>
							</div><!-- .wpex-carousel-entry-details -->
						<?php 
                }
                ?>
					</div><!-- .wpex-carousel-slide -->
				<?php 
                // End foreach loop
            }
            ?>
			</div><!-- .wpex-carousel -->
	
		<?php 
        }
        // End has posts check
        // Set things back to normal
        wp_reset_postdata();
        // Return outbut buffer
        return ob_get_clean();
    }
Ejemplo n.º 5
0
/**
 * Notice when no posts are found
 *
 * @since 2.0.0
 */
function vcex_no_posts_found_message($atts)
{
    if (wpex_is_front_end_composer()) {
        return '<div class="vcex-no-posts-found">' . apply_filters('vcex_no_posts_found_message', esc_html__('No posts found for your query.', 'total')) . '</div>';
    }
}
 if ('lightbox' == $thumbnail_link) {
     vcex_enque_style('ilightbox', $lightbox_skin);
     $atts['lightbox_data'] = array();
     $atts['lightbox_data'][] = 'data-type="image"';
     if ($lightbox_skin) {
         $atts['lightbox_data'][] = 'data-skin="' . $lightbox_skin . '"';
     }
 }
 // Output js for front-end editor
 $inline_js = array('carousel');
 if ('lightbox' == $thumbnail_link) {
     $inline_js[] = 'ilightbox';
 }
 vcex_inline_js($inline_js);
 // Prevent auto play in visual composer
 if (wpex_is_front_end_composer()) {
     $auto_play = 'false';
 }
 // Item Margin
 if ('no-margins' == $style) {
     $items_margin = '0';
 }
 // Items to scroll fallback for old setting
 if ('page' == $items_scroll) {
     $items_scroll = $items;
 }
 // Title design
 if ('yes' == $title) {
     $heading_style = vcex_inline_style(array('margin' => $content_heading_margin, 'text_transform' => $content_heading_transform, 'font_weight' => $content_heading_weight, 'font_size' => $content_heading_size, 'color' => $content_heading_color));
 }
 // Content Design
Ejemplo n.º 7
0
    function vcex_feature_box_shortcode($atts, $content = NULL)
    {
        extract(shortcode_atts(array('unique_id' => '', 'classes' => '', 'heading' => '', 'equal_heights' => '', 'padding' => '', 'border' => '', 'background' => '', 'heading_type' => 'h2', 'heading_color' => '', 'heading_size' => '', 'heading_margin' => '', 'heading_weight' => '', 'heading_letter_spacing' => '', 'heading_transform' => '', 'tablet_widths' => '', 'phone_widths' => '', 'style' => 'left-content-right-image', 'text_align' => '', 'image_lightbox' => '', 'image' => '', 'img_width' => '9999', 'img_height' => '9999', 'img_border_radius' => '', 'video' => '', 'heading_url' => '', 'content_background' => '', 'css_animation' => '', 'img_filter' => '', 'image_url' => '', 'img_hover_style' => '', 'img_rendering' => '', 'content_font_size' => '', 'content_padding' => '', 'content_color' => '', 'content_font_weight' => '', 'img_style' => '', 'content_width' => '', 'media_width' => ''), $atts));
        // Turn output buffer on
        ob_start();
        // Load equal height for the frontend
        if (function_exists('wpex_is_front_end_composer') && wpex_is_front_end_composer() && $equal_heights) {
            ?>
				<script>
					(function($) {
						"use strict";
						if ($.fn.matchHeight != undefined) {
							$('.match-height-feature-row .match-height-feature').matchHeight();
						}
					})(jQuery);
				</script>
			<?php 
        }
        // If video url is set disable equal heights
        if ($video) {
            $equal_heights = false;
        }
        // ID
        if ($unique_id) {
            $unique_id = ' id="' . $unique_id . '"';
        }
        // Add style
        $inline_style = '';
        if ($padding) {
            $inline_style .= 'padding:' . $padding . ';';
        }
        if ($background) {
            $inline_style .= 'background:' . $background . ';';
        }
        if ($border) {
            $inline_style .= 'border:' . $border . ';';
        }
        if ($inline_style) {
            $inline_style = ' style="' . $inline_style . '"';
        }
        // Classes
        $add_classes = 'vcex-feature-box clr';
        if ('' != $css_animation) {
            $add_classes .= ' wpb_animate_when_almost_visible wpb_' . $css_animation . '';
        }
        if ($style) {
            $add_classes .= ' ' . $style;
        }
        if ($equal_heights) {
            $add_classes .= ' match-height-feature-row';
        }
        if ($tablet_widths) {
            $add_classes .= ' tablet-fullwidth-columns';
        }
        if ($phone_widths) {
            $add_classes .= ' phone-fullwidth-columns';
        }
        if ($text_align) {
            $add_classes .= ' vcex-text-align-' . $text_align;
        }
        if ($classes) {
            $add_classes .= ' ' . $classes;
        }
        ?>

			<div class="<?php 
        echo $add_classes;
        ?>
"<?php 
        echo $unique_id;
        echo $inline_style;
        ?>
>
				<?php 
        // Image/Video check
        if ($image || $video) {
            // Add classes
            $add_classes = 'vcex-feature-box-media clr';
            if ($equal_heights) {
                $add_classes .= ' match-height-feature';
            }
            // Media style
            $inline_style = '';
            if ($media_width) {
                $inline_style .= 'width:' . $media_width . ';';
            }
            if ($inline_style) {
                $inline_style = 'style="' . $inline_style . '"';
            }
            ?>
					<div class="<?php 
            echo $add_classes;
            ?>
" <?php 
            echo $inline_style;
            ?>
>
						<?php 
            /*** Video ***/
            if ($video) {
                ?>
							<div class="vcex-video-wrap">
								<?php 
                echo wp_oembed_get(esc_url($video));
                ?>
							</div><!-- .vcex-feature-box-media -->
						<?php 
            } elseif ($image) {
                // Get image
                $image_img_url = wp_get_attachment_url($image);
                $image_img = wp_get_attachment_url($image);
                $image_alt = strip_tags(get_post_meta($image, '_wp_attachment_image_alt', true));
                $img_crop = $img_height >= '9999' ? false : true;
                // Image inline CSS
                $inline_style = '';
                if ($img_border_radius) {
                    $inline_style .= 'border-radius:' . $img_border_radius . ';';
                }
                if ($inline_style) {
                    $inline_style = 'style="' . $inline_style . '"';
                }
                // Image classes
                $add_classes = 'vcex-feature-box-image';
                if ($equal_heights) {
                    $add_classes .= ' fade-in-image';
                }
                if ($img_filter) {
                    $add_classes .= ' vcex-' . $img_filter;
                }
                if ($img_hover_style && 'true' != $equal_heights) {
                    $add_classes .= ' vcex-img-hover-parent vcex-img-hover-' . $img_hover_style;
                }
                if ($img_rendering) {
                    $add_classes .= ' vcex-image-rendering-' . $img_rendering;
                }
                // Image URL
                if ($image_url || 'image' == $image_lightbox) {
                    // Standard URL
                    $link = vc_build_link($image_url);
                    $a_href = isset($link['url']) ? $link['url'] : '';
                    $a_title = isset($link['title']) ? $link['title'] : '';
                    $a_target = isset($link['target']) ? $link['target'] : '';
                    // Image lightbox
                    $data_attributes = '';
                    if ($image_lightbox) {
                        if ('image' == $image_lightbox) {
                            $a_href = $image_img_url;
                            $add_classes .= ' wpex-lightbox';
                            $data_attributes .= 'data-type="image"';
                        } elseif ('url' == $image_lightbox) {
                            $add_classes .= ' wpex-lightbox';
                            $data_attributes .= 'data-type="iframe"';
                            $data_attributes .= 'data-options="width:1920,height:1080"';
                        } elseif ('auto-detect' == $image_lightbox) {
                            $add_classes .= ' wpex-lightbox-autodetect';
                        } elseif ('video_embed' == $image_lightbox) {
                            $add_classes .= ' wpex-lightbox';
                            $data_attributes .= 'data-type="iframe"';
                            $data_attributes .= 'data-options="width:1920,height:1080"';
                        } elseif ('html5' == $image_lightbox) {
                            $poster = wp_get_attachment_image_src($img_id, 'large');
                            $poster = $poster[0];
                            $add_classes .= ' wpex-lightbox';
                            $data_attributes .= 'data-type="video"';
                            $data_attributes .= 'data-options="width:848, height:480, html5video: { webm: \'' . $lightbox_video_html5_webm . '\', poster: \'' . $poster . '\' }"';
                        } elseif ('quicktime' == $image_lightbox) {
                            $add_classes .= ' wpex-lightbox';
                            $data_attributes .= 'data-type="video"';
                            $data_attributes .= 'data-options="width:1920,height:1080"';
                        }
                    }
                }
                if (isset($a_href) && $a_href) {
                    ?>
								<a href="<?php 
                    echo esc_url($a_href);
                    ?>
" title="<?php 
                    echo $a_title;
                    ?>
" target="<?php 
                    echo $a_target;
                    ?>
" class="vcex-feature-box-image-link <?php 
                    echo $add_classes;
                    ?>
" <?php 
                    echo $inline_style;
                    ?>
 <?php 
                    echo $data_attributes;
                    ?>
>
							<?php 
                } else {
                    ?>
								<div class="<?php 
                    echo $add_classes;
                    ?>
" <?php 
                    echo $inline_style;
                    ?>
>
							<?php 
                }
                ?>
							<img src="<?php 
                echo wpex_image_resize($image_img_url, intval($img_width), intval($img_height), $img_crop);
                ?>
" alt="<?php 
                echo $image_alt;
                ?>
" <?php 
                echo $inline_style;
                ?>
 />
							<?php 
                if (isset($a_href) && $a_href) {
                    ?>
								</a><!-- .vcex-feature-box-image -->
							<?php 
                } else {
                    ?>
								</div><!-- .vcex-feature-box-image -->
							<?php 
                }
                ?>
							<?php 
            }
            // End video check
            ?>
						</div><!-- .vcex-feature-box-media -->
					<?php 
        }
        // $video or $image check
        ?>
					<?php 
        // Content area
        if ($content || $heading) {
            /*** Content Area ***/
            $add_classes = 'vcex-feature-box-content clr';
            if ($equal_heights) {
                $add_classes .= ' match-height-feature';
            }
            $inline_style = '';
            if ($content_width) {
                $inline_style .= 'width:' . $content_width . ';';
            }
            if ($content_background) {
                $inline_style .= 'background:' . $content_background . ';';
            }
            if ($inline_style) {
                $inline_style = 'style="' . $inline_style . '"';
            }
            ?>
					<div class="<?php 
            echo $add_classes;
            ?>
" <?php 
            echo $inline_style;
            ?>
>
						<?php 
            if ($content_padding) {
                ?>
						<div class="vcex-feature-box-padding-container clr" style="padding:<?php 
                echo $content_padding;
                ?>
;">
						<?php 
            }
            ?>
						<?php 
            /*** Heading ***/
            if ($heading) {
                // Heading style
                $inline_style = '';
                if ($heading_color) {
                    $inline_style .= 'color:' . $heading_color . ';';
                }
                if ($heading_size) {
                    $inline_style .= 'font-size:' . $heading_size . ';';
                }
                if ($heading_margin) {
                    $inline_style .= 'margin:' . $heading_margin . ';';
                }
                if ($heading_weight) {
                    $inline_style .= 'font-weight:' . $heading_weight . ';';
                }
                if ($heading_letter_spacing) {
                    $inline_style .= 'letter-spacing:' . $heading_letter_spacing . ';';
                }
                if ($heading_transform) {
                    $inline_style .= 'text-transform:' . $heading_transform . ';';
                }
                if ($inline_style) {
                    $inline_style = 'style="' . $inline_style . '"';
                }
                // Heading URL
                $a_href = '';
                if ($heading_url && '||' != $heading_url) {
                    $link = vc_build_link($heading_url);
                    $a_href = isset($link['url']) ? $link['url'] : '';
                    $a_title = isset($link['title']) ? $link['title'] : '';
                    $a_target = isset($link['target']) ? $link['target'] : '';
                }
                if (isset($a_href) && $a_href) {
                    ?>
								<a href="<?php 
                    echo esc_url($a_href);
                    ?>
" title="<?php 
                    echo $a_title;
                    ?>
" target="<?php 
                    echo $a_target;
                    ?>
" class="vcex-feature-box-heading-link">
							<?php 
                }
                ?>
 
							<<?php 
                echo $heading_type;
                ?>
 class="vcex-feature-box-heading" <?php 
                echo $inline_style;
                ?>
>
								<?php 
                // Display heading
                echo $heading;
                ?>
							</<?php 
                echo $heading_type;
                ?>
>
							<?php 
                if (isset($a_href) && $a_href) {
                    ?>
							</a>
							<?php 
                }
                ?>
						<?php 
            }
            /*** Text ***/
            if ($content) {
                $inline_style = '';
                if ($content_font_size) {
                    $inline_style .= 'font-size:' . $content_font_size . ';';
                }
                if ($content_color) {
                    $inline_style .= 'color:' . $content_color . ';';
                }
                if ($content_font_weight) {
                    $inline_style .= 'font-weight:' . $content_font_weight . ';';
                }
                if ($inline_style) {
                    $inline_style = 'style="' . $inline_style . '"';
                }
                ?>
							<div class="vcex-feature-box-text clr" <?php 
                echo $inline_style;
                ?>
>
								<?php 
                echo apply_filters('the_content', $content);
                ?>
							</div><!-- .vcex-feature-box-text -->
						<?php 
            }
            ?>
						<?php 
            if ($content_padding) {
                ?>
						</div><!-- .vcex-feature-box-padding-container -->
						<?php 
            }
            ?>
					</div><!-- .vcex-feature-box-content -->
				<?php 
        }
        ?>
			</div><!-- .vcex-feature -->
		
		<?php 
        // Return outbut buffer
        return ob_get_clean();
    }
Ejemplo n.º 8
0
 /**
  * Load custom scripts in the front end
  */
 public function theme_css()
 {
     /**
      * Loads all required CSS for the theme
      */
     // Load Visual composer CSS first so it's easier to override
     if (WPEX_VC_ACTIVE) {
         wp_enqueue_style('js_composer_front');
     }
     // Font Awesome First
     wp_enqueue_style('wpex-font-awesome', $this->css_dir_uri . 'font-awesome.min.css');
     // Main Style.css File
     wp_enqueue_style('wpex-style', get_stylesheet_uri());
     // Visual Composer CSS
     if (WPEX_VC_ACTIVE) {
         wp_enqueue_style('wpex-visual-composer', $this->css_dir_uri . 'visual-composer-custom.css', array('js_composer_front'));
         wp_enqueue_style('wpex-visual-composer-extend', $this->css_dir_uri . 'visual-composer-extend.css');
     }
     // WooCommerce CSS
     if (WPEX_WOOCOMMERCE_ACTIVE) {
         wp_enqueue_style('wpex-woocommerce', $this->css_dir_uri . 'woocommerce.css');
     }
     // BBPress CSS
     if (WPEX_BBPRESS_ACTIVE && is_bbpress()) {
         wp_enqueue_style('wpex-bbpress', $this->css_dir_uri . 'bbpress-edits.css', array('bbp-default'));
     }
     // Responsive CSS
     if ($this->is_responsive_enabled && !wpex_is_front_end_composer()) {
         wp_enqueue_style('wpex-responsive', $this->css_dir_uri . 'responsive.css', array('wpex-style'));
     }
     // Ligthbox skin
     wp_enqueue_style('wpex-lightbox-skin', $this->css_dir_uri . 'lightbox/' . $this->lightbox_skin . '-skin/skin.css', array('wpex-style'));
     // Remove unwanted scripts
     wp_deregister_style('js_composer_custom_css');
 }
Ejemplo n.º 9
0
 /**
  * Tweaks the default WP Gallery Output
  *
  * @since 1.0.0
  */
 public static function output($output, $attr)
 {
     // Main Variables
     global $post, $wp_locale, $instance;
     $instance++;
     static $instance = 0;
     $output = '';
     // Sanitize orderby statement
     if (isset($attr['orderby'])) {
         $attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
         if (!$attr['orderby']) {
             unset($attr['orderby']);
         }
     }
     // Get shortcode attributes
     extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'columns' => 3, 'include' => '', 'exclude' => '', 'img_height' => '', 'img_width' => '', 'size' => '', 'crop' => ''), $attr));
     // Get post ID
     $id = intval($id);
     if ('RAND' == $order) {
         $orderby = 'none';
     }
     if (!empty($include)) {
         $include = preg_replace('/[^0-9,]+/', '', $include);
         $_attachments = get_posts(array('include' => $include, 'post_status' => '', 'inherit' => '', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
         $attachments = array();
         foreach ($_attachments as $key => $val) {
             $attachments[$val->ID] = $_attachments[$key];
         }
     } elseif (!empty($exclude)) {
         $exclude = preg_replace('/[^0-9,]+/', '', $exclude);
         $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
     } else {
         $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
     }
     if (empty($attachments)) {
         return '';
     }
     if (is_feed()) {
         $output = "\n";
         $size = $size ? $size : 'thumbnail';
         foreach ($attachments as $attachment_id => $attachment) {
             $output .= wp_get_attachment_link($attachment_id, $size, true) . "\n";
         }
         return $output;
     }
     // Get columns #
     $columns = intval($columns);
     // Set cropping sizes
     if ($columns > 1) {
         $img_width = $img_width ? $img_width : wpex_get_mod('gallery_image_width');
         $img_height = $img_height ? $img_height : wpex_get_mod('gallery_image_height');
     }
     // Sanitize Data
     $size = $size ? $size : 'large';
     $size = $img_width || $img_height ? 'wpex_custom' : $size;
     $crop = $crop ? $crop : 'center-center';
     // Float
     $float = is_rtl() ? 'right' : 'left';
     // Load lightbox skin stylesheet
     wpex_enqueue_ilightbox_skin();
     // Begin output
     $output .= '<div id="gallery-' . $instance . '" class="wpex-gallery wpex-row lightbox-group clr">';
     // Begin Loop
     $count = 0;
     foreach ($attachments as $attachment_id => $attachment) {
         // Increase counter for clearing floats
         $count++;
         // Attachment Vars
         $attachment_data = wpex_get_attachment_data($attachment_id);
         $alt = $attachment_data['alt'];
         $caption = $attachment_data['caption'];
         $video = $attachment_data['video'];
         $lightbox_url = $video ? $video : wpex_get_lightbox_image($attachment_id);
         // Generate the image HTMl
         $img_html = wpex_get_post_thumbnail(array('attachment' => $attachment_id, 'size' => $size, 'width' => $img_width, 'height' => $img_height, 'crop' => $crop));
         // Add data attributes for lightbox
         if ($video) {
             $lightbox_data = ' data-options="thumbnail: \'' . wpex_get_lightbox_image($attachment_id) . '\', width:1920, height:1080"';
         } else {
             $lightbox_data = ' data-type="image"';
         }
         // Start Gallery Item
         $output .= '<figure class="gallery-item ' . wpex_grid_class($columns) . ' col col-' . $count . '">';
         // Display image
         $output .= '<a href="' . $lightbox_url . '" title="' . wp_strip_all_tags($caption) . '" class="wpex-lightbox-group-item"' . $lightbox_data . '>';
         $output .= $img_html;
         $output .= '</a>';
         // Display Caption
         if (trim($attachment->post_excerpt)) {
             if (wpex_is_front_end_composer()) {
                 $output .= '<div class="gallery-caption">' . wptexturize($attachment->post_excerpt) . '</div>';
             } else {
                 $output .= '<figcaption class="gallery-caption">' . wptexturize($attachment->post_excerpt) . '</figcaption>';
             }
         }
         // Close gallery item div
         $output .= "</figure>";
         // Set vars to remove margin on last item of each row and clear floats
         if ($count == $columns) {
             $count = '0';
         }
     }
     // Close gallery div
     $output .= "</div>\n";
     return $output;
 }
Ejemplo n.º 10
0
    function vcex_front_end_carousel_js()
    {
        // Only output on front-end
        if (!wpex_is_front_end_composer()) {
            return;
        }
        ?>
		<script type="text/javascript">
		jQuery(function($){
			if ( $.fn.owlCarousel != undefined ) {
				$('.wpex-carousel').each( function() {
					var $carousel = $(this);
					$carousel.owlCarousel({
						dots			: false,
						items			: $carousel.data("items"),
						slideBy			: $carousel.data("slideby"),
						center			: $carousel.data("center"),
						loop			: $carousel.data("loop"),
						margin			: $carousel.data("margin"),
						nav				: $carousel.data("nav"),
						autoplay		: $carousel.data("autoplay"),
						autoplayTimeout	: $carousel.data("autoplay-timeout"),
						navText			: [ '<span class="fa fa-chevron-left"><span>', '<span class="fa fa-chevron-right"></span>' ],
						responsive		: {
							0	: {
								items	: $carousel.data("items-mobile-portrait")
							},
							480	: {
								 items	: $carousel.data("items-mobile-landscape")
							},
							768	: {
								items	: $carousel.data("items-tablet")
							},
							960	: {
								items	: $carousel.data("items")
							}
						}
					} );
				} );
			}
		} );
		</script>
	<?php 
    }
// Not needed in admin ever
if (is_admin()) {
    return;
}
// Extract shortcode attributes
extract(shortcode_atts(array('unique_id' => '', 'redirect' => '', 'classes' => '', 'unique_id' => '', 'css_animation' => ''), $atts));
// Get classes
$add_classes = 'vcex-login-form clr';
if ($classes) {
    $add_classes .= $this->getExtraClass($classes);
}
if ($css_animation) {
    $add_classes .= $this->getCSSAnimation($css_animation);
}
// Check if user is logged in
if (is_user_logged_in() && !wpex_is_front_end_composer()) {
    // Add logged in class
    $add_classes .= ' logged-in';
    ?>

	<div class="<?php 
    echo $add_classes;
    ?>
" <?php 
    vcex_unique_id($unique_id);
    ?>
>
		<?php 
    echo do_shortcode($content);
    ?>
	</div><!-- .vcex-login-form -->
Ejemplo n.º 12
0
    function vcex_image_carousel_shortcode($atts)
    {
        // Define shortcode params
        extract(shortcode_atts(array('unique_id' => '', 'classes' => '', 'style' => '', 'image_ids' => '', 'center' => 'false', 'timeout_duration' => '5000', 'items' => '4', 'items_margin' => '15', 'infinite_loop' => 'true', 'items_scroll' => '1', 'auto_play' => 'false', 'arrows' => 'true', 'thumbnail_link' => '', 'custom_links' => '', 'custom_links_target' => '', 'img_width' => '9999', 'img_height' => '9999', 'title' => 'false', 'title_type' => '', 'img_filter' => '', 'rounded_image' => '', 'img_hover_style' => '', 'img_rendering' => '', 'caption' => 'false', 'content_background' => '', 'content_heading_margin' => '', 'content_heading_weight' => '', 'content_heading_transform' => '', 'content_margin' => '', 'content_font_size' => '', 'content_padding' => '', 'content_border' => '', 'content_color' => '', 'content_opacity' => '', 'content_heading_color' => '', 'content_heading_size' => '', 'content_alignment' => '', 'tablet_items' => '3', 'mobile_landscape_items' => '2', 'mobile_portrait_items' => '1'), $atts));
        // Turn output buffer on
        ob_start();
        // Get Attachments
        $images = explode(',', $image_ids);
        $images = array_combine($images, $images);
        // Dummy Images
        $dummy_images = NULL;
        if (empty($image_ids)) {
            $dummy_images = true;
            $images = array(WPEX_VCEX_DIR_URI . 'assets/images/dummy1.jpg', WPEX_VCEX_DIR_URI . 'assets/images/dummy2.jpg', WPEX_VCEX_DIR_URI . 'assets/images/dummy3.jpg', WPEX_VCEX_DIR_URI . 'assets/images/dummy4.jpg', WPEX_VCEX_DIR_URI . 'assets/images/dummy5.jpg', WPEX_VCEX_DIR_URI . 'assets/images/dummy6.jpg');
        }
        // Classes
        $img_classes = array();
        if ($rounded_image == 'yes') {
            $img_classes[] = 'vcex-rounded-images';
        }
        if ($img_filter) {
            $img_classes[] = 'vcex-' . $img_filter;
        }
        if ($img_hover_style) {
            $img_classes[] = ' vcex-img-hover-parent vcex-img-hover-' . $img_hover_style;
        }
        $img_classes = implode(' ', $img_classes);
        // Custom Links
        if ($thumbnail_link == 'custom_link') {
            $custom_links = explode(',', $custom_links);
        }
        // Display carousel if there are images
        if ($images) {
            // Output js for front-end editor
            vcex_front_end_carousel_js();
            // Give caroufredsel a unique name
            $rand_num = rand(1, 100);
            $unique_carousel_id = 'carousel-' . $rand_num;
            // Prevent auto play in visual composer
            if (wpex_is_front_end_composer()) {
                $auto_play = 'false';
            }
            // Item Margin
            if ('no-margins' == $style) {
                $items_margin = '0';
            }
            // Items to scroll fallback for old setting
            if ('page' == $items_scroll) {
                $items_scroll = $items;
            }
            // Unique ID
            if ($unique_id) {
                $unique_id = ' id="' . $unique_id . '"';
            }
            // Main Classes
            $add_classes = 'wpex-carousel wpex-carousel-images clr owl-carousel';
            if ($style) {
                $add_classes .= ' ' . $style;
            }
            if ($img_rendering) {
                $add_classes = ' vcex-image-rendering-' . $img_rendering;
            }
            if ($classes) {
                $add_classes .= ' ' . $classes;
            }
            ?>

			<div class="<?php 
            echo $add_classes;
            ?>
"<?php 
            echo $unique_id;
            ?>
 data-items="<?php 
            echo $items;
            ?>
" data-slideby="<?php 
            echo $items_scroll;
            ?>
" data-nav="<?php 
            echo $arrows;
            ?>
" data-autoplay="<?php 
            echo $auto_play;
            ?>
" data-loop="<?php 
            echo $infinite_loop;
            ?>
" data-autoplay-timeout="<?php 
            echo $timeout_duration;
            ?>
" data-center="<?php 
            echo $center;
            ?>
" data-margin="<?php 
            echo intval($items_margin);
            ?>
" data-items-tablet="<?php 
            echo $tablet_items;
            ?>
" data-items-mobile-landscape="<?php 
            echo $mobile_landscape_items;
            ?>
" data-items-mobile-portrait="<?php 
            echo $mobile_portrait_items;
            ?>
">
				<?php 
            // Loop through images
            $count = -1;
            foreach ($images as $attachment) {
                $count++;
                // Attachment VARS
                $attachment_link = get_post_meta($attachment, '_wp_attachment_url', true);
                $attachment_img_url = wp_get_attachment_url($attachment);
                $attachment_alt = strip_tags(get_post_meta($attachment, '_wp_attachment_image_alt', true));
                $attachment_caption = get_post_field('post_excerpt', $attachment);
                $attachment_title = get_the_title($attachment);
                if ('alt' == $title_type) {
                    $attachment_title = $attachment_alt;
                }
                // Get and crop image if needed
                if ($dummy_images) {
                    $attachment_img = $attachment;
                } else {
                    $attachment_img = wp_get_attachment_url($attachment);
                    $img_width = intval($img_width);
                    $img_height = intval($img_height);
                    if ('9999' == $img_height) {
                        $crop = false;
                    } else {
                        $crop = true;
                    }
                    $attachment_img = wpex_image_resize($attachment_img, $img_width, $img_height, $crop);
                }
                // Image output
                $image_output = '<img src="' . $attachment_img . '" alt="' . $attachment_alt . '" />';
                ?>
		
					<div class="wpex-carousel-slide">
						<div class="wpex-carousel-entry-media clr <?php 
                echo $img_classes;
                ?>
">
							<?php 
                // Lightbox
                if ('lightbox' == $thumbnail_link) {
                    ?>
								<a href="<?php 
                    echo $attachment_img_url;
                    ?>
" title="<?php 
                    echo $attachment_alt;
                    ?>
" class="wpex-carousel-entry-img wpex-lightbox">
									<?php 
                    echo $image_output;
                    ?>
								</a><!-- .wpex-carousel-entry-img -->
							<?php 
                } elseif ('custom_link' == $thumbnail_link) {
                    $custom_link = !empty($custom_links[$count]) ? $custom_links[$count] : '#';
                    if ($custom_link == '#') {
                        echo $image_output;
                    } else {
                        ?>
									<a href="<?php 
                        echo esc_url($custom_link);
                        ?>
" title="<?php 
                        echo $attachment_alt;
                        ?>
" class="wpex-carousel-entry-img" target="<?php 
                        echo $custom_links_target;
                        ?>
">
										<?php 
                        echo $image_output;
                        ?>
									</a>
								<?php 
                    }
                } else {
                    echo $image_output;
                }
                ?>
						</div><!-- .wpex-carousel-entry-media -->

						<?php 
                // Open details
                if ('yes' == $title || 'yes' == $caption) {
                    if ($attachment_title || $attachment_caption) {
                        // Content Design
                        $content_style = '';
                        if ($content_background) {
                            $content_style .= 'background:' . $content_background . ';';
                        }
                        if ($content_padding) {
                            $content_style .= 'padding:' . $content_padding . ';';
                        }
                        if ($content_margin) {
                            $content_style .= 'margin:' . $content_margin . ';';
                        }
                        if ($content_border) {
                            $content_style .= 'border:' . $content_border . ';';
                        }
                        if ($content_font_size) {
                            $content_style .= 'font-size:' . $content_font_size . ';';
                        }
                        if ($content_color) {
                            $content_style .= 'color:' . $content_color . ';';
                        }
                        if ($content_opacity) {
                            $content_style .= 'opacity:' . $content_opacity . ';';
                        }
                        if ($content_alignment) {
                            $content_style .= 'text-align:' . $content_alignment . ';';
                        }
                        if ($content_style) {
                            $content_style = ' style="' . $content_style . '"';
                        }
                        ?>
							<div class="wpex-carousel-entry-details clr"<?php 
                        echo $content_style;
                        ?>
>
						<?php 
                    }
                    // Display title
                    if ('yes' == $title && $attachment_title) {
                        // Title design
                        $heading_style = '';
                        if ($content_heading_margin) {
                            $heading_style .= 'margin: ' . $content_heading_margin . ';';
                        }
                        if ($content_heading_transform) {
                            $heading_style .= 'text-transform: ' . $content_heading_transform . ';';
                        }
                        if ($content_heading_weight) {
                            $heading_style .= 'font-weight: ' . $content_heading_weight . ';';
                        }
                        if ($content_heading_size) {
                            $heading_style .= 'font-size: ' . $content_heading_size . ';';
                        }
                        if ($content_heading_color) {
                            $heading_style .= 'color: ' . $content_heading_color . ';';
                        }
                        if ($heading_style) {
                            $heading_style = ' style="' . $heading_style . '"';
                        }
                        ?>
								<div class="wpex-carousel-entry-title"<?php 
                        echo $heading_style;
                        ?>
><?php 
                        echo $attachment_title;
                        ?>
</div>
							<?php 
                    }
                    // Display caption
                    if ('yes' == $caption && $attachment_caption) {
                        ?>
								<div class="wpex-carousel-entry-excerpt"><?php 
                        echo $attachment_caption;
                        ?>
</div>
							<?php 
                    }
                    // Close details
                    if ('yes' == $title || 'yes' == $caption) {
                        if ($attachment_title || $attachment_caption) {
                            ?>
									</div>
								<?php 
                        }
                    }
                }
                ?>
					</div><!-- .wpex-carousel-slide -->
				
				<?php 
                // End foreach loop
            }
            ?>
			</div><!-- .wpex-carousel -->
	
		<?php 
        }
        // End has images check
        // Return outbut buffer
        return ob_get_clean();
    }
Ejemplo n.º 13
0
    function vcex_skillbar_shortcode($atts)
    {
        extract(shortcode_atts(array('title' => '', 'percentage' => '100', 'background' => '', 'box_shadow' => '', 'color' => '#6adcfa', 'class' => '', 'show_percent' => 'true', 'css_animation' => '', 'icon' => ''), $atts));
        // Enable output buffer
        ob_start();
        // Classes
        $classes = 'vcex-skillbar clr';
        if ($class) {
            $classes .= ' ' . $class;
        }
        if ('' != $css_animation) {
            $classes .= ' wpb_animate_when_almost_visible wpb_' . $css_animation;
        }
        // Style
        $style = '';
        if ($background) {
            $style .= 'background:' . $background . ';';
        }
        if ('false' == $box_shadow) {
            $style .= 'box-shadow: none;';
        }
        if ($style) {
            $style = ' style="' . $style . '"';
        }
        // Front End composer js
        if (wpex_is_front_end_composer()) {
            ?>
				<script type="text/javascript">
					jQuery(function($){
						$('.vcex-skillbar').each(function(){
							$(this).find('.vcex-skillbar-bar').animate({ width: $(this).attr('data-percent') }, 800 );
						});
					});
				</script>
			<?php 
        }
        ?>

			<div class="<?php 
        echo $classes;
        ?>
" data-percent="<?php 
        echo $percentage;
        ?>
%"<?php 
        echo $style;
        ?>
>
				<div class="vcex-skillbar-title" style="background: <?php 
        echo $color;
        ?>
;">
					<span>
						<?php 
        if ($icon) {
            ?>
							<i class="fa fa-<?php 
            echo $icon;
            ?>
"></i>
						<?php 
        }
        ?>
						<?php 
        echo $title;
        ?>
					</span>
				</div>
				<div class="vcex-skillbar-bar" style="background:<?php 
        echo $color;
        ?>
;">
					<?php 
        if ($show_percent == 'true') {
            ?>
						<div class="vcex-skill-bar-percent"><?php 
            echo $percentage;
            ?>
%</div>
					<?php 
        }
        ?>
				</div>
			</div>

		<?php 
        // Return content
        return ob_get_clean();
    }
Ejemplo n.º 14
0
    function vcex_data_hover_js()
    {
        // Only output on front-end
        if (!wpex_is_front_end_composer()) {
            return;
        }
        ?>
		<script type="text/javascript">
		jQuery(function($){
			$(".wpex-data-hover").each(function(){var e=$(this),t=$(this).css("backgroundColor"),n=$(this).css("color"),r=$(this).attr("data-hover-background"),i=$(this).attr("data-hover-color");e.hover(function(){if(r){e.css("background-color",r)}if(i){e.css("color",i)}},function(){if(r&&t){e.css("background-color",t)}if(i&&n){e.css("color",n)}})})
		});
		</script>
	<?php 
    }