PATH:
var
/
www
/
vhosts
/
sandbox.dos-group.com
/
httpdocs
/
mendrisio
/
wp-content
/
themes
/
cittadimendrisio
<?php global $post, $wp_query, $wp_the_query; ?> <nav class="nav-intern-list grid_8" role="Navigation"> <ul class="menu clearfix"> <?php $wp_query->set( 'nopaging', true ); //tolgo la paginazione dalla query di base query_posts( $wp_the_query->query_vars ); if ( have_posts() ) : while ( have_posts() ) : the_post(); // Prendo solo i post parents if ( ! $post->post_parent ) : echo '<li class="item grid_4">'; echo '<a href="' . get_the_permalink( $post->ID ) . '" class="item-link" title="link">' . get_the_title() . '</a>'; // Controllo se il post ha dei figli (quindi รจ gerarchico) e in caso li stampo $children = get_children( [ 'post_parent' => $post->ID, 'post_type' => 'any', 'numberposts' => -1, 'post_status' => 'publish' ] ); if ( ! empty( $children ) && is_array( $children ) ) : echo "<ul class=\"list\">"; foreach ( $children as $child ) : echo "<li class=\"item\"><a href=" . get_the_permalink( $child->ID ) . ">" . get_the_title( $child->ID ) . "</a></li>"; endforeach; echo "</ul>"; endif; echo '</li>'; else : //Doing something endif; endwhile; endif; /** * Se sono all'interno di una categoria di utenti */ if ( isset( $termchildren ) && ! empty( $termchildren ) ) { foreach ( $termchildren as $child ) { $query = new WP_Query( [ "post_type" => "any", "nopaging" => true, "orderby" => "title", "order" => "ASC", "tax_query" => [ [ "taxonomy" => $term->taxonomy, "field" => "slug", "terms" => $term->slug ] ] ] ); echo "<li class=\"item grid_4\">"; //Controllo se la categoria ha delle sottocategorie associate $has_children = get_term_children( $child->term_id, $child->taxonomy ); //Se ha delle sottocategorie associate lo mostro come link diversamente lo mostro come title echo( $has_children ? '<a href="' . get_term_link( $child, $child->taxonomy ) . '" class="item-link" title="link">' . ucfirst( $child->name ) . '</a>' : "<h2 class=\"item-link\">" . ucfirst( $child->name ) . "</h2>\n" ); //Ottengo tutti i post associati alla categoria selezionata $query = new WP_Query( [ "post_type" => "any", "orderby" => "title", "order" => "ASC", "nopaging" => true, "tax_query" => [ [ "taxonomy" => $child->taxonomy, "field" => "slug", "terms" => $child->slug, "include_children" => false ] ] ] ); echo "<ul class=\"list\">"; /** * Facci un loop dei post associati alla categoria */ if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); echo "<li class=\"item\"><a href=" . get_the_permalink() . ">" . get_the_title() . "</a></li>"; endwhile; wp_reset_postdata(); endif; echo "</ul>"; echo "</li>"; } //end foreach } //end if; ?> </ul> </nav>
[-] tmpl-homepage.php
[open]
[-] loop-innermenuadvanced.php
[open]
[-] tmpl-archivio.php
[open]
[-] sidebar-base.php
[open]
[-] header-global.php
[open]
[-] author.php
[open]
[-] tmpl-archivio-news.php
[open]
[-] loop-tipodiavviso.php
[open]
[-] functions.php
[open]
[-] 404.php
[open]
[+]
assets
[+]
language
[+]
_framework
[-] single-event.php
[open]
[-] loop-innermenu.php
[open]
[-] loop-doctaxonomy.php
[open]
[+]
..
[-] single.php
[open]
[-] taxonomy.php
[open]
[-] tmpl-events.php
[open]
[+]
partials
[-] taxonomy-event-categories.php
[open]
[+]
plugins
[-] page.php
[open]
[-] footer.php
[open]
[-] loop-innermenuadvancedusers.php
[open]
[-] search.php
[open]
[-] archive.php
[open]
[-] header.php
[open]
[-] loop-avviso.php
[open]
[-] screenshot.png
[open]
[-] sidebar-page.php
[open]
[-] index.php
[open]
[+]
feeds
[-] style.css
[open]