400 Bad Request and illegal invocation in wp_ajax based on processData set to false or true

You can upload file using ajax using below code: First : Add attributes name=”f-form” and id=”f-form” in your <form> tag. After that, In js script, get form data using new FormData() and send to ajax data, Note : change url: ajax_object.ajaxurl with your ajax url path jQuery(document).ready(function(e) { jQuery(‘#f-submit’).on(‘click’, function(e) { e.preventDefault(); var form = … Read more

Custom WordPress post query for displaying time-released content on website

Use a meta query. Since ACF stores dates as Ymd you can just treat the value as a number: $date_query = array( ‘key’ => ‘start_date’, // ACF date field name ‘type’ => ‘NUMERIC’, ‘value’ => ‘20200101’, ‘compare’ => ‘<=’, // All posts with start date before/on January 1st 2020 ); $args[‘meta_query’] = array( $date_query ); … Read more

alternate left – right content inside the loop

You should be able to get the current index in loop from the global $wp_query object. With the help of modulo you can then set an alternating css class for a post. global $wp_query; while ( have_posts() ) { the_post(); $alignment = ( ($wp_query->current_post + 1) % 2 === 0 ) ? ‘even align-right’: ‘odd … Read more