'null', 'etichetta' => 'null', ), $atts ) ); if ( $categoria <> 'null' ) { if ( $etichetta <> 'null' ) { $q = new WP_Query( array( 'category_name' => $categoria, 'tag' => $etichetta, 'posts_per_page'=>-1 ) ); } else { $q = new WP_Query( array( 'category_name' => $categoria, 'posts_per_page'=>-1 ) ); } } else { if ( $etichetta <> 'null' ) { $q = new WP_Query( array( 'tag' => $etichetta, 'posts_per_page'=>-1 ) ); } else { $q = new WP_Query( array( 'categoria' => 'beta', 'posts_per_page'=>0 ) );} } $grid = ''; # ripristino ricerca wp_reset_postdata(); } else { $grid = '

Nessun articolo trovato

'; } return $grid; } # creazione della griglia per il loop dei libri add_shortcode( 'griglialibri', 'griglialibri' ); function griglialibri ($atts) { global $post; #https://wordpress.stackexchange.com/questions/43315/use-a-shortcode-to-display-custom-meta-box-contents extract( shortcode_atts( array( 'etichetta' => 'libri-per-bambini-e-ragazzi', ), $atts ) ); $q = new WP_Query( array( 'category_name' => 'libri', 'tag' => $etichetta, 'posts_per_page'=>-1 ) ); $grid = ''; # ripristino ricerca wp_reset_postdata(); } else { $grid = '

Nessun articolo trovato

'; } return $grid; }