1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| <?php
// 1. On définit les arguments pour définir ce que l'on souhaite récupérer
$args = array(
'post_type' => 'post',
'category_name' => 'nouveautes',
'author' => 1,
);
// 2. On exécute la WP Query
// The Query
$the_query = new WP_Query( $args );
// 3. On lance la boucle !
// The Loop
$sum = 0;
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
$total_des_feuilles = get_post_meta( get_the_ID(), 'total_des_feuilles', true );
$num += $total_des_feuilles ;
}
echo $num;
echo get_the_author();
}
/* Restore original Post Data */
wp_reset_postdata();
?> |
Partager