Created
October 14, 2015 05:24
-
-
Save themepaint/84688f3ff7f5eba533cb to your computer and use it in GitHub Desktop.
All type Shortcode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=================== Type 1 Popular ============== | |
/*Latest Post Shortcode*/ | |
function cruise_latest_post($atts, $content = null ) { | |
// Attributes | |
extract( shortcode_atts( | |
array( | |
'title' => 'Search For Courses', | |
), $atts ) | |
); | |
$latest_article = new WP_Query(array( | |
'post_type'=>'post', | |
'posts_per_page'=>3, | |
'orderby'=>'most_recent' | |
)); | |
ob_start(); | |
?> | |
<section class="latest_post_area"> | |
<div class="container"> | |
<div class="row"> | |
<div class="latest_post"> | |
<div class="section_title"> | |
<h4>Latest post</h4> | |
</div> | |
<div class="row"> | |
<?php | |
while ($latest_article->have_posts()) : | |
$latest_article->the_post(); | |
$latest_img= wp_get_attachment_image_src(get_post_thumbnail_id($post->ID),'lt_post_img'); | |
?> | |
<div class="col-lg-4 col-md-4 col-sm-4"> | |
<div class="single_latest_post"> | |
<div class="grid"> | |
<figure class="effect-honey"> | |
<a href="#"><img src="<?php echo $latest_img[0]?>" alt=""></a> | |
<figcaption> | |
<h6><?php the_time("d M")?></h6> | |
</figcaption> | |
</figure> | |
<div class="product-description"> | |
<p> | |
<a href="#"><span>By </span><?php get_the_author()?></a> | |
<?php comments_popup_link(' No Comment ','1 Comment ','% Comments')?> | |
</p> | |
<a href="#"><?php get_the_title() ?></a> | |
<?php echo excerpt("10") ?> | |
</div> | |
</div> | |
</div> | |
</div> | |
<?php | |
endwhile; | |
wp_reset_postdata(); | |
wp_reset_query();?> | |
</div> | |
</div> | |
</div> | |
</section> | |
<?php | |
return ob_get_clean(); | |
} | |
add_shortcode ('latest_post', 'cruise_latest_post' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment