Note that there are some explanatory texts on larger screens.

plurals
  1. POPost dates selected from custom post type dropdown to ajax
    text
    copied!<p>I have a dropdown list of dates from a custom post type. So all the dates of published posts show.. I need to send this information to my ajax page. How do i do this this is my code that gets the posts dates</p> <pre><code>&lt;select id="date"&gt; &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; foreach($dates as $date) { echo '&lt;option value="' . $date . '"&gt;' . $date .'&lt;/option&gt; '; } endif; ?&gt; &lt;/select&gt; </code></pre> <p>I have another drop down which grabs the taxonomy topic information</p> <pre><code>&lt;?php //list terms in a given taxonomy using wp_list_categories (also useful as a widget if using a PHP Code plugin) $taxonomy = 'topic'; $orderby = 'name'; $show_count = 0; // 1 for yes, 0 for no $pad_counts = 0; // 1 for yes, 0 for no $hierarchical = 1; // 1 for yes, 0 for no $title = ''; $args_topic = array( 'taxonomy' =&gt; $taxonomy, 'orderby' =&gt; $orderby, 'show_count' =&gt; $show_count, 'pad_counts' =&gt; $pad_counts, 'hierarchical' =&gt; $hierarchical, 'title_li' =&gt; $title, 'show_option_all' =&gt; 'TOPIC' ); ?&gt; &lt;ul class="taxonomy-drops series-topic one-fifth"&gt; &lt;li id="categories"&gt; &lt;form action="&lt;?php bloginfo('url'); ?&gt;" method="get"&gt; &lt;div&gt; &lt;?php wp_dropdown_categories($args_topic); ?&gt; &lt;/div&gt; &lt;/form&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>I post the information to my ajax page like this and it works fine</p> <pre><code> if ($_POST["topic"]!=0 ) { $topic = array($_POST["topic"]); } else { $topic = get_terms( 'topic', array('fields' =&gt; 'ids') ); //$topic = array(implode(', ',$topic)); } </code></pre> <p>How do I post my dates so that when i click on a dates it takes the information from the topic selected and the corresponding date and gives me the results. This is my function that activates my ajax</p> <pre><code>jQuery('. .series-topic #cat').on('change',function() { var selectedTopic = jQuery('.series-topic #cat').val(); var selectedDate = jQuery('.series-date #date').val(); console.log(selectedTopic); console.log(selectedDate); jQuery.ajax({ type: 'post', url: '/ajax', data: { topic: selectedTopic, date: selectedDate }, success:function(data) { if(data) { jQuery('.-hold').html(data); } else {} } }); }); </code></pre> <p>How do i get my date to work with this</p>
 

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