Assuming your CPT is ‘videos’ you’d use:
// Build the query
$args = array(
'post_type' => 'videos',
'posts_per_page' => '4',
'cat' => $cat_id
);
Related Posts:
- How to get post content by calling ajax?
- Get the ID of the latest post
- Retrieving 3 latest post from each of 5 different custom post types
- How to get only one category of custom post type?
- Quickest way to get last or oldest post date – WP Query
- Combine query_posts() and get_posts() into single query
- 4 posts per page from single category
- How do I correctly query posts from a post ID?
- show custom post’s post in two different divs [duplicate]
- Using meta_query, how can i filter by a custom field and order by another one?
- List most recent image uploads, but only for specific custom post type
- Show the First Post from Each of 3 Different Post Types on a Web Page?
- Display Custom Post Type Fields
- Querying custom posts and regular posts
- functions.php conditional tag only for custom post type
- Using Offset in Custom Post Type Query
- Posts per Page on custom Taxonomy Template
- Using Query Posts With Multiple Post Types And A Taxonomy
- Query posts by custom post type and custom taxonomy
- custom post type upcoming post and past post
- Query not returning CPT posts
- Post Rank on Single Post page based on custom field
- How to query custom post type by term?
- Unable to display multiple post types in same query (WPML WP_Query)
- Get random custom posts from a custom post type
- How to get current post id of a custom post type in a loop using template singel-{custom type}.php?
- How to display recent posts added in several custom post types
- ‘category__and’ for custom taxonomy?
- Post the content of a specific “Custom Post Type” post within a post using a shortcode
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- query_posts with a custom post type, a meta_query and sorting by post date?
- Custom query shows custom post types in trash
- Filter the content from a post globally immediately after is fetched from the database
- how can i get posts from custom post type particular taxonomy category
- Setting posts per page in query_posts
- How to insert content from another Custom Post type into Post?
- Are there sub-systems in WordPress that would employ data structures beyond CPT that a `get_posts` won’t be able to catch?
- Shortcode for display posts on home page show only one post
- WordPress count child posts of each parent custom post type and use in json array for google maps jquery plugin
- How to query custom post types posts filtered by multiple custom taxonomies through a form selection
- Query/list all terms and their custom post count
- Display only one post each WEEK
- Display all post titles of current post type
- Get posts between custom dates
- Polylang non-default language ignores tags in WP_Query
- Multiple (two) category postings on the same page.
- Display latest x posts from all categories in Custom Post Type/Taxonomy
- Limit the post for differents custom post type in the same wp_query
- Custom post type archive page for multiple post types
- How to display Related Posts based on number of taxonomy terms matched
- Filter date from post meta when date is in string format
- Get only used meta_values
- Custom query for custom post_type
- Custom query – get_the_terms not work
- 3 random images from custom post type, each in a div with a diffrent class
- populate array with posts
- Display custom posts randomly in custom taxonomy archive
- why is the current page title being output?
- Not able to export large no. of posts in csv
- Displaying multiple post types on home page
- Conflict between wp_list_pages and get_posts – list pages not displaying
- Pagination not working on custom query on a page
- Loop through posts of only 2 statuses
- Targeting custom post type via functions.php doesn’t work
- Is it possible to use array_walk() to append terms to an array of posts?
- custom hierarchical taxonomy and custom post type list contains surplus posts
- Dynamic category name in query post
- Can’t pull posts of a Custom Post Type based on the custom taxonomy of the CPT
- HM CMB: Post Select Field for CPT ID
- Query custom posts of logged in user only
- Display a random customposttype2 excerpt in single-custompostype1.php that shares same taxonomy
- Getting custom post type info using get_adjacent_post
- How to query custom post types with multiple keys?
- Query for bbPress replies to current topic?
- Why can’t I query more than 1 post type at a time?
- Sorting the Loop by Taxonomy Value
- Custom Query: Multiple CPTs and a taxonomy filter
- WP query_posts group by meta field related
- Orderby meta_key/meta_value not displaying anything, am I overlooking anything?
- Custom wp-query display post only today
- Get_post_custom not fetching value from array wordpress
- Filling custom post type posts from a rest api
- custom post type and a “sticky” position taxonomy
- Order Posts in Custom Order
- Query posts based on user preferences
- Query the title of the page to show posts with matching category in the loop
- How can you use a page for a custom post type?
- How to Create movie schedule by custom post type query
- Main site single-property.php design, as homepage of a multisite
- WordPress get all post with like in terms [duplicate]
- Decrement term in for each
- Popup panel is only displaying 1 entry ignoring all others
- WordPress custom post type
- How to get main div html to print a list of posts inside?
- one get_posts to return a number of custom posts for each meta value
- Using $seed on a custom post type for randomly displayed posts
- How can I give WordPress child custom post type the same title and slug as its parent?
- What’s the best way to show custom post types? With page template it’s not perfect!
- How to grab data (titles, thumbnails and custom fields) from multiple posts to populate a new array efficiently?
- Inserting two categories