Ver Mensaje Individual
  #8 (permalink)  
Antiguo 21/12/2010, 09:24
pleter
 
Fecha de Ingreso: julio-2009
Ubicación: Argentinalandia
Mensajes: 339
Antigüedad: 14 años, 9 meses
Puntos: 15
Respuesta: Como listar de manera aleatoria los post de una categoría

intenta poner esto en tu index.php (haz una copia de seguridad del index.php original y reservalo para desacer los cambios por si no sirve mi idea ya que nunca lo hice)

en el index.php coloca
Código PHP:
<?php get_header(); ?>
    <div id="content" class="narrowcolumn" role="main"> 

<?php
if (is_category('categoria')){ include (TEMPLATEPATH '/especial.php'); }
else { include (
TEMPLATEPATH '/sidebar-main.php'); } elseif { include (TEMPLATEPATH '/normal.php');}
?>

</div>
<?php get_sidebar(); ?>
<?php get_footer
(); ?>
<?php
// Silence is golden.?>
haz un archivo llamado normal.php con este contenido:

Código PHP:
    <?php if (have_posts()) : ?>
        
        <?php while (have_posts()) : the_post(); ?>
            <div class="post" id="post-<?php the_ID(); ?>">
                <div class="post-c">
                    <div class="post-cnt">
                        <h2><span><a href="<?php the_permalink() ?>" rel="bookmark" title="Enlace Permanente a <?php the_title_attribute(); ?>"><?php the_title(); ?></a></span></h2>
                        <small class="date"><?php the_time('M'?><br /><?php the_time('j'?></small>
<p>Autor: <?php the_author(); ?></p>
<?php if (function_exists('author_exposed')){author_exposed();} ?>
                        <div class="entry">
                            <?php the_content('Leer más &raquo;'); ?>
                        </div>
                    </div>
                </div>
                <div class="post-b">
                    <div class="post-cnt post-meta">
                        <p>Posted in <?php the_category(', '?></p>
                        <?php the_tags('<p>Tags: '', ''</p>'); ?>
                        <span class="num-comments"><?php comments_popup_link('0 Comments''1 Comment''% Comments'); ?></span>
                    </div>
                </div>
            </div>
        <?php endwhile; ?>

<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>


    <?php else : ?>
        <h2 class="center">No se encuentra!!</h2>
        <p class="center">¡Mmm... Estás buscando algo que no esta aquí!</p>
        <?php get_search_form(); ?>
    <?php endif; ?>
haz un archivo llamado especial.php con el siguiente contenido

Código PHP:
    <?php if (have_posts()) : ?>
        
            <?php query_posts(array('orderby' => 'rand')); if (have_posts()) : while (have_posts()) : the_post(); ?>
            <div class="post" id="post-<?php the_ID(); ?>">
                <div class="post-c">
                    <div class="post-cnt">
                        <h2><span><a href="<?php the_permalink() ?>" rel="bookmark" title="Enlace Permanente a <?php the_title_attribute(); ?>"><?php the_title(); ?></a></span></h2>
                        <small class="date"><?php the_time('M'?><br /><?php the_time('j'?></small>
<p>Autor: <?php the_author(); ?></p>
<?php if (function_exists('author_exposed')){author_exposed();} ?>
                        <div class="entry">
                            <?php the_content('Leer más &raquo;'); ?>
                        </div>
                    </div>
                </div>
                <div class="post-b">
                    <div class="post-cnt post-meta">
                        <p>Posted in <?php the_category(', '?></p>
                        <?php the_tags('<p>Tags: '', ''</p>'); ?>
                        <span class="num-comments"><?php comments_popup_link('0 Comments''1 Comment''% Comments'); ?></span>
                    </div>
                </div>
            </div>
        <?php endwhile; ?>

<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>


    <?php else : ?>
        <h2 class="center">No se encuentra!!</h2>
        <p class="center">¡Mmm... Estás buscando algo que no esta aquí!</p>
        <?php get_search_form(); ?>
    <?php endif; ?>
en si, lo unico que hace es:
SI es la categoria "categoria" (cambia por el nombre de tu categoria) muestra el contenido de especial.php SINO muestra el contenido de normal.php
los includes es para no hacer el archiv tan largo y que se entienda un poco mejor.
prueba a ver si con eso se soluciona todo.
__________________
Mi Perfil y Blog estan en Yeow.com.ar ✰✰✰✰✰
Pero en WONDED.COM estan Mis Proyectos OpenSource ;-)