Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/02/2014, 19:22
Avatar de Jkey
Jkey
 
Fecha de Ingreso: julio-2012
Mensajes: 28
Antigüedad: 11 años, 9 meses
Puntos: 0
Entradas aleatoria descontrolan los post

Hola a todos! Implemente un codigo para entradas aleatorias en mi blog el problema es que las entradas comunes en mi web se descontrolan, osea también tienen el mismo orden que las aleatorias. Pongo mi codigo:

Código:
get_header(); ?>

	<ul class="random_images_container">

	<?php $posts = get_posts('orderby=rand&numberposts=8'); foreach($posts as $post) { ?>
		<li>
			<div class="random_image">
				 <!-- image -->  
			    <?php the_post_thumbnail(); ?>
			    <!-- description div -->  
			    <div class='random_description'>  
			    <!-- description content -->  		    

			    <?php if(strlen(get_the_title())>28)
				{
					$variabletitle = get_the_title();
					$titulomostrado = substr($variabletitle,0,28);
					$title_random = $titulomostrado."...";
				}else{
					$title_random = get_the_title();
				}

				?>

			    	<div class='random_description_content'><a href="#"><?php echo $title_random; ?></a></div>  
			    <!-- end description content -->  
			    </div>  
			    <!-- end description div -->
			</div>
		</li>
	<?php  } ?>
	</ul>
	

	<div id="content-middle">

		<div id="home_ads">
		</div>

	<div id="primary" class="content-area">
		
		<main id="main" class="site-main" role="main">
		<?php if ( have_posts() ) : ?>

			<?php /* Start the Loop */ ?>

			<?php while ( have_posts() ) : the_post(); ?>
			<div id="home_post_middle">
				<div id="home_post_tumbnail"><?php the_post_thumbnail(); ?></div>
					<?php
						/* Include the Post-Format-specific template for the content.
						 * If you want to override this in a child theme, then include a file
						 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
						 */
						get_template_part( 'content', get_post_format() );
					?>
			</div>

			<?php endwhile; ?>

			<?php next_posts_link( '<div class="nav-previous">Viejas entradas</div>' ); ?>
			<?php previous_posts_link( '<div class="nav-next">Nuevas entradas</div>' ); ?>

		<?php else : ?>

			<?php get_template_part( 'content', 'none' ); ?>

		<?php endif; ?>

		</main><!-- #main -->
	</div><!-- #primary -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>
Si yo uso esto para reiniciar los post también queda mal:

Código:
<?php $posts = get_posts('orderby=date'); foreach($posts as $post) { ?>
Probé también con <?php wp_reset_postdata(); ?> y nada, nada funciona las entradas siguen saliendo aleatorias...
Alguien me puede ayudar?


Muchas gracias!