Ver Mensaje Individual
  #3 (permalink)  
Antiguo 16/02/2014, 17:42
Avatar de Jkey
Jkey
 
Fecha de Ingreso: julio-2012
Mensajes: 28
Antigüedad: 12 años, 4 meses
Puntos: 0
Respuesta: Entradas aleatoria descontrolan los post

Cita:
Iniciado por zanguanga Ver Mensaje
Si pones el código completo será más fácil. No podemos adivinar cómo has creado el [URL="http://codex.wordpress.org/The_Loop"]Loop[/URL] ¿o no lo has creado?
Gracias!

Mi index:

Código:
<?php
/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package _s
 */

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 get_permalink(); ?>"><?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">
				<a href="<?php echo get_permalink(); ?>"><div id="home_post_tumbnail"><?php the_post_thumbnail(); ?></div></a>
					<?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(); ?>

Mi header:

Código:
<?php
/**
 * The Header for our theme.
 *
 * Displays all of the <head> section and everything up till <div id="content">
 *
 * @package _s
 */
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/js/random.js"></script>

<?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>
<div id="page" class="hfeed site">

	<header id="masthead" class="site-header" role="banner">
			<div class="text-top"><div class="text-top-center"><span>Esta página deFeed fue personalizada para nuestros lectores en Español. <a href="#">Volver a la versión en ingles</a></span></div></div>
			<div id="title-header"><div id="logo"><a href="<?php echo get_site_url(); ?>">FeeD</a></div></div>
			<!-- <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2> -->
			
			<nav id="site-navigation" role="navigation">
				<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?> 
			</nav><!-- #site-navigation -->
	</header><!-- #masthead -->

	<div id="content" class="site-content">