Cómo ordenar artículos por fecha en WordPress

  • Autor Autor bohem
  • Fecha de inicio Fecha de inicio
B

bohem

Alfa
¡Usuario con pocos negocios! ¡Utiliza siempre saldo de Forobeta!
Hola, quiero hacer un blog con Wordpress pero tengo un inconveniente; quiero ordenar los artículos por fecha, el más antiguo primero para que haya una secuencia de arriba hacia abajo ¿qué tengo que hacer? Muchas gracias por tu colaboración.
 
los quieres ordenar en el adminsitrador o de cara al público?
 
quiero ordenarlos de cara al público
 
Pues por ejemplo: Muestra en el inicio todos los posts de las categorias 1 2 y 3 paginando de 10 en 10 y ordenando por fecha descendente.

<?php
if ( is_home() ) {
query_posts( array( 'category__and' => array(1,2,3), 'posts_per_page' => 10, 'orderby' => 'date', 'order' => 'DESC' ) );
}
?>

Lo pegas en index.php del theme y listos, trabaja a apartir de aqui, un saludo.

ah, por cierto:

Function Reference/query posts « WordPress Codex
 
Que interesante esta opción no tenía idea que podía hacerse de este modo... Muy útil para cierto tipo de sitios =)
 
Muchas gracias scytale, tengo sólo un problema; de programación nada de nada. Copie el código y lo pegue en el index de la plantilla pero no pasó nada; a lo mejor no lo hice como debía... aquí lo que hay...

<?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: Template Hierarchy « WordPress Codex
*
* @package WordPress
* @subpackage Twenty_Eleven
*/

get_header(); ?>

<div id="primary">
<div id="content" role="main">

<?php if ( have_posts() ) : ?>

<?php twentyeleven_content_nav( 'nav-above' ); ?>

<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>

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

<?php endwhile; ?>

<?php twentyeleven_content_nav( 'nav-below' ); ?>

<?php else : ?>

<article id="post-0" class="post no-results not-found">
<header class="entry-header">
<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
</header><!-- .entry-header -->

<div class="entry-content">
<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->
</article><!-- #post-0 -->

<?php endif; ?>

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


<?php get_sidebar(); ?>
<?php get_footer(); ?>
<?php
if ( is_home() ) {
query_posts( array( 'category__and' => array(1,2,3), 'posts_per_page' => 10, 'orderby' => 'date', 'order' => 'DESC' ) );
}
?>

¿cómo lo tengo que hacer?

Muchas gracias de antemano.
 
Atrás
Arriba