Ver Mensaje Individual
  #5 (permalink)  
Antiguo 03/08/2012, 04:28
Avatar de Osaka_lime
Osaka_lime
 
Fecha de Ingreso: septiembre-2010
Mensajes: 30
Antigüedad: 13 años, 7 meses
Puntos: 3
Respuesta: Mostrar post seleccionando fechas en calendario

Vale, como profetice, me he atascado.


Al probar este codigo:
Código PHP:
<?php
        
        
        
function filter_where($where '') {
                
                
               
$where .= " AND post_date > '2012-08-01' AND post_date < '2012-08-04'";
              
            return 
$where;
          }
        
add_filter('posts_where''filter_where');
        
$query = new WP_Query( array( 'post_type' => 'post' ) );
        
         while( 
$query->have_posts() ) : $query->the_post();

    echo 
'<h2>'get_the_title() .'</h2>';


    endwhile;
        
        
?>
y si funciona, pero sin embargo al cambiar las fechas por variables que quedarían de la siguiente manera, no me muestra nada:

Código PHP:
 $where .= " AND post_date > '".$fecha_inicio."' AND post_date < '".$fecha_final."'"
que estoy haciendo mal?

Gracias!
__________________
Visita mi blog http:www.osakalime.com o http://www.osakalime.es