Ver Mensaje Individual
  #3 (permalink)  
Antiguo 28/08/2012, 11:02
Avatar de AlZuwaga
AlZuwaga
Colaborador
 
Fecha de Ingreso: febrero-2001
Ubicación: 34.517 S, 58.500 O
Mensajes: 14.550
Antigüedad: 23 años, 2 meses
Puntos: 535
Respuesta: ¿Cómo mostrar dos columnas de entradas en WordPress‏‏?

Cita:
En la página principal, quiero que la 1ª noticia sea la 1ª de la categoría fútbol (por ejemplo), la 2ª noticia sea la 1ª de la categoría baloncesto, la 3ª noticia sea la 1ª de la categoría tenis, etc., es decir, que en mi portada tenga siempre la última noticia insertada en cada una de mis categorías
Hola. Yo para esto haría algo así:

Código:
<?php 
$cat_args = array(
  'orderby' => 'name',
  'order' => 'ASC',
  'child_of' => 0
);

$categories =   get_categories($cat_args);

foreach($categories as $category) {
    echo '<dl>';
    echo '<dt> <a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a></dt>';
	
     $post_args = array(
      'numberposts' => 1,
      'category' => $category->term_id 
    );

    $posts = get_posts($post_args);
	
	foreach($posts as $post) {
	?>
		<dd><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></dd>
	<?php 
	} 
	echo '<dd class="view-all"> <a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>View all posts in ' . $category->name.'</a></dd>';
	echo '</dl>';
} 
?>
El marcado html es lo de menos, es sólo la idea lo importante.
__________________
...___...