Index muestra contenido primer post dos veces juntos

  • Autor Autor Combex
  • Fecha de inicio Fecha de inicio
Combex

Combex

Gamma
Redactor
Resulta que en el index del blog se repite el preview del primer post quedando dos veces juntos y luego todos los demas.

Para entender mejor el problema pueden entrar a Enlace eliminado

Creo que el problema esta básicamente en el index.php, obviamente, pero no puedo entender bien donde. Alguien puede brindarme ayuda por favor?? Muchas gracias desde ya

Insertar CODE, HTML o PHP:
<?php get_header(); ?>

<!-- Left // -->
<div class="wpn_left">
	<?php if (have_posts()) : ?>
		<?php if($_GET['paged']) : ?>
			<span class="wpn_heading4">Page <?php echo $_GET['paged']; ?> &raquo;</span>
		<?php endif; ?>
		
		<?php if(!$_GET['paged']) : ?>
			<!-- Featured Post // -->
			<?php $featured = new WP_Query("cat=".get_wpn_config('featured_category_id')."&showposts=1"); while($featured->have_posts()) : $featured->the_post();?>
			<?php $featured_post_id = get_the_ID(); ?>
			<div class="wpn_box wpn_featured">
				<a class="wpn_thumbnail" href="<?php the_permalink(); ?>"><img src="<?php echo get_post_meta($post->ID, "image", true); ?>" alt="" /></a>
				<a class="wpn_title" href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
				<div class="wpn_post">
					<?php wpn_content_limit(get_the_content(),420); ?>
				</div>
				<a class="wpn_more" href="<?php the_permalink(); ?>">Leer más</a>
				<div class="wpn_clear"></div>
			</div>
			<?php endwhile; ?>
			<!-- // Featured Post -->
		
			<!-- Twitter Updates // -->
			<div class="wpn_box wpn_box-small wpn_twitter">
				<span class="wpn_heading">Nuestro Twitter</span>
				<ul>
					<?php
					$twitter_username = get_wpn_config('twitter_username');
					$twitter_limit = get_wpn_config('twitter_limit');
					
					$ctx = stream_context_create(array(
						'http' => array(
							'timeout' => 5
							)
						)
					); 
					
					$feed = @file_get_contents("http://twitter.com/statuses/user_timeline/".$twitter_username.".rss?count=".$twitter_limit, 0, $ctx);
					
					if($feed) {
						$xml = new SimpleXMLElement($feed);
						$updates = $xml->channel->item;
					}
					
					if($feed&&$updates) {
						$output = "";
						foreach($updates as $status) {
							$description = str_replace($twitter_username.': ','',$status->description);
							
							$search = array('|(http://[^ ]+)|', '|@([\w_]+)|');
							$replace = array('<a href="$1" target="_blank">$1</a>', '<a href="http://twitter.com/$1" target="_blank">@$1</a>');
							$description = preg_replace($search, $replace, $description);
							
							$date = strtotime($status->pubDate);
							$link = $status->link;
							
							$output .= "<li>".$description." - <a target=\"_blank\" href=\"".$link."\">more</a></li>";
						}
					}
					else {
						$output .= '<li>Uh oh. it looks like Twitter is unavailable at the moment.</li>';
					}
					
					echo $output;
					?>
					<li class="wpn_follow">Follow me on <a href="http://www.twitter.com/<?php echo $twitter_username; ?>" target="_blank"><img src="<?php bloginfo('stylesheet_directory'); ?>/img/twitter_icon.gif" alt="" /></a></li>
				</ul>
			</div>
			<!-- // Twitter Updates -->
			
			<!-- Recent Comments // -->
			<div class="wpn_box wpn_box-small wpn_rcomments">
				<span class="wpn_heading">Ultimos comentarios</span>
				<ul>
					<?php
					global $wpdb;
					$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author_email, comment_author, comment_date_gmt,
					comment_approved, comment_type,comment_author_url, SUBSTRING(comment_content,1,60) AS com_excerpt FROM $wpdb->comments LEFT
					OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) WHERE comment_approved = '1' AND comment_type
					= '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT 5";

					$comments = $wpdb->get_results($sql);
					$output = "";
					
					foreach ($comments as $comment) {
						$output .= "
						<li>
							<a class=\"wpn_avatar\" href=\"" . get_permalink($comment->ID) . "#comment-" . $comment->comment_ID . "\">".get_avatar( get_comment_author_email(),'24', $default=''.get_bloginfo('stylesheet_directory').'/img/avatar_small.jpg')."</a>
							" . strip_tags($comment->com_excerpt) . "...
							<a href=\"" . get_permalink($comment->ID) . "#comment-" . $comment->comment_ID . "\" title=\"on" . $comment->post_title ."\">more</a>
							<div class=\"wpn_clear\"></div>
						</li>" ; 
					}

					echo $output;
					?>
				</ul>
			</div>
			<!-- // Recent Comments -->
			
			<!-- Clear -->
			<div class="wpn_clear"></div>
		<?php endif; ?>
			
		<!-- News List // -->
		<ul class="wpn_news">

		<?php while (have_posts()) : the_post(); ?>
			<li <?php post_class() ?> id="post-<?php the_ID(); ?>">
				<?php
				$thumb = get_post_meta($post->ID, "image", true);
				if($thumb)
				echo '<a href="'.get_permalink().'" class="wpn_thumbnail"><img src="'.$thumb.'" alt="" /></a>';
				?>
				<div class="wpn_nright<?php if(!$thumb) echo " wpn_nright_nothumb"; ?>">
					<a class="wpn_title" href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
					<span class="wpn_info">Posted by <?php the_author_posts_link() ?> on <?php the_time('F jS, Y \a\t g:i a') ?></span>
					<div class="wpn_post">
						<?php wpn_content_limit(get_the_content(),500); ?>
					</div>
				</div>
				<a class="wpn_more" href="<?php the_permalink(); ?>">Leer más</a>
				<div class="wpn_clear"></div>
			</li>
		<?php endwhile; ?>
		</ul>
		<!-- // News List -->
		
		<!-- Page Navigation -->
		<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
		
	<!-- 404 Error -->
	<?php else : include ('editable/404/404-error.php'); endif; ?>
	<div class="wpn_clear"></div>
</div>
<!-- // Left -->
<?php get_sidebar(); ?>
<noscript><a href="http://www.free-premium-wordpress-themes.com">premium wordpress themes</a></noscript>
<?php get_footer(); ?>
 
Es el "Featured Post"
 
Lo que quiso decir Pepel es que basicamente saques el plugin featured post, comentes las lineas de codigo o extraigas estas parte
Insertar CODE, HTML o PHP:
			<!-- Featured Post // -->
			<?php $featured = new WP_Query("cat=".get_wpn_config('featured_category_id')."&showposts=1"); while($featured->have_posts()) : $featured->the_post();?>
			<?php $featured_post_id = get_the_ID(); ?>
			<div class="wpn_box wpn_featured">
				<a class="wpn_thumbnail" href="<?php the_permalink(); ?>"><img src="<?php echo get_post_meta($post->ID, "image", true); ?>" alt="" /></a>
				<a class="wpn_title" href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
				<div class="wpn_post">
					<?php wpn_content_limit(get_the_content(),420); ?>
				</div>
				<a class="wpn_more" href="<?php the_permalink(); ?>">Leer más</a>
				<div class="wpn_clear"></div>
			</div>
			<?php endwhile; ?>
			<!-- // Featured Post -->
 
Si, entiendo. Pero lo que ocurre es que siempre tuve el featured post y antes no provocaba este error, sino que el featured aparecia solo arriba y luego bajaba como un post normal cuando agregaba uno nuevo.
 
Porque está des configurado. Si ves tienen el parámetro ."&showposts=1" mostrando solo un post.
 
Claro, entiendo Fabián. Finalmente lo solucioné eliminando los featured posts y reordenando los elementos del theme.

Pueden darme una opinion a ver si les gusta? Enlace eliminado

Gracias!
 
Me agradó como quedó el orden de los posts, sin embargo al final se ve raro el Twitter y los últimos comentarios. Probaría dándole más distancia con el pagenavi o poniéndolos en la sidebar. Saludos.
 
A mi lo de twitter no me cuadra mucho ahi abajo lo pondria debajo de las fotos de los concursantes o algo asi ya que queda mas a la vista segun entras
 
Atrás
Arriba