plaghia shortcode
// Add Shortcode
function custom_shortcode_teamcode( $atts ) {
// Attributes
$atts = shortcode_atts(
array(
'post' => '',
'tag' => '',
'categoria' => '',
),
$atts,
'teamcode'
);
// WP_Query arguments
$args = array(
'post_type' => array( 'boat', ' place' ),
'post_status' => array( 'publish' ),
'posts_per_page' => '10',
'posts_per_archive_page' => '10',
'order' => 'ASC',
'orderby' => 'title',
'tax_query' => array(
array(
'taxonomy' => 'tipologia',
'field' => 'name',
'operator' => 'IN',
'include_children' => true,
),
array(
'taxonomy' => 'regione',
'field' => 'name',
'operator' => 'IN',
'include_children' => true,
),
),
);
// The Query
$query = new WP_Query( $args );
// The Loop
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
// do something
}
} else {
// no posts found
}
// Restore original Post Data
wp_reset_postdata();
}
add_shortcode( 'teamcode', 'custom_shortcode_teamcode' );