Display custom post type

I prefer using using the array form… $gabquery = new WP_Query(array( ‘post_type’=>’courses’,//The name of the post type ‘posts_per_page’=>5, //Use this rather than showposts ‘tax_query’=>array( array( ‘taxonomy’=>’my-custom-tax’, //Your custom taxonomy name ‘operator’ => ‘IN’,//NOT IN & AND also available ‘field’=>’slug’,//or you could select by ID ‘terms’=>array(‘my-term-slug’)//Get posts with this term (or ID if above is ID) … Read more

Front End submission with meta key

Since the meta data field is already there you should update it. also you should time the wp_insert_post… here is the revied code try it and let me know it you encounter problems: else { $title = $_POST[‘post_title’]; $meta_box1 = $_POST[‘wpcf-mob_no’]; $meta_box2 = $_POST[‘wpcf-mob_amount’]; $meta_box3 = $_POST[‘wpcf-mob_type’]; $meta_box4 = $_POST[‘wpcf-mob_status’]; $new_post = array( ‘post_title’ => … Read more

Use get_post_types to query only custom posts types

Instead of creating a string try creating an array and check. $posttypes_array = array(); foreach ($post_types as $post_type ) { $posttypes_array[] = $post_type; } And then form the query as follows $buildArgsAllQuestions = array( // Add out new query parameters ‘post_type’ => $posttypes_array, //’post_type’ => $posttypes_array, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, );

custom taxonomy relationship

Taxonomies can be shared among multiple post types, but if you’re looking for post types relationships, you can try using the Types plugin (free) with the Views plugin (premium) or code the functionality from Types. I’ve just started playing around with this and it enables easy creation of relationships between post types. Their example: you … Read more