Bonjour,
Essaie avec ce code dans ton fichier fonctions.php
function activite_escalade( $atts, $content = null ) {
//récupère les paramètres
$atts = shortcode_atts(
array(
‘post_type’ => ‘activite’,
‘limit’ => 5,
‘tax_query’ => array(
‘taxonomy’ => ‘category’,
‘field’ => ‘id’,
‘terms’ => 5
)
),$atts);
//transforme les paramètres en variables
extract($atts);
//créer la requête
$query = array(
‘post_status’ => ‘publish’,
‘post_type’ => $post_type,
‘posts_per_page’ => $limit,
‘orderby’ => ‘date’,
‘order’ => ‘DESC’,
);
$post = query_posts($query);
ob_start(); ?>
<?php endwhile;
wp_reset_query();
return ob_get_clean();
}
function register_shortcodes(){
add_shortcode(‘activiteescalade’, ‘activite_escalade’);
}
add_action( ‘wp_head’, ‘register_shortcodes’);