To get only 4 posts, change your get_posts()
function to this:
get_posts(array('post_type' => 'cars', 'numberposts' => 4, 'cat' => 'vazno'));
get_posts()
uses numberposts
instead of posts_per_page
like WP_Query does.
Related Posts:
- Group search results by post type, but hide post types with no results
- Integrating Orbit slider into wordpress through custom post type
- What is the recommended / best way to do this: Event calendar post/type in a block-based theme?
- Return the latest post from a custom Taxonomy and Post Type
- Custom WP_Query doesn’t display all posts
- Two column layout with alphabetical ordering
- WP_Query with custom post type ID
- Assign a template to a custom post type when displayed by the main loop on the home page
- Custom Post type content within a slider
- How to Enable Ascending or Descending In WordPress Default Built-in Loop
- Loop all post on single.php
- Add extra elements to the_post in a custom post_type
- Custom Post Type has wrong label and is not found when called by a loop
- 2 custom posts types, in their own columns, one pagination for both
- Custom post type with custom taxonomy permalinks
- Custom taxonomy page template
- Cant insert wrapper div into index.php
- Create custom post order (with custom post type meta)
- How to create custom page templates with default page layout framework?
- WordPress search results grouped by post type
- Mini-Site Strategy
- Posts in Multiple Columns and Rows with one single loop
- Alphabetical sorting of custom post type – one letter per page
- List all posts in Custom Post Type but group dynamically by Custom Taxonomies
- How to display the rest of categories on Portfolio filterable
- Custom post type archive sorted and grouped by date in post meta field
- Get_post_meta() won’t return value
- Query Custom Post by Category
- How to get current post id of a custom post type in a loop using template singel-{custom type}.php?
- How to retrieve custom field types for all posts in WordPress/PHP?
- ‘category__and’ for custom taxonomy?
- WP_Query and using a variable for ‘cat’=> in the args array = WP Bug?
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- get_template_part for custom post type content not working
- Creating Accordians in WordPress Theme
- How to insert content from another Custom Post type into Post?
- Display different content on homepage depending on post type
- How i can add ‘N’ page of ‘N’ pages under posts loop?
- What’s the difference between same wp functions get_posts(); functions in different form?
- WP_Query orderby modified to include custom meta changes
- get_attached_media() on author page not working
- Checking if Post Title is Unique as Loop Criteria
- Custom post type multiple loop by taxonomy term
- List custom taxonomy specific to one custom post type
- Custom post type, organized by categories
- What’s the WP way to load remaining custom posts?
- Get unique superset of taxonomy terms from a list of custom posts in another hierarchical taxonomy
- What to and how to proceed with CPT to make DB small and efficient?
- A custom post within a custom post
- get_the_title() is returning results from previous loop
- Warning: Invalid argument supplied for foreach() in post.php [closed]
- How can I group posts by months and years?
- 3 random images from custom post type, each in a div with a diffrent class
- Displaying multiple post types on home page
- Shortcode leaves no space for other elements?
- Query to get child pages of current page and display it in action hook
- Display post from custom post type
- WordPress giving a 404 page when passing a year argument different than the current year
- Compare Two Custom Post Types Using The Same Custom Taxonomy
- Permalinks for single-[custom-post-types] not working
- Custom Post Type – Main page for certain posts
- Drop down list with posts within the “add new” page
- How to show custom post type on homepage and in categories
- using the loop in custom meta is messing up ‘add new’ post type
- How can I loop at a Specific Taxonomy from a custom post type?
- Custom archive page for custom taxonomy and pagination issue
- Custom post type paging return home page
- when looping through custom post data not appearing
- Order posts alphabetically with numbers but some of the posts has numbers in the title
- Multiple Loops In Tabs Only Displaying First Loop
- How to only get the content of post page while looping?
- Custom post type single page uses the right template in preview mode but shows a different template after being posted
- ACF meta_key and meta_value break loop
- Staggering featured post using ‘sticky’
- Multiple Custom Post Type in Taxonomy Archive Causing White Screen
- Adding a Section for Visitors
- Why is my loop not populating the page with my custom taxonomy terms from my custom post type?
- Show parent category and subcategory once in while loop
- How to build Custom Post Nav Menu inside of the Loop
- Loop to display parent categories in custom taxonomy
- Sort loop by custom field from different post type
- next_posts_link() always generates second page link on custom post type
- Values show up in custom home page but not in custom post pages
- Permanent Custom Post Type
- Display related post content and custom field content
- Show posts for current taxonomy
- wordpress query_posts with foundation 6 Accordion not working correctly
- WordPress loop, show only one post per custom field
- Multiple loops for custom post type to spread data across rows
- Loop multiple taxonomy in custom post
- $post breaking container loop
- Posts without featured image using other post’s featured image
- How to Create Custom Post Type with Multiple Color Options?
- Nested loop called with shortcode duplicating the content above the main loop
- why get_post_meta is returning 0?
- Show search for data extracted from metabox
- Get all active posts that are tied to a custom taxonomy for a custom post type
- Retrieve a post with its ACF repeater fields in wordpress
- WPNavi pagination links not working on custom pages
- Group search results by post type, but having a unique heading for each section?