daily pastebin goal
15%
SHARE
TWEET

Recuperer 3 derniers articles avec catégories et cCF

CreaZo Feb 4th, 2015 190 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Shortcode 3 derniers articles avec Date, Catégorie et Titre de l'Article
  2. function shortcode_agenda($atts){
  3.  $q = new WP_Query(
  4.    array( 'orderby' => 'date','cat' => 6, 'posts_per_page' => '3')
  5.  );
  6. $list = '<ul class="recent-posts">';
  7. while($q->have_posts()) : $q->the_post();
  8. $category = get_the_category();
  9. $Date = get_post_meta( $wp_query->post->ID , "Date", true);
  10. $list .= '<li>' . '<div class="category">' . get_post_meta() .'</div>' . '<div class="category">' . $category[0]->cat_name .'</div>' . '<a class="titre" href="' . get_permalink() . '">' . get_the_title() . '</a>' . '</li>';
  11.  
  12.  
  13. endwhile;
  14.  
  15. wp_reset_query();
  16. return $list . '</ul>';
  17. }
  18. add_shortcode('3-agenda', 'shortcode_agenda');
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top