Ver Mensaje Individual
  #2 (permalink)  
Antiguo 21/01/2013, 10:23
alvarols
 
Fecha de Ingreso: diciembre-2008
Mensajes: 738
Antigüedad: 15 años, 5 meses
Puntos: 15
Respuesta: filtro para fechas no funciona

Ya lo corregí

Código PHP:
Ver original
  1. <?php
  2.                             function filter_where($where = '') {
  3.                             //posts in the last 24 Hours
  4.                             $where .= " AND post_date > '" . date('Y-m-d H:i:s', strtotime('-36 hours')) . "'";
  5.                             return $where;
  6.                           }
  7.                             add_filter('posts_where', 'filter_where');
  8.                             $query = new WP_Query("cat=".$categoria."");
  9.                         ?>
  10.                         <?php if(have_posts()) : ?><?php while($query->have_posts()) : $query->the_post(); ?>
  11.                         <h1 class="negrocentro"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
  12.                         <?php endwhile; ?>
  13.                         <?php endif; ?>
  14.                         <?php
  15.                             remove_filter( 'posts_where', 'filter_where' );
  16.                         ?>