Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    wordpress: mostrare certi articoli fissi nella home

    Salve,

    non so se la sezione migliore sia CMS o questa, ma in definitiva ho un piccolo problema di php legato a wordpress.

    Sto cercando di creare una pagina dove vengano mostrati alcuni post fissi, che non spariscono mai, e poi tutti gli altri post, come di norma.

    Per fare questo ho creato una categoria "in evidenza" (con id 14 ) che contiene i post che devono rimanere fissi, e poi ho fatto questo codice per l'index.php

    codice:
    <?php get_header(); ?>
    
    	<div id="content" class="narrowcolumn">
    
    
    <h2>Articoli In Evidenza</h2>
    <?php query_posts('cat=14'); ?>
    
        <?php if (have_posts()) : while(have_posts()) : the_post(); ?>
    <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
    				<h2>"><?php the_title(); ?></h2>
    				<?php the_time(__('F jS, Y', 'kubrick')) ?> 
    
    				<div class="entry">
    					<?php the_content(__('Read the rest of this entry &raquo;', 'kubrick')); ?>
    				</div>
    
    				<p class="postmetadata"><?php the_tags(__('Tags:', 'kubrick') . ' ', ', ', '
    '); ?> <?php printf(__('Posted in %s', 'kubrick'), get_the_category_list(', ')); ?> | <?php edit_post_link(__('Edit', 'kubrick'), '', ' | '); ?>  <?php comments_popup_link(__('No Comments &#187;', 'kubrick'), __('1 Comment &#187;', 'kubrick'), __('% Comments &#187;', 'kubrick'), '', __('', 'kubrick') ); ?></p>
    			</div>
        <?php endwhile; endif; ?>
    
    
      
      <?php rewind_posts(); ?>
      
      
    	<?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    		
    		
    		 <?php if (in_category('14')) continue; ?>
    		 
    
    			<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
    				<h2>"><?php the_title(); ?></h2>
    				<?php the_time(__('F jS, Y', 'kubrick')) ?> 
    
    				<div class="entry">
    					<?php the_content(__('Read the rest of this entry &raquo;', 'kubrick')); ?>
    				</div>
    
    				<p class="postmetadata"><?php the_tags(__('Tags:', 'kubrick') . ' ', ', ', '
    '); ?> <?php printf(__('Posted in %s', 'kubrick'), get_the_category_list(', ')); ?> | <?php edit_post_link(__('Edit', 'kubrick'), '', ' | '); ?>  <?php comments_popup_link(__('No Comments &#187;', 'kubrick'), __('1 Comment &#187;', 'kubrick'), __('% Comments &#187;', 'kubrick'), '', __('', 'kubrick') ); ?></p>
    			</div>
    
    		<?php endwhile; ?>
    
    		<div class="navigation">
    						<?php if(function_exists('wp_page_numbers')) { wp_page_numbers(); } ?>
    
    		</div>
    
    	<?php else : ?>
    
    		<h2 class="center"><?php _e('Not Found', 'kubrick'); ?></h2>
    		<p class="center"><?php _e('Sorry, but you are looking for something that isn’t here.', 'kubrick'); ?></p>
    		<?php include (TEMPLATEPATH . "/searchform.php"); ?>
    
    	<?php endif; ?>
    
    	</div>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    praticamente ci sono 2 loop: uno mostra gli articoli in evidenza ( e funziona), l'altro dovrebbe mostrare quelli "normali" ( e NON funziona).

    Qualcuno sa dirmi cosa ho sbagliato? Non sono molto esperto di php ....

    Ah, in fondo c'è un div per un plugin per la navigazione. Anche quello non compare nella pagina.

    Inoltre dal menu delle categorie sulla dx mi dice sempre che sono nella categoria "in evidenza" ( tramite la classe "current-cat" del css). Anche questo, oltre ad essere sbagliato andrebbe evitato.

    Eventuali aiuti sono benvenuti, grazie
    If you don’t know what this value should be, check with your system administrator. If you are the system administrator, figure out what this value should be

  2. #2
    up, tante volte qualcuno avesse voglia di dare un occhio ...
    If you don’t know what this value should be, check with your system administrator. If you are the system administrator, figure out what this value should be

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.