Exibindo somente os posts marcados como (fixo) no WordPress

16/02/11 Wordpress 0

Segue abaixo um code snipped que pode ser muito útil. O WordPress tem a opção de marcar um post como Fixo, pode ser usado para dar um destaque em um Post ou vários.


<?php

$recentPosts = new WP_Query();

$sticky = get_option('sticky_posts');

$args = array(

'showposts' => 1,

'post__in'  => $sticky,

'caller_get_posts' => 1,

'orderby' => 'date',

'category_name' => 'ewp-news'

);

$recentPosts->query($args);

while ($recentPosts->have_posts()) : $recentPosts->the_post();

?>

// Printing Title and Excerpt!

<?php endwhile; ?>

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>