null, 'categoria' => null, 'tag' => null, 'pag' => null, ), $atts ) ); if ( $pag <> null ) { if ( $categoria <> null ) { if ( $tag <> null) { $q = new WP_Query ( array( 'post_type' => 'post', 'category_name' => $categoria, 'tag' => $tag, 'posts_per_page' => $pag ) ); } else { $q = new WP_Query ( array( 'post_type' => 'post', 'category_name' => $categoria, 'posts_per_page' => $pag ) ); } } else { if ( $tag <> null ) { $q = new WP_Query ( array( 'post_type' => 'post', 'tag' => $tag, 'posts_per_page' => $pag ) ); } else { $q = new WP_Query ( array( 'post_type' => 'post', 'posts_per_page' => $pag ) ); } } } else { if ( $categoria <> null ) { if ( $tag <> null ) { $q = new WP_Query ( array( 'post_type' => 'post', 'category_name' => $categoria, 'tag' => $tag, 'posts_per_page' => 5 ) ); } else { $q = new WP_Query ( array( 'post_type' => 'post', 'category_name' => $categoria, 'posts_per_page' => $pag ) ); } } else { if ( $tag <> null ) { $q = new WP_Query ( array( 'post_type' => 'post', 'tag' => $tag, 'posts_per_page' => $pag ) ); } else { $q = new WP_Query ( array( 'post_type' => 'post', 'posts_per_page' => $pag ) ); } } } $content = null; if ( $intro <> null ) { $head = ''.$intro.''; } else { $head = 'Ultimi articoli'; } if ( $q->have_posts() ) { while ( $q->have_posts() ) { $q->the_post(); $titolo = get_the_title(); $content .= '
  • '.$titolo.'
  • '; } /* ripristino */ wp_reset_postdata(); } if ( $content <> null ) { $content = '

    '.$head.'

    '; } else { $content = '

    '.$head.'

    '; } $out = $content.$after_widget; return $out; } add_shortcode( 'postlooptab', 'postlooptab' ); # griglia per loop generico per categoria ed etichetta add_shortcode ( 'grigliaeduinaf', 'grigliaeduinaf'); function grigliaeduinaf ($atts) { extract( shortcode_atts( array( 'categoria' => '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; } # griglia per loop generico per categoria, etichetta, tassonomia e suo valore add_shortcode ( 'grigliata', 'grigliata'); function grigliata ($atts) { extract( shortcode_atts( array( 'categoria' => 'null', 'etichetta' => 'null', 'tassonomia' => 'null', 'valore' => 'null', ), $atts ) ); if ( $categoria <> 'null' ) { if ( $etichetta <> 'null' ) { if ( $tassonomia <> 'null' ) { if ( $valore <> 'null' ) { $qtax = new WP_Query ( array( 'category_name' => $categoria, 'tag' => $etichetta, 'taxonomy' => $tassonomia, 'term' => $valore, 'posts_per_page'=>-1 ) ); } else { $qtax = new WP_Query ( array( 'category_name' => $categoria, 'tag' => $etichetta, 'taxonomy' => $tassonomia, 'posts_per_page'=>-1 ) ); } } else { $qtax = new WP_Query ( array( 'category_name' => $categoria, 'tag' => $etichetta, 'posts_per_page'=>-1 ) ); } } else { if ( $tassonomia <> 'null' ) { if ( $valore <> 'null' ) { $qtax = new WP_Query ( array( 'category_name' => $categoria, 'taxonomy' => $tassonomia, 'term' => $valore, 'posts_per_page'=>-1 ) ); } else { $qtax = new WP_Query ( array( 'category_name' => $categoria, 'taxonomy' => $tassonomia, 'posts_per_page'=>-1 ) ); } } else { $qtax = new WP_Query ( array( 'category_name' => $categoria, 'posts_per_page'=>-1 ) ); } } } else { if ( $etichetta <> 'null' ) { if ( $tassonomia <> 'null' ) { if ( $valore <> 'null' ) { $qtax = new WP_Query ( array( 'tag' => $etichetta, 'taxonomy' => $tassonomia, 'term' => $valore, 'posts_per_page'=>-1 ) ); } else { $qtax = new WP_Query ( array( 'tag' => $etichetta, 'taxonomy' => $tassonomia, 'posts_per_page'=>-1 ) ); } } else { $qtax = new WP_Query ( array( 'tag' => $etichetta, 'posts_per_page'=>-1 ) ); } } else { if ( $tassonomia <> 'null' ) { if ( $valore <> 'null' ) { $qtax = new WP_Query ( array( 'taxonomy' => $tassonomia, 'term' => $valore, 'posts_per_page'=>-1 ) ); } else { $qtax = new WP_Query ( array( 'taxonomy' => $tassonomia, 'posts_per_page'=>-1 ) ); } } } } $grid = ''; # ripristino ricerca wp_reset_postdata(); } else { $grid = '

    Nessun articolo trovato

    '; } return $grid; } # creazione della griglia per il loop dei libri: pesca il campo del titolo del libro 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; }