• User

    Mostrare un solo l'ultimo Post

    Salve, ho un sito fatto in wordpress, vorrei visualizzare solo l'ultimo post in home page; non ho trovato widget adatto e non so dove modificare il codice potreste gentilmente indicarmi come modificare il seguente codice?

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

    	<?php while (have_posts()) : the_post(); ?>
    
    
    	<div class="post">
    		<div class="post-date">
        <span class="post-month"><?php the_time('M') ?></span> 
      	<span class="post-day"><?php the_time('j') ?></span>
      </div>
    		<div class="post-title">
    			<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    			<span class="post-cat"><?php the_category(', ') ?></span> 
    
    
    		</div>
    		<div class="entry">
    			<?php the_content('Read the rest of this entry &raquo;'); ?>
    		</div>
    	</div>
    
    
    	<?php endwhile; ?>
    
    
    	<div class="navigation"> 
    		<span class="previous-entries"><?php next_posts_link('Older Entries') ?></span>
    		<span class="next-entries"><?php previous_posts_link('Newer Entries') ?></span> 
    	</div>
    
    
    <?php else : ?>
    
    
    	<h2>Not Found</h2>
    	<p>Sorry, but you are looking for something that isn't here.</p>
    
    
    <?php endif; ?>
    

    Grazie


  • User Attivo

    Prova ad inserire prima dell'istruzione

    if (have_posts()) :
    la seguente riga:
    query_posts('posts_per_page=1');

    Ciao


  • User

    Funge!!! Grazie tante!