Ver Mensaje Individual
  #11 (permalink)  
Antiguo 21/12/2010, 14:01
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

a ver.. segun: http://codex.wordpress.org/Function_...ce/in_category
seria este codigo

Código PHP:
<?php 
if ( in_category'pachyderms' )) {
    
// They have long trunks...
} elseif ( in_category( array( 'Tropical Birds''small-mammals' ) )) {
    
// They are warm-blooded...
} else {
    
// & c.
}
?>
adaptado seria

Código PHP:
<?php 
if ( in_category'categoria' )) {
    
si es la categoria tal muestra tal cosa
} else {
    
sino muestra tal otra
}
?>
tomando en referencia las paginas que te di antes seria tu index.php:


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

<?php 
if ( in_category'categoria' )) {
    include (
TEMPLATEPATH '/especial.php');
} else {
    include (
TEMPLATEPATH '/normal.php');
}
?>

</div>
<?php get_sidebar(); ?>
<?php get_footer
(); ?>
<?php
// Silence is golden.?>
donde normal.php seria:

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; ?>
y el especial.php seria

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; ?>
p.s.:
Código PHP:
<?php query_posts(array('orderby' => 'rand')); if (have_posts()) : while (have_posts()) : the_post(); ?>
puede variar segun el theme, dame un segundo que tengo que terminar algo y termino de revisar los detalles.
__________________
Mi Perfil y Blog estan en Yeow.com.ar ✰✰✰✰✰
Pero en WONDED.COM estan Mis Proyectos OpenSource ;-)