Example #1
0
							<div class="et-post-data container">
								<div class="row">
									<div class="col-md-2 col-sm-2 et-post-data-left">
										<span class="et-post-month"><?php 
        the_time('M');
        ?>
</span>
										<span class="et-post-date"><?php 
        the_time('d');
        ?>
</span>
										<a href="#" data-id="<?php 
        echo $post->ID;
        ?>
" class="et-like-post <?php 
        echo is_like_post($post->ID);
        ?>
">
											<span class="et-post-heart"><i class="fa fa-heart"></i><span class="count"><?php 
        echo get_post_meta($post->ID, 'et_like_count', true) ? get_post_meta($post->ID, 'et_like_count', true) : 0;
        ?>
</span></span>
										</a>
									</div>
									<div class="col-md-10 col-sm-10 et-post-data-right">
										<h1 class="title-blog"><a href="<?php 
        the_permalink();
        ?>
"><?php 
        the_title();
        ?>
Example #2
0
    public function et_loadmore_post()
    {
        $data = $_REQUEST['content'];
        $posts = array();
        global $post;
        $query = new WP_Query(array('paged' => $data['page'], 'post_type' => 'post'));
        if ($query->have_posts()) {
            while ($query->have_posts()) {
                $query->the_post();
                $posts[] = $post;
                $et_like_count = get_post_meta($post->ID, 'et_like_count', true) ? get_post_meta($post->ID, 'et_like_count', true) : 0;
                $num_comments = get_comments_number();
                // get_comments_number returns only a numeric value
                if (comments_open()) {
                    if ($num_comments == 0) {
                        $comments = __('No Comments', 'oneengine');
                    } elseif ($num_comments > 1) {
                        $comments = $num_comments . __(' Comments', 'oneengine');
                    } else {
                        $comments = __('1 Comment', 'oneengine');
                    }
                    $write_comments = '<a href="' . get_comments_link() . '">' . $comments . '</a>';
                } else {
                    $write_comments = __('Comments are off for this post.', 'oneengine');
                }
                $post->html = '
					<div class="col-md-6 et-blog-post">
		            	<div class="image-blog-wrapper">
							' . get_the_post_thumbnail($post->ID, 'full', array('class' => 'et-post-thumbnail img-responsive')) . '
		                </div>
						<div class="clearfix"></div>
						<div class="et-post-data container">
							<div class="row">
								<div class="col-md-2 et-post-data-left">
									<span class="et-post-month">' . get_the_time('M') . '</span>
									<span class="et-post-date">' . get_the_time('d') . '</span>
									<a href="#" data-id="' . $post->ID . '" class="et-like-post ' . is_like_post($post->ID) . '">
										<span class="et-post-heart"><i class="fa fa-heart"></i><span class="count">' . $et_like_count . '</span></span>
									</a>
								</div>
								<div class="col-md-10 et-post-data-right">
									<h1 class="title-blog">' . get_the_title() . '</h1>
									<div class="et-post-info">
										' . __('Post by', 'oneengine') . get_the_author() . ' | ' . get_the_category_list() . ' | ' . $write_comments . '
									</div>
									<div class="clearfix"></div>
									<div class="et-post-excerpt">
										' . get_the_excerpt() . '
									</div>
									<div class="clearfix"></div>
									<a href="' . get_permalink() . '" class="read-more"><i class="fa fa-arrow-right"></i>&nbsp;&nbsp;' . __('Read more', 'oneengine') . '</a>
								</div>
							</div>
						</div>
					</div>			
						';
            }
            $response = array('success' => true, 'posts' => $posts, 'current_page' => $data['page']);
        } else {
            $response = array('success' => false);
        }
        wp_send_json($response);
    }
Example #3
0
        function block($instance)
        {
            extract($instance);
            $query = new WP_Query(array('post_type' => 'post', 'posts_per_page' => $quantity));
            $i = 0;
            global $post;
            if ($query->have_posts()) {
                while ($query->have_posts()) {
                    $query->the_post();
                    $animation_effect = '';
                    $duration_effect = '';
                    if ($animation) {
                        $animation_effect = 'animated ' . $animation . '';
                    }
                    if ($duration != '' && $animation != '') {
                        $duration_effect = 'style="-webkit-animation-duration: ' . $duration . 'ms; -moz-animation-duration: ' . $duration . 'ms; -o-animation-duration: ' . $duration . 'ms;animation-duration: ' . $duration . 'ms; animation-delay:' . $delay * $i . 'ms; -webkit-animation-delay:' . $delay * $i . 'ms; -moz-animation-delay:' . $delay * $i . 'ms;-o-animation-delay:' . $delay * $i . 'ms;"';
                    }
                    ?>
			<div class="col-md-6 et-blog-post  <?php 
                    echo $animation_effect;
                    ?>
" <?php 
                    echo $duration_effect;
                    ?>
>
            	<div class="image-blog-wrapper">
					<?php 
                    the_post_thumbnail('full', array('class' => 'et-post-thumbnail img-responsive'));
                    ?>
                    <div class="et-post-data-left mobile-blog">
                        <span class="et-post-month"><?php 
                    the_time('M');
                    ?>
</span>
                        <span class="et-post-date"><?php 
                    the_time('d');
                    ?>
</span>
                        <a href="#" data-id="<?php 
                    echo $post->ID;
                    ?>
" class="et-like-post <?php 
                    echo is_like_post($post->ID);
                    ?>
">
                            <span class="et-post-heart"><i class="fa fa-heart"></i><span class="count"><?php 
                    echo get_post_meta($post->ID, 'et_like_count', true) ? get_post_meta($post->ID, 'et_like_count', true) : 0;
                    ?>
</span></span>
                        </a>
                    </div>
                </div>
				<div class="clearfix"></div>
				<div class="et-post-data container">
					<div class="row">
						<div class="col-md-2 col-sm-2 et-post-data-left">
							<span class="et-post-month"><?php 
                    the_time('M');
                    ?>
</span>
							<span class="et-post-date"><?php 
                    the_time('d');
                    ?>
</span>
							<a href="#" data-id="<?php 
                    echo $post->ID;
                    ?>
" class="et-like-post <?php 
                    echo is_like_post($post->ID);
                    ?>
">
								<span class="et-post-heart"><i class="fa fa-heart"></i><span class="count"><?php 
                    echo get_post_meta($post->ID, 'et_like_count', true) ? get_post_meta($post->ID, 'et_like_count', true) : 0;
                    ?>
</span></span>
							</a>
						</div>
						<div class="col-md-10 col-sm-10 et-post-data-right">
							<h1 class="title-blog"><a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h1>
							<div class="et-post-info">
								<?php 
                    _e('Post by', 'oneengine');
                    ?>
 <?php 
                    the_author();
                    ?>
 | <?php 
                    the_category();
                    ?>
 | <?php 
                    comments_number('No Comments', 'One Comment', '% Comments');
                    ?>
 
							</div>
							<div class="clearfix"></div>
							<div class="et-post-excerpt">
								<?php 
                    the_excerpt();
                    ?>
							</div>
							<div class="clearfix"></div>
							<a href="<?php 
                    the_permalink();
                    ?>
" class="read-more"><i class="fa fa-arrow-right"></i>&nbsp;&nbsp;Read more</a>
						</div>
					</div>
				</div>
			</div>
		<?php 
                    $i++;
                    if ($i % 2 == 0) {
                        echo '<div class="clearfix"></div>';
                    }
                }
            }
            wp_reset_query();
        }