Saving custom JSON as custom post type
Saving custom JSON as custom post type
Saving custom JSON as custom post type
@ricardio-de-penning I think you are going on wrong direction. You just want to get only those posts which is related to current category right? If yes then you need to filter post using tax_query like below. $args = array( ‘post_type’ => ‘post’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘category’, ‘field’ => ‘term_id’, ‘terms’ => array($cat_ids), … Read more
Add Meta key value: function my_pre_get_posts( $query ) { // do not modify queries in the admin if( is_admin() ) { return $query; } // only modify queries for ‘model’ post type if ( $query->is_tax( ‘model-year’ ) && $query->is_main_query() ) { $query->set(‘orderby’, ‘meta_value’); // Add Metakey ( “Custome field name” ); $query->set(‘meta_key’, ‘order_number’); $query->set(‘order’, ‘ASC’); … Read more
Query custom post type that has a serialized relational advanced custom field value
automatically select taxonomy based on post meta
WP Query: If field X is empty, show posts based on field Y
I have created a basic example on how you could achieve this result. // get all posts from our CPT no matter the status $posts = get_posts([ ‘post_type’ => ‘papers’, // based on the post type from your qeustion ‘post_status’ => ‘all’, ‘posts_per_page’ => -1 ]); // will contain all posts count by year // … Read more
How to filter custom post type by multiple Taxonomies
Have you declared this parameter ‘has_archive’ => true in your function where you created this custom post type if not then do this first and then check, hope it’s working for you,
Post type to appear on every page on site