Metabox saving values

First, you don’t need the <form> tags; meta boxes are already rendered inside the post edit form. Second, if a checkbox is not checked it is not sent, so isset( $_POST[‘checkbox_name’] ) return false and the custom field that stores the value of the checkbox is not update correctly. I’ve tested this code with standard … Read more

How to use custom field to search for wordpress post type?

Using pre_get_posts may work. Can you try something similar to the following and let me know if it meets your needs: function search_filter($query) { if ( !is_admin() && $query->is_main_query() ) { if ($query->is_search) { $query->set(‘post_type’, array( ‘post’, ‘movie’ ) ); //Should do some sanitation on $GET too if(isset($_GET[‘author’])){ //Change to your field dropdown name $query->set(‘meta_key’, … Read more

WP_Query post at custom position

Pagination should be easy. You really just need to add pagination parameters to your query, and next/previous posts links, more or less like in another thread I posted in recently. $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $my_query = new WP_Query( array( ‘showposts’=>10, ‘paged’ => $paged ) ); // run the loop then, // pagination … Read more

get terms that have post with custom post type between 2 values

This is the finish code for this: <?php $dates_array = array(); $countries_array = array(); $term_list = array(); $current_term_list = array(); $args = array( ‘post_type’ => ‘tours’, ‘posts_per_page’ => -1 ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); global $post; $tour_terms = wp_get_post_terms( $post->ID, ‘tours_cats’ ); $current_term_list = array(); foreach ($tour_terms … Read more