Ver Mensaje Individual
  #2 (permalink)  
Antiguo 10/01/2013, 19:53
Avatar de ramoncito
ramoncito
 
Fecha de Ingreso: febrero-2003
Ubicación: Viña del Mar
Mensajes: 224
Antigüedad: 21 años, 9 meses
Puntos: 10
Respuesta: No reconoce una categoría en un bucle

Tienes un problema con la estructura. Traté de ajustarla a como creo que es.

Por favor prueba este código, traté de comentar pero es un poco largo



Código:
<?php get_header(); ?>
	<!-------PRINCIPAL-------->
* * <div id="contenido">
		<div class="contpost">
		<?php if (in_category('colaboradores')) { ?>
			<?php if (have_posts()) : ?>
* * * * * * * * <?php while (have_posts()) : the_post(); ?>
* * * * * * * * * * <h1 class="single"><?php the_title(); ?></h1>
* * * * * * * * * * <p class="author3"><?php the_author_posts_link(); ?></p>
* * * * * * * * * * <div class="postauthor"><b><?php the_time('l j F Y g:i a') ?></b>&nbsp;&nbsp;<?php edit_post_link('Editar'); ?></div>
* * * * * * * * * * <p><?php the_content(); ?></p>
* * * * * * * * * * 
				<?php endwhile; ?>
* * * * * * * * <div class="navigation"><p><?php posts_nav_link(); ?></p></div>
			<?php endif; ?>
* * * * * * <?php wp_reset_query(); ?>
			<div class="clear"></div>
* * * * * * * * * 
			<?php comments_template(); ?> * 
		<?php
        
		// agrega este cierre
		// corresponde a cerrar in_category('colaboradores') 
		} elseif (in_category('carton')) { ?>
			<?php if (have_posts()) : ?>
				<?php while (have_posts()) : the_post(); ?>
				<?php $do_not_duplicate = $post->ID; ?>
* * * * * * * * <h1 class="single"><?php the_title(); ?></h1>
* * * * * * * * <div class="postauthor"><b><?php the_time('l j F Y g:i a') ?></b>&nbsp;&nbsp;<?php edit_post_link('Editar'); ?></div>
				<p><?php the_content(); ?></p>
* * * * * * * * <div class="postclear">
* * * * * * * * * * * * * * * * <div class="postsocial">
* * * * * * * * * * * * * * * * * * <div class="fb">
* * * * * * * * * * * * * * * * * * * * <iframe src="//www.facebook.com/plugins/like.php?href=<?php the_permalink(); ?>&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=true&amp;font&amp;colorscheme=light&amp;action=like&amp;height=21&amp;appId=134075732530" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe>
* * * * * * * * * * * * * * * * * * </div>
* * * * * * * * * * * * * * * * * * <div class="tw">
* * * * * * * * * * * * * * * * * * * * <a href="http://twitter.com/share" data-url="<?php the_permalink(); ?>" class="twitter-share-button" data-text="Un freno a las emociones presidenciales" data-count="horizontal" data-via="elcerebrohabla" data-related="elcerebrohabla:Siguenos" data-lang="es">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
* * * * * * * * * * * * * * * * * * </div>
* * * * * * * * * * * * * * * * * * <div class="gl">
* * * * * * * * * * * * * * * * * * * * <div class="g-plusone" data-size="medium"></div>
* * * * * * * * * * * * * * * * * * </div>
* * * * * * * * * * * * * * * * * * <div class="li">
* * * * * * * * * * * * * * * * * * * * <script src="//platform.linkedin.com/in.js" type="text/javascript"></script>
<script type="IN/Share" data-url="<?php the_permalink(); ?>" data-counter="right"></script>
* * * * * * * * * * * * * * * * * * </div>
* * * * * * * * * * * * * * * * </div>
* * * * * * * * * * * * * * </div>
* * * * * * * * <?php endwhile; ?>
				<div class="navigation"><p><?php posts_nav_link(); ?></p></div>
			<?php endif; ?>
* * * * * * <?php wp_reset_query(); ?>
		
		<div class="estcabezalchico">
* * * * * * <h1>Anteriores</h1>
* * * * * * * * * </div>
* * * * * * * * * <?php $events_query = new WP_Query("cat=15&posts_per_page=12"); ?>
*
* * * * * * * * * <?php if(have_posts()) : ?>
					<?php while($events_query->have_posts()) : $events_query->the_post(); ?>
* * * * * * * * * * <?php if( $post->ID == $do_not_duplicate ) continue; ?>
* * * * * * * * * * * * <div class="cuadrorelated">
* * * * * * * * * * * * * * <div class="imagenrelated">
* * * * * * * * * * * * * * * * <?php if(has_post_thumbnail()) { ?>
* * * * * * * * * * * * * * * * * * <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('posthumb'); ?></a>
* * * * * * * * * * * * * * * * <?php } else {?>
* * * * * * * * * * * * * * * * * * <a href="<?php the_permalink(); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/hemeroteca.jpg" /></a>
* * * * * * * * * * * * * * * * <?php } ?>
* * * * * * * * * * * * * * </div>
* * * * * * * * * * * * </div>
* * * * * * * * * <?php endwhile; ?>
* * * * * * * * * <?php endif; ?>
* * * * * * * * * <div class="clear"></div>
* * * * * * * * * 
* * * * * * * * * <?php comments_template(); ?> *
		<?php
		} else { // cierre de in_category('carton')
		?>* * * * * * 
* * * * * * * * *<?php if (have_posts()) : ?>
* * * * * * * * *<?php while (have_posts()) : the_post(); ?>
* * * * * * * * *<?php $do_not_duplicate = $post->ID; ?>
* * * * * * * * * * <h1 class="single"><?php the_title(); ?></h1>
* * * * * * * * * * <div class="postauthor"><b><?php the_time('l j F Y g:i a') ?></b>&nbsp;&nbsp;<?php edit_post_link('Editar'); ?></div>
* * * * * * * * * * <p><?php the_content(); ?></p>
* * * * * * * * * * 
* * * * * * * * <?php endwhile; ?>
* * * * * * * * * <div class="navigation"><p><?php posts_nav_link(); ?></p></div>
* * * * * * * * * <?php endif; ?>
* * * * * * * * * <?php wp_reset_query(); ?>
* * * * * * * * * <div class="estcabezalchico">
* * * * * * * * * * <h1>Relacionadas</h1>
* * * * * * * * * </div>
* * * * * * * * * <?php $events_query = new WP_Query("cat=15&posts_per_page=12"); ?>
*
* * * * * * * * * <?php if(have_posts()) : ?><?php while($events_query->have_posts()) : $events_query->the_post(); ?>
* * * * * * * * * * <?php if( $post->ID == $do_not_duplicate ) continue; ?>
* * * * * * * * * * * * <div class="cuadrorelated">
* * * * * * * * * * * * * * <div class="imagenrelated">
* * * * * * * * * * * * * * * * <?php if(has_post_thumbnail()) { ?>
* * * * * * * * * * * * * * * * * * <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('posthumb'); ?></a>
* * * * * * * * * * * * * * * * <?php } else {?>
* * * * * * * * * * * * * * * * * * <a href="<?php the_permalink(); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/hemeroteca.jpg" /></a>
* * * * * * * * * * * * * * * * <?php } ?>
* * * * * * * * * * * * * * * * <h1 class="negrocentro"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
* * * * * * * * * * * * * * </div>
* * * * * * * * * * * * </div>
* * * * * * * * * <?php endwhile; ?>
* * * * * * * * * <?php endif; ?>
* * * * * * * * * <div class="clear"></div>
* * * * * * * * * 
* * * * * * * * * <?php comments_template(); ?> * * * * * *
* * * * * * * * <?php } ?>
* * * * * * * 
* * * * * </div> *
* * * * * </div>
* * * * <?php include (TEMPLATEPATH . '/sidebar2.php'); ?>
* * * * * * * * 
*
*
<?php get_footer(); ?>
__________________
:pensando: Ramon Martinez... Chile :adios: