Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@AndreaBarghigiani
Created October 7, 2016 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndreaBarghigiani/5068b54db7dc565e580d27084ab77dbd to your computer and use it in GitHub Desktop.
Save AndreaBarghigiani/5068b54db7dc565e580d27084ab77dbd to your computer and use it in GitHub Desktop.
Esempio di WordPress Loop. Codice utilizzato in: https://skillsandmore.org/wordpress-loop-introduzione/
<?php query_posts( 'page_per_post=5&category_name=pippo' ); ?>
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
/* Codice da eseguire in caso di contenuto trovato */
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h2>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
<?php the_title(); ?>
</a>
</h2>
<div class="meta">
<p>Scritto da: <?php the_author(); ?> - Commenti: <?php comments_popup_link('0', '1', '%'); ?></p>
<p>Tag: <?php the_tags(' ', ',', ' '); ?> - Categorie: <?php the_category(', '); ?></p>
</div>
<div class="entry-content">
<?php the_content('<p>Continua a Leggere &raquo;</p>'); ?>
</div>
</div>
<?php endwhile; else: ?>
/* Codice da eseguire in caso di contenuto non trovato */
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment