how to get featured posts from specific category.
ex: only the posts from "web" and "featured" category. ... i want to add a "Latest featured posts from CATEGORY-WEB "
how to get featured posts from specific category.
ex: only the posts from "web" and "featured" category. ... i want to add a "Latest featured posts from CATEGORY-WEB "
use the 'category__and' parameter in the query;
where exactly do you need help?
read:
http://codex.wordpress.org/Template_Tags/get_posts
http://codex.wordpress.org/Function_Reference/query_posts
http://codex.wordpress.org/The_Loop
http://codex.wordpress.org/Class_Reference/WP_Query
http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters
http://codex.wordpress.org/Function_Reference/get_cat_ID
i use this code to display latest from a specific cat
<ul>
<?php $recent = new WP_Query("cat=34&showposts=5"); while($recent->have_posts()) : $recent->the_post();?>
<li><a href="<?php the_permalink(); ?>"><img src="<?php echo bloginfo('template_url'); ?>/lib/scripts/thumb.php?src=/<?php
$values = get_post_custom_values("thesis_thumb");if (empty($values)) {echo '/wp-content/themes/thesis_18/custom/noimg.png';}; echo $values[0]; ?>" alt="<?php the_title(); ?>" class="footer-thumb" width="35" height="35" /></a>
<div class="recent-post-content-featured">
<p><a title="Post: <?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
</div>
</li>
<?php endwhile; ?>
</ul>
how can i do to show latest from a specific category but to be in the "featured" cat too ?
try to replace this line:
<?php $recent = new WP_Query("cat=34&showposts=5");
with:
<?php $featured_id = get_cat_ID('featured');
$recent = new WP_Query( array('category__and => array(34, $featured_id), posts_per_page' => 5) );You must log in to post.