Finally, I figure it out.
It seems that the get_posts
and query_posts
accept different arguments, when I use the get_posts
I can setup the arguments like this:
get_posts(array(
"category" => $cate->term_id,
"numberposts" => 12
));
While when I use query_posts
I have change that to:
query_posts(array(
"cat" => $cate->term_id,
"numberposts" => 12
));
Notice the category
to cat
. This is a sad story.:(
Related Posts:
- How to fix pagination for custom loops?
- Remove the Homepage Query
- Is `query_posts` really slower than secondary query?
- Are there any scenarios where the query_posts may be used?
- Transient not working for custom loops
- post loop causes wp_users and wp_usermeta DB queries for each users
- get_the_foo() in the loop – does it perform another query?
- If No Search Results, Show Posts from Alternate Search Query
- How to Loop within a Loop (Display Children and then Grandchildren)
- Loop posts only excluding first post
- Loop after page content
- A loop with all articles with certain text strings in tags
- Display most viewed post from last 30 days is not working correctly
- Query posts if meta key starts with
- 3 Posts in Loop, Show Stickies First
- How to go about combining dropdowns / filter queries?
- Query reset problem or flawed code to enable custom post type query
- Query last updated posts (posts updated in the last 24 hours)
- Conditional query that displays on Woo product attribute pages
- How do I use AJAX Query in my posts loop?
- woocommerce get_price_html not pulling in correct price
- How to fix pagination for custom loops?
- How can I paginate this?
- How to display posts by vote count and if no value continue with latest posts with no votes?
- How to fix pagination for custom loops?
- Split wordpress loop to multiple layouts
- Making a query to the DB using same parameters of loop
- Loop inside query
- get_delete_post_link() inside Loop stubbornly returns nothing
- Query posts only with actual text content (not including shortcode or images)
- Exclude posts based on an array
- Query post & loop problem.
- Loops for cat links not looping for wordpress site
- How do I set the Stewart Search Template to return only published posts in the result
- Trying to get all links in my posts
- Custom Query with Sticky Posts
- Build a Page which shows the Oldest Post with specific Custom Field Value
- Query posts and display all dates in repeater field in chronological order
- How to fix pagination for custom loops?
- Get featured image outside the loop using foreach
- Alternative layout the loop
- Show posts by tags excluding current post
- Strange problem with wp_get_attachment_image_src database (db) query count
- Next 10 posts data of currently viewing post in blog page
- How to fix pagination for custom loops?
- How to fix pagination for custom loops?
- How to fix pagination for custom loops?
- Get query result before posts are displayed?
- Combine Query and Select Database to create directory loop
- WordPress loop: Display if posts exist
- wordpress showing all posts instead of date range
- Multiple loop with pagination in same page
- Query Loop Block: possible to restrict just child pages?
- Use Base-URL with Query-Loop
- How to display Yoast SEO meta description in archive template for each post instead of the_excerpt()? [closed]
- How to place comments_template(); outside the loop?
- Endless loop with wp_insert_post and wp_update_post
- Hook into the loop via a plugin, and output something after every X post?
- Two custom loops, pagination, offset
- Access to Media Library
- Getting two wp_link_pages output
- meta_query on a date range using an array of values
- Run The Loop over array of post objects
- Enable infinite scroll on single.php [closed]
- Does get_template_part pull data once in a loop?
- How to retrieve “sticky” post outside the “loop”?
- Using get_the_excerpt() Before The Loop
- code suddenly appearing from my tempate second loop
- Sort results by groups of numbers and letters
- Modify the main loop to display current month / year
- Display post list with different styles
- Loop for sticky posts
- Get author_id in wordpress
- Is_single() conditional tag returns null in query
- Array ids post to function have_post
- Give each posts in a loop a number in sequence
- get_comments with post_status ‘public’ retrieves NULL result
- I have broke my pagination, same posts on all pages (index.php)
- Category ID returns as ‘0’?
- Conditional category query breaking?
- How to get the term description in a taxonomy term archive query?
- Skip 5 latest post while paging?
- WordPress: query pages except remove one page
- get the value for ALT is we check to see if an actual ALT value is set, if not we use the caption and if no caption is set we use the title
- how to add 4 post in one carousel slide
- How can I group by Taxonomy on Custom Post Type while filtering out based on custom Meta
- Exclude Posts Using Meta Query and User Meta
- Is “the loop” a template tag?
- Shortcode for pulling specific Post Title outside loop when ID is passed in
- Show a list of user posts in the user admin page
- Active class for my flexslider in WordPress
- get_template_part() to render single page Theme
- Can’t see custom field after the Loop [closed]
- Pagination not working with custom loop
- Showing related posts (custom post type) outside of the loop
- Same Loop on Multiple Pages
- The Loop for my theme with static front page is not working
- Showing ads after posts in home page
- Prevent duplicating specific column from database table
- I make sticky post for my archive page for custom post type with ACF field and loop is not working