using ACF datepicker to filter posts on a page
using ACF datepicker to filter posts on a page
using ACF datepicker to filter posts on a page
It’s probably best to loop through your posts two times. Once to group them by year and once to print the posts. Something like this: (not tested) $formatted_posts = array(); while ( $subsQuery->have_posts() ) : $subsQuery->the_post(); $year = get_field(‘year’); // add them to formatted_posts array and group by year $formatted_posts[$year][] = $post; endwhile; foreach($formatted_posts as … Read more
———— EDIT -> PROBLEM SOLVED ——— MY CODE WordPress submenu/HTML code <?php add_action( ‘admin_menu’, ‘reserveringsformulier_add_submenu_gesloten’ ); function reserveringsformulier_add_submenu_gesloten() { add_submenu_page( ‘edit.php?post_type=reserveringen’, __( ‘Gesloten dagen Restaurant’, ‘Gesloten dagen’ ), __( ‘Gesloten dagen’, ‘Gesloten dagen’ ), ‘manage_options’, ‘gesloten_restaurant’, ‘gesloten_restaurant_inger_display’ ); } function gesloten_restaurant_inger_display() { function gesloten_restaurant_inger_display() { if (isset($_POST[‘submit_datum_gesloten’])) { if (isset($_POST[‘maandag’])) { update_option(‘maandag’, $_POST[‘maandag’]); $maandag = … Read more
Save datapicker date into wordpress admin
Please check if echoing $fxdate is working. $fxdate = get_field(‘fl_date’); In ACF simply below code works, if($fxdate){ echo “set”; } else { echo “not set”; }
I did it! In the end, I used the standard $_REQUEST and $_GET to store and fetch the value in the date-picker instead of all the fancy hooks and filters. The only thing I am not able to fathom out is the deal with input type-button. It was not storing the value in $_REQUEST. But … Read more
After debugging, I noticed that the formId in the hooked function for filter was actually fieldId for the date field and hence the fieldId undefined. Here no actual formId is received in hooked JS filter function and the actual fieldId is passed as formId. So, quick workaround I applied using formId only, is: // Allow … Read more
for less time you can use ACF plugin for this https://www.advancedcustomfields.com/resources/date-time-picker/
In meta_query, you missed the type of the field: $args = array( ‘post_type’ => ‘events’, ‘posts_per_page’ => ‘-1’, ‘meta_query’ => array( array( ‘key’ => ‘event_date_start’ , ‘compare’ => ‘>=’, ‘value’ => current_time(‘Ymd’), ‘type’ => ‘DATE’, ) ), ‘meta_key’ => ‘event_date_start’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’ );
This must have been a conflict in my site. TBH, I wasn’t able to spot the conflict, but I was able to circumvent it by setting the necessary lang strings just before datepicker’s initiation like so: $(function() { $.datepicker.regional[‘el’] = { closeText: ‘Κλείσιμο’, prevText: ‘Προηγούμενος’, nextText: ‘Επόμενος’, currentText: ‘Σήμερα’, monthNames: [‘Ιανουάριος’, ‘Φεβρουάριος’, ‘Μάρτιος’, ‘Απρίλιος’, ‘Μάιος’, … Read more