come modificare script per avere la categoria

  • Avatar di Sconosciuto

    Ciao a tutti,

    riprovo a chiedere aiuto a questo forum:

    ho questo script che funziona benissimo ma non so dove cambiarlo per poter mostrare i post di una sola categoria

    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

    <div class="post">
    <h2 id="post-<?php the_ID(); ?>">" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h2>
    <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>

    <div class="entry">
    <?php the_content('Read the rest of this entry »'); ?>
    </div>

    <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit','','|'); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>

    <!--
    <?php trackback_rdf(); ?>
    -->
    </div>

    <?php endwhile; ?>

    <div class="navigation">
    <div class="alignleft"><?php posts_nav_link('','','« Previous Entries') ?></div>
    <div class="alignright"><?php posts_nav_link('','Next Entries »','') ?></div>
    </div>

    <?php else : ?>

    <h2 class="center">Not Found</h2>
    <p class="center"><?php _e("Sorry, but you are looking for something that isn't here."); ?></p>
    <?php include (TEMPLATEPATH . "/searchform.php"); ?>

    <?php endif; ?>

    Vi prego aiutatemi che non so più dove sbattere la testa, ho cercato in rete ma gli script adeguati alla mia necessità non funzionano bene come questo.

    Grazie per l’attenzione,

    Saluti,

    Federica

    Ho bisogno d'aiuto per il blog (visibile solo agli utenti che hanno effettuato l'accesso).

  • Avatar di Sconosciuto

    Mi rispondo da sola, perchè alla fine dopo estenuanti ricerche cel’ho fatta e condivido con vuoi la soluzione, magari a qualcuno può servire:

    <?php
    query_posts('category_name=nomecategoria&showposts=3');
    if (have_posts()) : while (have_posts()) : the_post(); ?>

    showposts è il numero di post da visualizzare

  • L'argomento ‘come modificare script per avere la categoria’ è chiuso a nuove risposte.