Created
June 22, 2012 21:01
-
-
Save ekka21/2975171 to your computer and use it in GitHub Desktop.
Wordpress: lastest post within category
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
//Function for showing lastest post within cat_id | |
function imediapixel_latestnews($blogcat,$num=4,$title="") { | |
global $post; | |
echo $title; | |
if(is_array($blogcat)) { | |
$blog_includes = implode(",",$blogcat); | |
} else { | |
$blog_includes = $blogcat; | |
} | |
query_posts('cat='.$blog_includes.'&showposts='.$num); | |
?> | |
<ul class="latestnews"> | |
<?php | |
while ( have_posts() ) : the_post(); | |
$image_thumbnail = get_post_meta($post->ID, '_image_thumbnail', true ); | |
?> | |
<li> | |
<a href="<?php the_permalink();?>"><?php the_title();?></a> | |
<p class="posteddate"><?php echo __('Posted on ','ecobiz');?><?php the_time( get_option('date_format') ); ?></p> | |
</li> | |
<?php endwhile;?> | |
</ul> | |
<div class="clear"></div> | |
<?php | |
$blog_page = get_option('ecobiz_blog_page'); | |
$blog_pid = get_page_by_title($blog_page); | |
?> | |
<a href="<?php echo get_permalink($blog_pid->ID);?>" class="button-more"><?php echo __('View All News','ecobiz');?></a> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment