Query post types with multiple keys

meta_query has a relation parameter just like tax_query so: $documents = array( ‘post_type’ => ‘documents’, ‘meta_query’ => array( ‘relation’ => ‘AND’, array( ‘key’ => ‘document-type’, ‘value’ => ‘manual’, ), array( ‘key’ => ‘document-status’, ‘value’ => ‘current’, ) ) ); query_posts( $documents ); get_template_part( ‘loop’, ‘documents’ ); wp_reset_query();

Search Post Title Only [duplicate]

I didn’t test the code below, but I guess it works. /** * Search SQL filter for matching against post title only. */ function __search_by_title_only( $search, &$wp_query ) { /*my solution */ if($_GET[‘post_type’] != ‘attorney’ ) return $search; /*my solution*/ //please copy the rest of the code from the link below } add_filter( ‘posts_search’, ‘__search_by_title_only’, … Read more

front end radio custom taxonomy with custom post type

Your code doesn’t show if and how you set $terms other then that its seems ok, just try to wrap it in an array and you should check if its set first, so try this: $new_post = array( ‘post_author’ => $user_id, ‘post_title’ => $post_title, ‘post_content’ => $post_content, ‘post_category’ => array($_POST[‘cat’]), ‘tags_input’ => array($tags), ‘post_type’ => … Read more

How to create posts (not post template) to be displayed on projects page?

The best way is to register a custom post type then loop through that type within your projects page template. CPT from GenerateWP. if ( ! function_exists(‘projects’) ) { // Register Custom Post Type function projects() { $labels = array( ‘name’ => _x( ‘Projects’, ‘Post Type General Name’, ‘text_domain’ ), ‘singular_name’ => _x( ‘Project’, ‘Post … Read more