Ver Mensaje Individual
  #15 (permalink)  
Antiguo 15/12/2011, 02:45
walvaRo
 
Fecha de Ingreso: febrero-2004
Mensajes: 446
Antigüedad: 20 años, 2 meses
Puntos: 0
Respuesta: Problema con Paginacion

¡Muchísimas gracias! voy a probar con lo que me decís a ver que averiguo. Si tengo mas dudas os preguntaré, (seguro que si). :)

¡Un saludo!

EDITO:

¡Hola de nuevo!

Sin ser un experto ni tener apenas conocimientos de wp o de programación, me da la sensación de que el problema reside en el archivo loop.php

Este es el código de loop.php:

Código PHP:
Ver original
  1. <?php if ( have_posts() ) : ?>
  2.  
  3. <?php if($m) {$current_year = $m;} else {$current_year = date('Y');}; $current_category = $cat; ?>
  4. <?php if ( is_home() ) {
  5.     query_posts($query_string . 'posts_per_page=6&cat=1,37,38');
  6.     echo ('<div id="loop" class="news clear">');
  7. } else if ( is_category(array(6,33,34)) ) {
  8.     query_posts($query_string . 'year=' . $current_year . '&cat=' . $current_category . '&orderby=title&order=ASC');
  9.     echo ('<div id="loop" class="grid clear">');
  10. } else if ( is_search() ) {
  11.     global $query_string;
  12.     $query_args = explode("&", $query_string);
  13.     $search_query = array();
  14.     foreach($query_args as $key => $string) {
  15.         $query_split = explode("=", $string);
  16.         $search_query[$query_split[0]] = $query_split[1];
  17.     } // foreach
  18.     $search = new WP_Query($search_query);
  19.     echo ('<div id="loop" class="list clear">');
  20. } else {
  21.     query_posts($query_string . 'year=' . $current_year . '&cat=' . $current_category . '&orderby=date&order=DES');
  22.     echo ('<div id="loop" class="list clear">');
  23. }
  24. ?>
  25.  
  26. <?php while ( have_posts() ) : the_post(); ?>
  27. <?php if ( is_category(array(6,33,34))) { ?>
  28.  
  29.         <div <?php post_class('post clear'); ?> id="post_<?php the_ID(); ?>">
  30.             <div class="back_thumb">
  31.         <?php if ( has_post_thumbnail() ) :?>
  32.                 <a href="<?php the_permalink() ?>" class="thumb"><?php the_post_thumbnail('thumbnail', array(
  33.                         'alt'    => trim(strip_tags( $post->post_title )),
  34.                         'title'    => trim(strip_tags( $post->post_title )),
  35.                     )); ?></a>
  36.             <?php endif; ?>
  37.         </div>
  38.                 <h2 class="name"><a href="<?php  the_permalink() ?>"><?php the_title();  ?></a></h2>
  39.         </div>
  40.  
  41.  
  42. <?php } elseif ( is_category(array(1,37,38))) { ?>
  43.  
  44.         <div <?php post_class('post clear'); ?> id="post_<?php the_ID(); ?>">
  45.             <div class="back_thumb">
  46.         <?php if ( has_post_thumbnail() ) :?>
  47.                 <a href="<?php the_permalink() ?>" class="thumb"><?php the_post_thumbnail('thumbnail', array(
  48.                         'alt'    => trim(strip_tags( $post->post_title )),
  49.                         'title'    => trim(strip_tags( $post->post_title )),
  50.                     )); ?></a>
  51.             <?php endif; ?>
  52.         </div>
  53.  
  54.                 <div class="post-category"><?php the_category('<span> / </span>'); ?></div>
  55.                 <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
  56.         <?php $field = get_field('fecha_de_inicio'); ?>
  57.         <?php if ($field) : ?>
  58.         <h3><?php the_field('fecha_de_inicio'); ?> - <?php the_field('fecha_de_finalizacion'); ?></h3>
  59.         <?php endif; ?>
  60.         </div>
  61.  
  62. <?php } else { ?>
  63.  
  64.         <div <?php post_class('post clear'); ?> id="post_<?php the_ID(); ?>">
  65.             <div class="back_thumb">
  66.         <?php if ( has_post_thumbnail() ) :?>
  67.                 <a href="<?php the_permalink() ?>" class="thumb"><?php the_post_thumbnail('thumbnail', array(
  68.                         'alt'    => trim(strip_tags( $post->post_title )),
  69.                         'title'    => trim(strip_tags( $post->post_title )),
  70.                     )); ?></a>
  71.             <?php endif; ?>
  72.         </div>
  73.                 <div class="post-category"><?php the_category('<span> / </span>'); ?></div>
  74.                 <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
  75.         <?php $field = get_field('fecha_de_inicio'); ?>
  76.         <?php if ($field) : ?>
  77.         <h3><?php the_field('fecha_de_inicio'); ?> - <?php the_field('fecha_de_finalizacion'); ?></h3>
  78.         <?php endif; ?>
  79.                 <div class="post-content"><a href="<?php  the_permalink() ?>"><?php if (function_exists('smart_excerpt'))  smart_excerpt(get_the_excerpt(), 30); ?></a></div>
  80.         </div>
  81.  
  82. <?php } ?>
  83.  
  84. <?php endwhile; ?>
  85.  
  86.    </div>
  87.  
  88. <?php endif; ?>

Me he dado cuenta de que en ningúno de los "elseif is_category" aparece la categoría para la que quiero una paginación correcta, la categoria que no se "pagina" bien tiene asociado el número 5, el problema es que no funciona si añado un 5 a alguno de los "elseif is_category".

He probado a crear un nuevo "elseif is_category" dedicado a la categoria que quiero, sin usar array para que no se mezcle:

Código PHP:
Ver original
  1. else if ( is_category(5) ) {
  2.     query_posts($query_string . 'year=' . $current_year . 'posts_per_page=3&cat=' . $current_category . '&orderby=date&order=ASC');
  3.     echo ('<div id="loop" class="news clear">');
  4. }
Pero tampoco funciona.

Última edición por rogertm; 15/12/2011 a las 10:26