Note that there are some explanatory texts on larger screens.

plurals
  1. POIf date is not empty or if date has string "date"
    primarykey
    data
    text
    <p>Hi I have a drop down list with the first option shown is an option i have set as DATE.. I need an if statement that runs if the date is empty or if the first options which says "DATE" is selected..Right know MY AJAX only works if the date selected..</p> <p>This is my drop down</p> <pre><code>&lt;?php $dates = array(); $argez = (array( 'post_type' =&gt; 'latest_message')); query_posts( $argez ); if (have_posts()) : while (have_posts()) : the_post(); $dates[] = get_the_date(); $dates = array_unique($dates); print_r($datesun); endwhile; echo '&lt;option value="#"&gt;DATE&lt;/option&gt;'; foreach($dates as $date) { echo '&lt;option value="' . $date . '"&gt;' . $date .'&lt;/option&gt; '; } endif; ?&gt; </code></pre> <p>This is my ajax</p> <pre><code>global $post, $wpdb; if ($_POST["series"]!=0 ) { $series = array($_POST['series']); } else { $series = get_terms( 'series', array('fields' =&gt; 'ids') ); //$series = array(implode(', ',$series)); } if ($_POST["speaker"]!=0 ) { $speaker = array($_POST["speaker"]); } else { $speaker = get_terms( 'speaker', array('fields' =&gt; 'ids') ); //$speaker = array(implode(', ',$speaker)); } if ($_POST["topic"]!=0 ) { $topic = array($_POST["topic"]); } else { $topic = get_terms( 'topic', array('fields' =&gt; 'ids') ); //$topic = array(implode(', ',$topic)); } if ($_POST["date"]!= NULL || $_POST["date"] == 'DATE') { $dates = strtotime($_POST["date"]); } else { } wp_reset_query(); $myquery= array( 'post_type' =&gt; 'latest_message', 'tax_query' =&gt; array( array( 'taxonomy' =&gt; 'series', 'terms' =&gt; $series, 'field' =&gt; 'id' ), array( 'taxonomy' =&gt; 'speaker', 'terms' =&gt; $speaker, 'field' =&gt; 'id', ), array( 'taxonomy' =&gt; 'topic', 'terms' =&gt; $topic, 'field' =&gt; 'id', ) ), 'date_query' =&gt; array( 'year' =&gt; date('Y', $dates), 'month' =&gt; date('m', $dates), 'day' =&gt; date('d', $dates), ), ); print_r($myquery); query_posts($myquery); </code></pre> <p>Part of the problem is the date array brings in this information below.. How do i get it to still run because there isn't any information matching that date.. Any ideas</p> <pre><code>[date_query] =&gt; Array ( [year] =&gt; 1970 [month] =&gt; 01 [day] =&gt; 01 </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload