problemi nell'aggiungere categorie dinamicamente
-
Ciao a tutti, vorrei aggiungere in una pagina delle categorie come dei link particolari e poi delle categorie come classi di un div corrispondente ai posts.
Quindi ho inserito nel loop 3 query: le prime due che richiedono una certa categoria, prendono il nome delle sue sotto categorie e le inseriscono come link.
La terza prende i nomi e i post appartenenti alla categoria e li inserisce dentro a un div avente come classe i nomi di tutte le sottocategorie.<?php if (is_page( 'Lavori' )) { ?>
<?php if (have_posts()) : ?><!-- html code -->
<?php query_posts( 'category_name=media' ); ?>
<?php while (have_posts()) : the_post(); ?>
<?php $categories = get_the_category_list(); foreach($categories as $category): echo ('<li class="element_menu">name; echo ('" data-filter-value=".'); echo $category->name; echo('">'); echo $category->name; echo(''); endforeach;?><?php wp_reset_query();?>
<?php endwhile; ?><!-- html code -->
<?php query_posts( 'category_name=lavorocliente' ); ?>
<?php while (have_posts()) : the_post(); ?><?php $categories = get_the_category_list(); foreach($categories as $category): echo ('<li class="element_menu">name; echo ('" data-filter-value=".'); echo $category->name; echo('">'); echo $category->name; echo(''); endforeach;?>
<?php endwhile; ?>
<?php wp_reset_query();?><!-- html code -->
<!-- here starts the only part that goes well -->
<?php query_posts( 'category_name=item' ); ?>
<!-- html code --><?php $count = 0; ?>
<?php while (have_posts()) : the_post(); ?><div style="overflow:hidden" class="moduli<?php $categories = get_the_category(); foreach($categories as $category):echo (' '); echo $category->name; endforeach;?>" id="post-<?php the_ID(); ?>">
<?php endwhile; ?>
<?php endif; ?>
</div>
</div>
<?php } else { ?>
<?php } ?>forse il problema è che ho inserito troppe query_posts?
- L'argomento ‘problemi nell'aggiungere categorie dinamicamente’ è chiuso a nuove risposte.