Exemple #1
0
    function wd_recent_blogs_functions($atts, $content = false)
    {
        extract(shortcode_atts(array('category' => '', 'columns' => 4, 'number_posts' => 4, 'show_type' => 'grid', 'title' => 1, 'thumbnail' => 1, 'meta' => 1, 'show_date' => 1, 'excerpt' => 1, 'excerpt_words' => 20), $atts));
        $args = array('post_type' => 'post', 'ignore_sticky_posts' => 1, 'posts_per_page' => $number_posts);
        if (strlen($category) > 0) {
            $args = array('post_type' => 'post', 'ignore_sticky_posts' => 1, 'posts_per_page' => $number_posts, 'category_name' => $category);
        }
        $recent_posts = new WP_Query($args);
        $ret_html = '';
        if ($recent_posts->have_posts()) {
            $num_count = $recent_posts->post_count;
            $id_widget = 'recent-blog-wrapper' . rand(0, 1000);
            ob_start();
            echo '<div class="shortcode-recent-blogs ' . $show_type . ' columns-' . $columns . '">';
            ?>
			<div id="<?php 
            echo $id_widget;
            ?>
" class="blog-wrapper">
			<?php 
            $i = 0;
            while ($recent_posts->have_posts()) {
                $recent_posts->the_post();
                global $post;
                ?>
				<article class="item <?php 
                if ($i == 0 || $i % $columns == 0) {
                    echo ' first';
                }
                if ($i == $num_count - 1 || $i % $columns == $columns - 1) {
                    echo ' last';
                }
                ?>
">
					<div class="header-wrapper">
						<?php 
                if ($thumbnail) {
                    ?>
						<a class="thumbnail" href="<?php 
                    the_permalink();
                    ?>
">
							<?php 
                    the_post_thumbnail('blog_shortcode', array('class' => 'thumbnail-effect-1'));
                    ?>
							<div class="effect_hover_image"></div>
						</a>
						<?php 
                }
                ?>
						<?php 
                if ($show_date) {
                    ?>
							<span class="date-time">
								<span><?php 
                    echo get_the_time('d');
                    ?>
</span>
								<span><?php 
                    echo get_the_time('M');
                    ?>
</span>
							</span>
						<?php 
                }
                ?>
					</div>
					<div class="detail">
						<?php 
                if ($title) {
                    ?>
						<h3 class="heading-title"><a href="<?php 
                    echo get_permalink($post->ID);
                    ?>
" class="wpt_title"  ><?php 
                    echo get_the_title($post->ID);
                    ?>
</a></h3>
						<?php 
                }
                ?>
						
						<?php 
                if ($excerpt) {
                    ?>
						<p class="excerpt"><?php 
                    the_excerpt_max_words($excerpt_words);
                    ?>
</p>
						<?php 
                }
                ?>
						
						<?php 
                if ($meta) {
                    ?>
						<div class="info-meta">
							<span class="author"><i class="fa fa-user"></i><?php 
                    _e('', 'wpdance');
                    ?>
 <?php 
                    the_author_posts_link();
                    ?>
 
							</span>
							
							<span class="comments-count"><i class="fa fa-comment-o"></i><span class="number"><?php 
                    $comments_count = wp_count_comments($post->ID);
                    if ($comments_count->approved < 10 && $comments_count->approved > 0) {
                        echo '0';
                    }
                    echo $comments_count->approved;
                    ?>
</span>
							</span>
						</div>
						<?php 
                }
                ?>
					</div>	
				</article>
			<?php 
                $i++;
            }
            echo '</div>';
            echo '</div>';
            $ret_html = ob_get_contents();
            ob_end_clean();
            //ob_end_flush();
        }
        wp_reset_postdata();
        return $ret_html;
    }
Exemple #2
0
            ?>
/images/no-image-thumbnail.jpg"/>
										<?php 
        }
        ?>
									<div class="effect_hover_image"></div>
								</a>
								<a class="title bold-upper-normal" href="<?php 
        the_permalink();
        ?>
"><?php 
        the_title();
        ?>
</a>
								<p class="excerpt"><?php 
        the_excerpt_max_words(20);
        ?>
</p>
								<span class="author vcard"><i class="fa fa-user"></i><?php 
        the_author_link();
        ?>
</span>
							</div>
						</article>
					<?php 
    }
    wp_reset_postdata();
}
?>
		</div>
	</div>
Exemple #3
0
the_permalink();
?>
"><?php 
the_title();
?>
</a></h3>
			<?php 
edit_post_link(__('Edit', 'wpdance'), '<span class="wd-edit-link hidden-phone">', '</span>');
?>
	
		</header>
		<?php 
if ($wd_data['wd_blog_excerpt'] == 1) {
    ?>
			<div class="short-content"><?php 
    the_excerpt_max_words(50, $post);
    ?>
</div>
		<?php 
}
?>
					
		<div class="post-info-meta">	
			
			<?php 
if ($wd_data['wd_blog_author'] == 1) {
    ?>
				<span class="author">
					<i class="fa fa-user"></i><?php 
    //_e('Post by','wpdance')
    the_author_posts_link();
        function widget($args, $instance)
        {
            global $wpdb;
            // call global for use in function
            $cache = wp_cache_get('recent_product', 'widget');
            if (!is_array($cache)) {
                $cache = array();
            }
            if (isset($cache[$args['widget_id']])) {
                echo $cache[$args['widget_id']];
                return;
            }
            ob_start();
            extract($args);
            // gives us the default settings of widgets
            $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent', 'wpdance') : $instance['title']);
            $link = empty($instance['link']) ? '#' : esc_url($instance['link']);
            $link = isset($link) && strlen($link) > 0 ? $link : "#";
            $_limit = absint($instance['limit']) == 0 ? 5 : absint($instance['limit']);
            echo $before_widget;
            // echos the container for the widget || obtained from $args
            if ($title) {
                echo $before_title . "<a href='{$link}' title='{$title}'>" . $title . '</a>' . $after_title;
            }
            wp_reset_query();
            $num_count = count(query_posts("showposts={$_limit}&ignore_sticky_posts=1"));
            echo '<div class="recent_list_carousel">';
            if (have_posts()) {
                $id_widget = 'recent-' . rand(0, 1000);
                echo '<ul class="wd_recent_posts_' . $id_widget . '">';
                $i = 0;
                while (have_posts()) {
                    the_post();
                    global $post;
                    ?>
					<li class="item<?php 
                    //if($i == 0) echo ' first';
                    //if(++$i == $num_count) echo ' last';
                    ?>
">
						<div class="detail">
							<div class="author"><?php 
                    _e('POST BY', 'wpdance');
                    ?>
 <?php 
                    the_author_posts_link();
                    ?>
</div>
							<div class="entry-title">
								<a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    printf(esc_attr__('Permalink to %s', 'wpdance'), the_title_attribute('echo=0'));
                    ?>
" rel="bookmark">
									<?php 
                    echo esc_attr(get_the_title());
                    ?>
								</a>
								<p class="entry-desc">
									<?php 
                    echo the_excerpt_max_words(4, $post), '...';
                    ?>
								</p>
							</div>
							<div class="post_thumbnail">
							<?php 
                    if (has_post_thumbnail()) {
                        ?>
								<?php 
                        echo get_the_post_thumbnail(get_the_ID(), array(240, 240));
                        ?>
	
							<?php 
                    } else {
                        ?>
	
								<img alt="<?php 
                        the_title();
                        ?>
" height="240" width="240" title="<?php 
                        the_title();
                        ?>
" src="<?php 
                        echo get_template_directory_uri();
                        ?>
/images/no-thumb-100x100.gif"/>
							<?php 
                    }
                    ?>
							</div>
							<!--<p class="entry-meta">
								<span class="entry-date-day"><?php 
                    echo get_the_date('d');
                    ?>
</span>
								<span class="entry-date-month"><?php 
                    echo get_the_date('M');
                    ?>
</span>
							</p>-->
							
							<!--<div class="entry-meta">
								<div class="author-info">
									<span class="entry-date"><?php 
                    //echo get_the_date('F d, Y')
                    ?>
</span>
								</div><!-- .author-info -->
							<!--</div> --><!-- .entry-meta -->
							
						</div><!-- .detail -->
						
					</li>
				
					
				<?php 
                }
                echo '</ul>';
                echo '<div class="clearfix"></div>';
                echo '<div class="wd_recent_control"><a class="prev" id="wd_recent_posts_prev_' . $id_widget . '" href="#">&lt;</a>';
                echo '<a class="next" id="wd_recent_posts_next_' . $id_widget . '" href="#" >&gt;</a> </div>';
            }
            echo '</div>';
            ?>
			
			<script type="text/javascript" language="javascript">
		//<![CDATA[
			jQuery(document).ready(function() {

				_slider_datas = {				
					responsive: true
					,width	: 240
					,height	: 'auto'
					,scroll  : {
						items	: 1,
					}
					,debug	 : true
					,auto    : false
					,swipe	: { onMouse: true, onTouch: true }	
					,items   : { 
						width		: 240
						,height		: 'auto'					
					}	
					,prev    : '#wd_recent_posts_prev_<?php 
            echo $id_widget;
            ?>
'
					,next    : '#wd_recent_posts_next_<?php 
            echo $id_widget;
            ?>
'
				};
				jQuery('.wd_recent_posts_<?php 
            echo $id_widget;
            ?>
').carouFredSel(_slider_datas);
	
				
				/*
				jQuery('window').bind('resize',jQuery.debounce( 250, function(){	
					_slider_config = get_layout_config(jQuery('.upsells.products').width(),_visible_items);
						_upsell_item_width = jQuery(window).width() < 600 ? 300 : 183;
						_slider_datas.items.width = _upsell_item_width;
						jQuery('#_upsell_ul_001').trigger('configuration ',["items.width", 300, true]);
						jQuery('#_upsell_ul_001').trigger('destroy',true);
						jQuery('#_upsell_ul_001').carouFredSel(_slider_datas);
				}));				
				*/
			});	
		//]]>	
		</script>
<?php 
            wp_reset_query();
            echo $after_widget;
            // close the container || obtained from $args
            $content = ob_get_clean();
            if (isset($args['widget_id'])) {
                $cache[$args['widget_id']] = $content;
            }
            echo $content;
            wp_cache_set('recent_product', $cache, 'widget');
        }
				<div class="time">
					<span class="entry-date"><?php 
            echo get_the_date('M d, Y');
            ?>
</span><br/>
				</div>
			<?php 
        }
        ?>
			
			<?php 
        if ($wd_data['wd_blog_excerpt'] == 1) {
            ?>
				<p class="short-content"><?php 
            /*the_content();*/
            the_excerpt_max_words(160, $post);
            ?>
</p>
			<?php 
        }
        ?>
			
			<?php 
        if ($wd_data['wd_blog_author'] == 1) {
            ?>
				<div class="author">
					Post by <?php 
            the_author_posts_link();
            ?>
 
				</div>
Exemple #6
0
function add_short_content()
{
    global $product, $wd_data, $post;
    $limit_grid = trim($wd_data['wd_prod_cat_word_disc_grid']);
    $limit_list = trim($wd_data['wd_prod_cat_word_disc_list']);
    if ($limit_grid != -1) {
        $limit_grid = absint($limit_grid);
    }
    if ($limit_list != -1) {
        $limit_list = absint($limit_list);
    }
    $is_grid_list = class_exists('WD_List_Grid');
    $rs = '';
    if (!(is_tax('product_cat') || is_tax('product_tag') || is_post_type_archive("product"))) {
        $rs .= '<div class="short-description">';
        $rs .= the_excerpt_max_words($limit_grid, $post, false);
        $rs .= '</div>';
    } else {
        if ($wd_data['wd_prod_cat_disc_grid']) {
            $rs .= '<div class="short-description grid" ' . ($is_grid_list ? 'style="display:none"' : '') . '>';
            $rs .= the_excerpt_max_words($limit_grid, $post, false);
            $rs .= '</div>';
        }
        if ($wd_data['wd_prod_cat_disc_list']) {
            $rs .= '<div class="short-description list" style="display:none">';
            $rs .= the_excerpt_max_words($limit_list, $post, false);
            $rs .= '</div>';
        }
    }
    echo apply_filters('the_content', $rs);
}
    function recent_portfolios_function($atts, $content = false)
    {
        extract(shortcode_atts(array('gallery' => '', 'columns' => 1, 'number_posts' => 4, 'title' => 'yes', 'thumbnail' => 'yes', 'meta' => 'yes', 'excerpt' => 'yes', 'excerpt_words' => 30), $atts));
        wp_reset_query();
        $args = array('post_type' => 'portfolio', 'showposts' => $number_posts);
        if (strlen($gallery) > 0) {
            $args = array('post_type' => 'portfolio', 'showposts' => $number_posts, 'tax_query' => array(array('taxonomy' => 'gallery', 'field' => 'slug', 'terms' => $gallery)));
        }
        $title = strcmp('yes', $title) == 0 ? 1 : 0;
        $thumbnail = strcmp('yes', $thumbnail) == 0 ? 1 : 0;
        $meta = strcmp('yes', $meta) == 0 ? 1 : 0;
        $excerpt = strcmp('yes', $excerpt) == 0 ? 1 : 0;
        $span_class = "span" . 12 / $columns;
        $num_count = count(query_posts($args));
        if (have_posts()) {
            $id_widget = 'recent-portfolios-shortcode' . rand(0, 1000);
            ob_start();
            echo '<ul id="' . $id_widget . '"class="shortcode-recent-portfolios columns-' . $columns . '">';
            $i = 0;
            while (have_posts()) {
                the_post();
                global $post;
                $post_title = get_the_title($post->ID);
                $post_url = get_permalink($post->ID);
                $url_video = get_post_meta($post->ID, THEME_SLUG . 'video_portfolio', true);
                $term_list = implode(' ', wp_get_post_terms($post->ID, 'gallery', array("fields" => "slugs")));
                if (strlen(trim($url_video)) > 0) {
                    if (strstr($url_video, 'youtube.com') || strstr($url_video, 'youtu.be')) {
                        $thumburl = array(get_thumbnail_video_src($url_video, 500, 320));
                        $item_class = "thumb-video youtube-fancy";
                    }
                    if (strstr($url_video, 'vimeo.com')) {
                        $thumburl = array(wp_parse_thumbnail_vimeo(wp_parse_vimeo_link($url_video), 500, 320));
                        $item_class = "thumb-video vimeo-fancy";
                    }
                    $light_box_url = $url_video;
                } else {
                    $thumb = get_post_thumbnail_id($post->ID);
                    $thumburl = wp_get_attachment_image_src($thumb, 'full');
                    $item_class = "thumb-image";
                    $light_box_url = $thumburl[0];
                }
                $portfolio_slider = get_post_meta($post->ID, THEME_SLUG . '_portfolio_slider', true);
                $portfolio_slider = unserialize($portfolio_slider);
                $slider_thumb = false;
                if (is_array($portfolio_slider) && count($portfolio_slider) > 0) {
                    $slider_thumb = true;
                    $item_class = "thumb-slider";
                }
                ?>
				<li class="item <?php 
                echo $span_class;
                if ($i == 0 || $i % $columns == 0) {
                    echo ' first';
                }
                if ($i == $num_count - 1 || $i % $columns == $columns - 1) {
                    echo ' last';
                }
                ?>
">
					<div>
						<div class="image <?php 
                if (!$thumbnail) {
                    echo "hidden-element";
                }
                ?>
">
							<?php 
                if ($slider_thumb) {
                    ?>
								<div class="portfolio-slider">
									<ul class="slides">
										<?php 
                    foreach ($portfolio_slider as $slide) {
                        ?>
	
											<li><a href="<?php 
                        echo $slide['url'];
                        ?>
"><img src="<?php 
                        echo print_thumbnail($slide['image_url'], true, $post_title, 500, 400, '', false, true);
                        ?>
" alt="<?php 
                        echo $slide['alt'];
                        ?>
" title="<?php 
                        echo $slide['title'];
                        ?>
" /></a></li>
										<?php 
                    }
                    ?>
									</ul>	
								</div>				
							<?php 
                } else {
                    ?>
								<?php 
                    the_post_thumbnail('blog_shortcode', array('class' => 'thumbnail-effect-1'));
                    ?>
							<?php 
                }
                ?>
						</div>
						<div class="detail<?php 
                if (!$thumb) {
                    echo ' noimage';
                }
                ?>
">
							<p class="title <?php 
                if (!$title) {
                    echo "hidden-element";
                }
                ?>
"><h4 class="heading-title"><a href="<?php 
                echo get_permalink($post->ID);
                ?>
" class="wpt_title"  ><?php 
                echo get_the_title($post->ID);
                ?>
</a></h4></p>
							<p class="excerpt <?php 
                if (!$excerpt) {
                    echo "hidden-element";
                }
                ?>
"><?php 
                the_excerpt_max_words($excerpt_words);
                ?>
</p>
							<div class="meta <?php 
                if (!$meta) {
                    echo "hidden-element";
                }
                ?>
"><span class="author-time"><span class="author"><?php 
                the_author();
                ?>
</span><b>/</b><span class="time"><?php 
                the_time('F d,Y');
                ?>
</span><b>/</b><span class="comment-number"><?php 
                comments_number('0 Comments', '1 Comment', '% Comments');
                ?>
</span></span></div>
						</div>	
					</div>
				</li>
		<?php 
                $i++;
            }
            echo '</ul>';
            $ret_html = ob_get_contents();
            ob_end_clean();
        }
        wp_reset_query();
        return $ret_html;
    }
Exemple #8
0
    function wd_recent_blogs_slider_functions($atts, $content = false)
    {
        extract(shortcode_atts(array('category' => '', 'columns' => 4, 'number_posts' => 4, 'show_type' => 'grid', 'title' => 1, 'thumbnail' => 1, 'meta' => 1, 'show_date' => 1, 'excerpt' => 1, 'excerpt_words' => 20, 'show_nav' => 0, 'show_icon_nav' => 0, 'autoplay' => 0), $atts));
        $args = array('post_type' => 'post', 'ignore_sticky_posts' => 1, 'posts_per_page' => $number_posts);
        if (strlen($category) > 0) {
            $args = array('post_type' => 'post', 'ignore_sticky_posts' => 1, 'posts_per_page' => $number_posts, 'category_name' => $category);
        }
        $recent_posts = new WP_Query($args);
        $ret_html = '';
        if ($recent_posts->have_posts()) {
            $num_count = $recent_posts->post_count;
            $id_widget = 'recent-blog-wrapper' . rand(0, 1000);
            ob_start();
            echo '<div class="shortcode-recent-blogs wd-slider loading ' . $show_type . ' columns-' . $columns . '">';
            ?>
			<div id="<?php 
            echo $id_widget;
            ?>
" class="blog-wrapper">
			<?php 
            $i = 0;
            while ($recent_posts->have_posts()) {
                $recent_posts->the_post();
                global $post;
                ?>
				<article class="item <?php 
                if ($i == 0 || $i % $columns == 0) {
                    echo ' first';
                }
                if ($i == $num_count - 1 || $i % $columns == $columns - 1) {
                    echo ' last';
                }
                ?>
">
					<div class="header-wrapper">
						<?php 
                if ($thumbnail) {
                    ?>
						<a class="thumbnail" href="<?php 
                    the_permalink();
                    ?>
">
							<?php 
                    the_post_thumbnail('blog_shortcode', array('class' => 'thumbnail-effect-1'));
                    ?>
							<div class="effect_hover_image"></div>
						</a>
						<?php 
                }
                ?>
						<?php 
                if ($show_date) {
                    ?>
							<span class="date-time">
								<span><?php 
                    echo get_the_time('d');
                    ?>
</span>
								<span><?php 
                    echo get_the_time('M');
                    ?>
</span>
							</span>
						<?php 
                }
                ?>
					</div>
					<div class="detail">
						<?php 
                if ($title) {
                    ?>
						<h3 class="heading-title"><a href="<?php 
                    echo get_permalink($post->ID);
                    ?>
" class="wpt_title"  ><?php 
                    echo get_the_title($post->ID);
                    ?>
</a></h3>
						<?php 
                }
                ?>
						
						<?php 
                if ($excerpt) {
                    ?>
						<p class="excerpt"><?php 
                    the_excerpt_max_words($excerpt_words);
                    ?>
</p>
						<?php 
                }
                ?>
						
						<?php 
                if ($meta) {
                    ?>
						<div class="info-meta">
							<span class="author"><i class="fa fa-user"></i><?php 
                    _e('', 'wpdance');
                    ?>
 <?php 
                    the_author_posts_link();
                    ?>
 
							</span>
							
							<span class="comments-count"><i class="fa fa-comment-o"></i><span class="number"><?php 
                    $comments_count = wp_count_comments($post->ID);
                    if ($comments_count->approved < 10 && $comments_count->approved > 0) {
                        echo '0';
                    }
                    echo $comments_count->approved;
                    ?>
</span>
							</span>
						</div>
						<?php 
                }
                ?>
					</div>	
				</article>
			<?php 
                $i++;
            }
            echo '</div>';
            echo '</div>';
            ?>
			<script type='text/javascript'>
			//<![CDATA[
				jQuery(document).ready(function() {
					"use strict";
					var temp_visible = <?php 
            echo esc_js($columns);
            ?>
;
					
					var row = 1;
					
					if(jQuery("#<?php 
            echo $id_widget;
            ?>
").parent('.shortcode-recent-blogs').hasClass('list')){
						row = <?php 
            echo esc_js($columns);
            ?>
;
						temp_visible = 1;
					}
					
					var show_nav = <?php 
            if ($show_nav) {
                ?>
 true <?php 
            } else {
                ?>
 false <?php 
            }
            ?>
;

					var show_icon_nav = <?php 
            if ($show_icon_nav) {
                ?>
 true <?php 
            } else {
                ?>
 false <?php 
            }
            ?>
;
					
					var object_selector = "#<?php 
            echo $id_widget;
            ?>
";
					
					var margin = 20;					
						
					var slider_data = {
							nav : show_nav
							,dots : show_icon_nav
							,autoplay : false
							,responsive	: {
								0 : {
									items:1
								},
								300 : {
									items: 2
								},
								600 : {
									items: 3
								},
								1000 : {
									items: 4
								},
								1160 : {
									items: <?php 
            echo esc_js($columns);
            ?>
								}
							}
					}
					
					<?php 
            if ($columns == 1) {
                ?>
						slider_data.responsive = {0:{items: 1}};
					<?php 
            }
            ?>
						
					generate_horizontal_slide(slider_data, row, object_selector,margin);
				});
			//]]>	
			</script>
			<?php 
            $ret_html = ob_get_contents();
            ob_end_clean();
            //ob_end_flush();
        }
        wp_reset_postdata();
        return $ret_html;
    }