Define a post’s title and slug from Custom Fields

Try replacing $emp_fname = get_post_meta($postarr[‘ID’], ’emp_first_name’, true); $emp_lname = get_post_meta($postarr[‘ID’], ’emp_last_name’, true); with $emp_fname = $_POST[’emp_first_name’]; $emp_lname = $_POST[’emp_last_name’]; Replace the $_POST array keys with whatever the field name is on your form

WP Group posts by year(desc) > month(desc) > date(asc)

$last_month = null; $args = array( ‘post_type’ => ‘post’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘DESC’, ‘post_status’ => ‘publish’ ); $the_query = new WP_Query($args); while ( $the_query->have_posts() ) : $the_query->the_post(); $the_month = get_the_time( ‘Ym’ ); // e.g. 201611 if ( $last_month !== $the_month ) { if ( $last_month !== null ) { // Close previously opened … Read more

Query all posts if multiple meta key don’t exist

global $wpdb; $excludeposts = “SELECT * FROM $wpdb->posts WHERE $wpdb->posts.post_status=”publish” AND meta_key NOT LIKE %aa_% ORDER BY post_date DESC “; $main_query = new WP_Query( array( ‘post__not_in’ => $excludeposts, ‘paged’ => $paged ) ); while ($main_query->have_posts()) : $main_query->the_post(); //Stuff… endwhile; //hope this helps

Restrict WordPress Search to Custom Field

On WordPress you can filter searches when accessing the URL with an additional parameter on the end for example; https://www.your-website.com/?s=search-query&post_type=custom_post_type_name If you are accessing this URL from a search box / form on your website, add in the following hidden field; <input type=”hidden” name=”post_type” value=”post type name” />

WebP Fallback for Inline Background Image in Style Attribute

Here’s couple of wild ideas which you could try, if you’re feeling adventurous. 1) Write some conditional logic with $_SERVER to detect if the user’s browser is the right type and high enough version, that would probably support the WebP format. Try using $_SERVER [‘HTTP_USER_AGENT’] and see also https://stackoverflow.com/questions/13252603/how-does-http-user-agent-work 2) Add the WebP and fallback … Read more