Пример #1
0
function vc_team_widget_func($atts, $content = null)
{
    extract(shortcode_atts(array('carousel' => '', 'carousel_autoheight' => '', 'carousel_margin' => '', 'carousel_navi' => '', 'carousel_dots_navi' => '', 'carousel_autoplay' => '', 'carousel_autoplaytimeout' => '', 'carousel_autoplayhoverpause' => '', 'carousel_loop' => '', 'columns' => '', 'image_size' => '', 'items' => '', 'cat_filter' => '', 'order' => '', 'orderby' => '', 'vc_progress_bar' => '', 'social_media' => ''), $atts));
    if (empty($image_size)) {
        $image_size = 'theme-size-2x3';
    }
    if (empty($columns)) {
        $columns = '3';
    }
    if (empty($orderby)) {
        $orderby = 'date';
    }
    if (empty($order)) {
        $order = 'DESC';
    }
    if ($items) {
        $posts_per_page = '&posts_per_page=' . $items . '';
    } else {
        $posts_per_page = '&posts_per_page=-1';
    }
    if ($carousel) {
        if ($columns == "3") {
            $columns = "4";
        } elseif ($columns == "4") {
            $columns = "3";
        } elseif ($columns == "6") {
            $columns = "2";
        }
        global $shortcode_atts;
        $shortcode_atts = array('carousel_autoheight' => $carousel_autoheight, 'carousel_margin' => $carousel_margin, 'carousel_navi' => $carousel_navi, 'carousel_dots_navi' => $carousel_dots_navi, 'carousel_autoplay' => $carousel_autoplay, 'carousel_autoplaytimeout' => $carousel_autoplaytimeout, 'carousel_autoplayhoverpause' => $carousel_autoplayhoverpause, 'carousel_loop' => $carousel_loop, 'columns' => $columns);
        lpd_owl_carousel();
        global $the_team_widget_ID;
        $the_team_widget_ID = rand();
    }
    if ($cat_filter) {
        $cat_filter = '&team_category=' . $cat_filter;
    }
    ob_start();
    ?>
   
   <div class="lpd_team_widget">
   <div class="row">
   
   <?php 
    if ($carousel) {
        ?>
<div class="col-md-12 owl-carousel-<?php 
        echo esc_attr($the_team_widget_ID);
        ?>
"><?php 
    }
    ?>
	   
		<?php 
    $query = new WP_Query();
    ?>
		<?php 
    $query->query('post_type=team' . $posts_per_page . '' . $cat_filter . '&orderby=' . $orderby . '&order=' . $order . '');
    ?>
			
        <?php 
    if ($query->have_posts()) {
        while ($query->have_posts()) {
            $query->the_post();
            ?>
		
		<?php 
            $position = get_post_meta(get_the_ID(), 'team_options_text', true);
            ?>
		<?php 
            $facebook = get_post_meta(get_the_ID(), 'team_options_facebook', true);
            ?>
		<?php 
            $twitter = get_post_meta(get_the_ID(), 'team_options_twitter', true);
            ?>
		<?php 
            $linkedin = get_post_meta(get_the_ID(), 'team_options_linkedin', true);
            ?>
		<?php 
            $pinterest = get_post_meta(get_the_ID(), 'team_options_pinterest', true);
            ?>
		<?php 
            $google_plus = get_post_meta(get_the_ID(), 'team_options_google_plus', true);
            ?>
		<?php 
            $tumblr = get_post_meta(get_the_ID(), 'team_options_tumblr', true);
            ?>
		<?php 
            $instagram = get_post_meta(get_the_ID(), 'team_options_instagram', true);
            ?>
		<?php 
            $custom1_icon = get_post_meta(get_the_ID(), 'team_options_custom1_icon', true);
            ?>
		<?php 
            $custom1_title = get_post_meta(get_the_ID(), 'team_options_custom1_title', true);
            ?>
		<?php 
            $custom1_url = get_post_meta(get_the_ID(), 'team_options_custom1_url', true);
            ?>
		<?php 
            $custom2_icon = get_post_meta(get_the_ID(), 'team_options_custom2_icon', true);
            ?>
		<?php 
            $custom2_title = get_post_meta(get_the_ID(), 'team_options_custom2_title', true);
            ?>
		<?php 
            $custom2_url = get_post_meta(get_the_ID(), 'team_options_custom2_url', true);
            ?>
		<?php 
            $progress_bar = get_post_meta(get_the_ID(), 'team_options_repeatable', true);
            ?>
		<?php 
            if ($progress_bar) {
                $progress_bar = array_filter($progress_bar);
            }
            ?>
					
		
		<?php 
            if (!$carousel) {
                ?>
<div class="col-md-<?php 
                echo esc_attr($columns);
                ?>
"><?php 
            }
            ?>
			<div class="team-widget-item">
				
		        <?php 
            if (has_post_thumbnail()) {
                ?>
					<a href="<?php 
                the_permalink();
                ?>
" class="team-widget-thumbnail">
						<img alt="<?php 
                the_title();
                ?>
" class="img-responsive" src="<?php 
                $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), $image_size);
                echo esc_url($image[0]);
                ?>
"/>
					</a>
				<?php 
            } else {
                ?>
			        <a href="<?php 
                the_permalink();
                ?>
">
			        	<img class="img-responsive" alt="<?php 
                the_title();
                ?>
" src="<?php 
                echo THEME_ASSETS;
                ?>
img/no-image.png"/>
					</a>
		        <?php 
            }
            ?>
		        
		       <div class="team-widget-content">
					
					<div class="tw-title">
						<div class="ribbon tw-ribbon">
							<span class="ribbon-content">
								<span class="content-ribbon"><a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a></span>
							</span>
						</div>
					</div>
					<?php 
            if ($position) {
                ?>
                    	<div class="member-position"><span><?php 
                echo esc_html($position);
                ?>
</span></div>
                    <?php 
            }
            ?>
					<div class="tw_content">
						<p><?php 
            echo lpd_excerpt(15);
            ?>
</p>
						
						<?php 
            if ($vc_progress_bar) {
                ?>
						<?php 
                $separator = "|";
                $output = '';
                foreach ($progress_bar as $item) {
                    if ($item) {
                        list($item_text1, $item_text2) = explode($separator, trim($item));
                        $output .= '<div class="lpd-progress-bar">';
                        $output .= '	<span class="progress-title">' . esc_html($item_text2) . ' ' . esc_html($item_text1) . '%</span>';
                        $output .= '	<div class="progress">';
                        $output .= '	  <div class="progress-bar progress-bar-striped" role="progressbar" aria-valuenow="' . esc_attr($item_text1) . '" aria-valuemin="0" aria-valuemax="100" style="width: ' . esc_attr($item_text1) . '%;">';
                        $output .= '	    <span class="sr-only">' . esc_html($item_text1) . '% ' . esc_html($item_text2) . '</span>';
                        $output .= '	  </div>';
                        $output .= '	</div>';
                        $output .= '</div>';
                    }
                }
                echo $output;
                ?>
				        <?php 
            }
            ?>
						
					</div>
					
					<?php 
            if ($social_media) {
                ?>
		                        
						<?php 
                if ($facebook || $twitter || $linkedin || $pinterest || $google_plus || $tumblr || $instagram || $custom1_icon || $custom2_icon) {
                    ?>
						<div class="team-widget-social-details picons_social lpd-animated-link">
							<ul>
								<?php 
                    if ($facebook) {
                        ?>
<li><a href="<?php 
                        echo esc_url($facebook);
                        ?>
" class="icon facebook1"></a></li><?php 
                    }
                    ?>
								<?php 
                    if ($twitter) {
                        ?>
<li><a href="<?php 
                        echo esc_url($twitter);
                        ?>
" class="icon twitter1"></a></li><?php 
                    }
                    ?>
								<?php 
                    if ($linkedin) {
                        ?>
<li><a href="<?php 
                        echo esc_url($linkedin);
                        ?>
" class="icon linkedin1"></a></li><?php 
                    }
                    ?>
								<?php 
                    if ($pinterest) {
                        ?>
<li><a href="<?php 
                        echo esc_url($pinterest);
                        ?>
" class="icon pinterest1"></a></li><?php 
                    }
                    ?>
								<?php 
                    if ($google_plus) {
                        ?>
<li><a href="<?php 
                        echo esc_url($google_plus);
                        ?>
" class="icon google_plus1"></a></li><?php 
                    }
                    ?>
								<?php 
                    if ($tumblr) {
                        ?>
<li><a href="<?php 
                        echo esc_url($tumblr);
                        ?>
" class="icon tumblr1"></a></li><?php 
                    }
                    ?>
								<?php 
                    if ($instagram) {
                        ?>
<li><a href="<?php 
                        echo esc_url($instagram);
                        ?>
" class="icon instagram1"></a></li><?php 
                    }
                    ?>
								
								<?php 
                    if ($custom1_icon && $custom1_url) {
                        ?>
<li><a href="<?php 
                        echo esc_url($custom1_url);
                        ?>
" class="icon custom-icon"<?php 
                        if ($custom1_icon) {
                            ?>
 style="background-image:url(<?php 
                            $custom1_icon_image = wp_get_attachment_image_src($custom1_icon, 'full');
                            echo $custom1_icon_image[0];
                            ?>
);"<?php 
                        }
                        ?>
></a></li><?php 
                    }
                    ?>
								<?php 
                    if ($custom2_icon && $custom2_url) {
                        ?>
<li><a href="<?php 
                        echo esc_url($custom2_url);
                        ?>
" class="icon custom-icon"<?php 
                        if ($custom2_icon) {
                            ?>
 style="background-image:url(<?php 
                            $custom2_icon_image = wp_get_attachment_image_src($custom2_icon, 'full');
                            echo $custom2_icon_image[0];
                            ?>
);"<?php 
                        }
                        ?>
></a></li><?php 
                    }
                    ?>
							</ul>
						</div>
						<?php 
                }
                ?>
					<?php 
            }
            ?>
					
		        
		       </div>				       

			</div>
		<?php 
            if (!$carousel) {
                ?>
</div><?php 
            }
            ?>
		
		<?php 
        }
    }
    wp_reset_query();
    ?>
		
	<?php 
    if ($carousel) {
        ?>
</div><?php 
    }
    ?>
	   
	</div>
	</div>
	
	<?php 
    if ($carousel) {
        $counter_js = new team_widget_class();
        $counter_js->team_widget_callback();
    }
    ?>
   
   <?php 
    return ob_get_clean();
}
Пример #2
0
function vc_widget_func($atts, $content = null)
{
    extract(shortcode_atts(array('post_type' => '', 'image_size' => '', 'carousel' => '', 'carousel_autoheight' => '', 'carousel_margin' => '', 'carousel_navi' => '', 'carousel_dots_navi' => '', 'carousel_autoplay' => '', 'carousel_autoplaytimeout' => '', 'carousel_autoplayhoverpause' => '', 'carousel_loop' => '', 'columns' => '', 'items' => '', 'cat_filter' => '', 'thumbnails' => '', 'caption' => '', 'order' => '', 'orderby' => ''), $atts));
    if (empty($post_type)) {
        $post_type = 'post';
    }
    if (empty($image_size)) {
        $image_size = 'theme-size-3x2';
    }
    if (empty($columns)) {
        $columns = '3';
    }
    if (empty($orderby)) {
        $orderby = 'date';
    }
    if (empty($order)) {
        $order = 'DESC';
    }
    if ($post_type == "post") {
        $post_type = "post";
        $cat_terms = "category";
    } else {
        $post_type = "portfolio";
        $cat_terms = "portfolio_category";
    }
    if ($items) {
        $posts_per_page = '&posts_per_page=' . $items . '';
    } else {
        $posts_per_page = '&posts_per_page=-1';
    }
    if ($post_type == "portfolio") {
        $category_filter = '&portfolio_category=' . $cat_filter;
    } else {
        $category_filter = '&category_name=' . $cat_filter;
    }
    if ($carousel) {
        if ($columns == "3") {
            $columns = "4";
        } elseif ($columns == "4") {
            $columns = "3";
        } elseif ($columns == "6") {
            $columns = "2";
        }
        global $shortcode_atts;
        $shortcode_atts = array('carousel_autoheight' => $carousel_autoheight, 'carousel_margin' => $carousel_margin, 'carousel_navi' => $carousel_navi, 'carousel_dots_navi' => $carousel_dots_navi, 'carousel_autoplay' => $carousel_autoplay, 'carousel_autoplaytimeout' => $carousel_autoplaytimeout, 'carousel_autoplayhoverpause' => $carousel_autoplayhoverpause, 'carousel_loop' => $carousel_loop, 'columns' => $columns);
        lpd_owl_carousel();
        global $the_post_widget_ID;
        $the_post_widget_ID = rand();
    }
    ob_start();
    ?>
	
						<div class="post-widget">
							<div class="row">
							<?php 
    if ($carousel) {
        ?>
<div class="col-md-12 owl-carousel-<?php 
        echo esc_attr($the_post_widget_ID);
        ?>
"><?php 
    }
    ?>
	
	
						<?php 
    $query = new WP_Query();
    ?>
						<?php 
    $query->query('post_type=' . $post_type . '' . $posts_per_page . '' . $category_filter . '&orderby=' . $orderby . '&order=' . $order . '');
    ?>
							
                        <?php 
    if ($query->have_posts()) {
        while ($query->have_posts()) {
            $query->the_post();
            ?>
                        
						<?php 
            $video = lpd_parse_video(get_post_meta(get_the_ID(), 'video_post_meta', true));
            ?>
						<?php 
            $link = get_post_meta(get_the_ID(), 'link_post_meta', true);
            ?>
						
						<?php 
            $gallery_type = get_post_meta(get_the_ID(), 'portfolio_options_select', true);
            ?>
						<?php 
            $terms = get_the_terms(get_the_ID(), $cat_terms);
            ?>
						
						<?php 
            if ($post_type == "portfolio") {
                ?>
							<?php 
                $header_image = wp_get_attachment_image_src(get_post_meta(get_the_ID(), 'portfolio_header_image', true), $image_size);
                ?>
						<?php 
            } else {
                ?>
							<?php 
                $header_image = wp_get_attachment_image_src(get_post_meta(get_the_ID(), 'post_header_image', true), $image_size);
                ?>
						<?php 
            }
            ?>
						
						  
	<?php 
            if (!$carousel) {
                ?>
<div class="col-md-<?php 
                echo esc_attr($columns);
                ?>
"><?php 
            }
            ?>
		<div class="lpd-post-widget">
		<?php 
            if (!$thumbnails) {
                ?>
			<?php 
                if ($link) {
                    ?>
		        <?php 
                    if (has_post_thumbnail()) {
                        ?>
					<a href="<?php 
                        echo esc_url($link);
                        ?>
" class="pw-thumbnail">
						<img alt="<?php 
                        the_title();
                        ?>
" class="img-responsive" src="<?php 
                        $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), $image_size);
                        echo esc_url($image[0]);
                        ?>
"/>
						<span class="post-type-icon link"></span>
					</a>
				<?php 
                    } elseif ($header_image) {
                        ?>
					<a href="<?php 
                        the_permalink();
                        ?>
" class="pw-thumbnail">
						<img alt="<?php 
                        the_title();
                        ?>
" class="img-responsive" src="<?php 
                        echo esc_url($header_image[0]);
                        ?>
"/>
						<span class="post-type-icon link"></span>
					</a>
				<?php 
                    } else {
                        ?>
			        <a href="<?php 
                        echo esc_url($link);
                        ?>
" class="pw-thumbnail">
			        	<img class="img-responsive" alt="<?php 
                        the_title();
                        ?>
" src="<?php 
                        echo THEME_ASSETS;
                        ?>
img/no-image.png"/>
			        	<span class="post-type-icon link"></span>
					</a>
		        <?php 
                    }
                    ?>
		    <?php 
                } elseif ($video) {
                    ?>
		        <?php 
                    if (has_post_thumbnail()) {
                        ?>
					<a href="<?php 
                        the_permalink();
                        ?>
" class="pw-thumbnail">
						<img alt="<?php 
                        the_title();
                        ?>
" class="img-responsive" src="<?php 
                        $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), $image_size);
                        echo esc_url($image[0]);
                        ?>
"/>
						<span class="post-type-icon video"></span>
					</a>
				<?php 
                    } elseif ($header_image) {
                        ?>
					<a href="<?php 
                        the_permalink();
                        ?>
" class="pw-thumbnail">
						<img alt="<?php 
                        the_title();
                        ?>
" class="img-responsive" src="<?php 
                        echo esc_url($header_image[0]);
                        ?>
"/>
						<span class="post-type-icon video"></span>
					</a>
				<?php 
                    } else {
                        ?>
			        <a href="<?php 
                        the_permalink();
                        ?>
" class="pw-thumbnail">
			        	<img class="img-responsive" alt="<?php 
                        the_title();
                        ?>
" src="<?php 
                        echo THEME_ASSETS;
                        ?>
img/no-image.png"/>
			        	<span class="post-type-icon video"></span>
					</a>
		        <?php 
                    }
                    ?>
		    <?php 
                } elseif (function_exists('has_post_thumbnail') && has_post_thumbnail()) {
                    ?>
				<a href="<?php 
                    the_permalink();
                    ?>
" class="pw-thumbnail">
					<?php 
                    if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {
                        ?>
					<img alt="<?php 
                        the_title();
                        ?>
" class="img-responsive" src="<?php 
                        $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), $image_size);
                        echo esc_url($image[0]);
                        ?>
"/>
					<span class="post-type-icon"></span>
					<?php 
                    }
                    ?>
				</a>
			<?php 
                } else {
                    ?>
				<?php 
                    if ($header_image) {
                        ?>
					<a href="<?php 
                        the_permalink();
                        ?>
" class="pw-thumbnail">
						<img alt="<?php 
                        the_title();
                        ?>
" class="img-responsive" src="<?php 
                        echo esc_url($header_image[0]);
                        ?>
"/>
						<span class="post-type-icon"></span>
					</a>
				<?php 
                    } else {
                        ?>
		        <a href="<?php 
                        the_permalink();
                        ?>
" class="pw-thumbnail">
		        	<img class="img-responsive" alt="<?php 
                        the_title();
                        ?>
" src="<?php 
                        echo THEME_ASSETS;
                        ?>
img/no-image.png"/>
		        	<span class="post-type-icon"></span>
				</a>
				<?php 
                    }
                    ?>
		    <?php 
                }
                ?>
	    <?php 
            }
            ?>
			<div class="widget-meta">
				<div class="ribbon"><span class="ribbon-content"></span></div>
				<table>
					<tbody>
						<tr>
							<td class="pw-author"><a href="<?php 
            echo esc_url(get_author_posts_url(get_the_author_meta('ID')));
            ?>
" class="author"><?php 
            echo esc_html(get_the_author());
            ?>
</a></td>
							<?php 
            if ($terms) {
                ?>
<td class="pw-category">
								
							<?php 
                $resultstr = array();
                ?>
				            <?php 
                if ($terms) {
                    foreach ($terms as $term) {
                        ?>
				                <?php 
                        $resultstr[] = '<a title="' . esc_attr($term->name) . '" href="' . esc_url(get_term_link($term->slug, $cat_terms)) . '">' . esc_html($term->name) . '</a>';
                        ?>
				            <?php 
                    }
                    ?>
				            <?php 
                    echo $resultstr[0];
                }
                ?>
								
							</td><?php 
            }
            ?>
							<td class="pw-date"><a href="<?php 
            echo esc_url(get_day_link(get_the_time('Y'), get_the_time('m'), get_the_time('d')));
            ?>
" class="date"><?php 
            the_time('M j, Y');
            ?>
</a></td>
						</tr>
					</tbody>
				</table>
			</div>	
			<div class="content<?php 
            if ($thumbnails) {
                ?>
 no-thumbnail<?php 
            }
            ?>
">
				<?php 
            if ($link) {
                ?>
				<h4 class="title lpd-animated-link"><a href="<?php 
                echo esc_url($link);
                ?>
"><?php 
                the_title();
                ?>
</a></h4>
				<?php 
            } else {
                ?>
				<h4 class="title lpd-animated-link"><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></h4>
				<?php 
            }
            ?>
				<?php 
            if (!$caption) {
                ?>
					<div class="lpd-post-widget-content">
						<p><?php 
                echo lpd_excerpt(15);
                ?>
</p>
					</div>
				<?php 
            }
            ?>
				<div class="lpd-post-widget-element"></div>	
			</div>
		</div>
	<?php 
            if (!$carousel) {
                ?>
</div><?php 
            }
            ?>
	
						<?php 
        }
    }
    wp_reset_query();
    ?>
	
							<?php 
    if ($carousel) {
        ?>
</div><?php 
    }
    ?>
							</div>
						</div>
						
	<?php 
    if ($carousel) {
        $counter_js = new post_widget_class();
        $counter_js->post_widget_callback();
    }
    ?>
						
	<?php 
    return ob_get_clean();
}
        } else {
            ?>
							<h4 class="title lpd-animated-link"><a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a></h4>
							<?php 
        }
        ?>
	
							<div class="lpd-post-widget-content">
								<p><?php 
        echo lpd_excerpt(15);
        ?>
</p>
							</div>
							<div class="lpd-post-widget-element"></div>	
						</div>
					</div>
				</div>

		        <?php 
    }
} else {
    ?>
			        <div class="no-post-matched"><?php 
    esc_html_e('Sorry, no posts matched your criteria.', GETTEXT_DOMAIN);
    ?>