• Salve, ho trovato questo codice: `function get_related_author_posts() {
    global $authordata, $post;
    $authors_posts = get_posts( array( ‘author’ => $authordata->ID, ‘post__not_in’ => array( $post->ID ), ‘posts_per_page’ => 5 ) );
    $output = ‘<ul>’;
    foreach ( $authors_posts as $authors_post ) {
    $output .= ‘<li><a href=”‘ . get_permalink( $authors_post->ID ) . ‘”>’ . apply_filters( ‘the_title’, $authors_post->post_title, $authors_post->ID ) . ‘</a></li>’;
    }
    $output .= ‘</ul>’;
    return $output;
    }`

    E funziona.. solo che se cambio da luigi ad enrica mi visualizza gli post di luigi anche nell’utente enrica. Avete idea come fare visualizzare solo gli post quando si digita: http://localhost:81/author/luigi/

    Grazie mille e aspetto risposta .. Buona giornata e buon inizio settimana.

Stai visualizzando 1 risposte (di 1 totali)
  • Chi ha creato la discussione Luigi Amorfini

    (@lamorfini)

    risolto con questo:

      <div id="recent-author-posts">
            <h3>Post recenti</h3>
            <?php if ( have_posts() ) : while ( have_posts() ) : the_post();?>
            <?php static $count = 0;
          	if ($count == '10') // Numero di post da visualizzare
          	   { break; }
          	else { ?>
              <p>  <a href="<?php the_permalink() ?>"><?php the_title(); ?></a> - Postato il&nbsp;&nbsp;<?php echo get_the_date(); ?>&nbsp;&nbsp;in&nbsp;&nbsp;<?php the_category(', '); ?>&nbsp;&nbsp;da&nbsp;&nbsp;<?php the_author_posts_link(); ?></p>
              <?php $count++; } ?>
          	<?php endwhile; else: ?>
          	  <p>Nessun post.</p>
          	<?php endif; ?>
          </div>

    Grazie mille lo stesso.

Stai visualizzando 1 risposte (di 1 totali)
  • Il topic ‘Visualizzare gli ultimi post dell’utente corrente’ è chiuso a nuove risposte.