For your issue regarding only returning 20% of your posts, try the following
<?php query_posts('cat=4&posts_per_page=-1'); ?>
Note: By default, 10 posts are returned. -1
will return all posts in the resulting set.
http://codex.wordpress.org/Function_Reference/query_posts#All_Posts_in_a_Category
—
For your question about passing through the Category Name
, you can pass through the category_name
as parameter, which accepts the category SLUG.
http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters
—
As mentioned by @Bart Karp, you may want to reconsider your usage of query_posts.
See the following answer for more information on usage of WP_Query vs query_posts() vs get_posts() – When should you use WP_Query vs query_posts() vs get_posts()?
Related Posts:
- Use special template for the first post in the loop
- Get posts from current category?
- Output Buffer Issue with Single Post View
- add_rewrite_rule and template redirect not working
- Change content off every sixth element
- Prevent 404 of Author pages without posts
- How to assign a post to a post parrent?
- query for filtering published posts?
- Custom post type and taxonomy page templates
- get parent fields title, content excerpt etc
- AWS usage queries
- How to save template data into wp_post table (post_content column)
- Pull in posts using post meta for REST API
- Move position in post list for a custom checkbox column
- How to merge the content of posts that have the same title?
- How to allow WordPress to recognize a custom URL segment after a product URL and use a custom template?
- get posts, run a custom query, and join the results
- Show posts from two specific category in WP_Query
- How do I change the template specifically for single posts?
- How to create loop of posts except post ID defined via ACF field
- Related post not showing table of content
- Displaying all posts from other sites on the network on one site
- How to fetch courses in all languages in WordPress?
- Multisite how to display merged posts from two sites and sort by latest date?
- Post not using taxonomy template
- Why does my “Add New Post” page have an old post in it?
- Customizing a new page used for blog posts with Avada theme
- How to show post views shortcode data for each post on Posts List Page?
- How can I use query_posts to loop through posts and construct my own content?
- How to display particular categorie’s post which associated to specific user?
- Assign a day of the week to post, e.g: Assign Monday to post and have it only appear when the day is Monday
- Single Sidebar; multiple templates! How?
- Show 5 posts and than 3 posts offset with pagination
- How to Display Most View Post in the template file?
- wp_query args with relation
- WP_Query to get posts in a specific tag or has post_format
- Make recent post display recent updated, instead of recent published
- Manipulate query to show specific post
- Querying posts from current category, using a variable as array argument
- How to correctly escape data
- Is it possible to query a category with specified posts?
- Blog posts not displaying on blog posts page
- Custom post type template not called
- Page 2 has no posts?
- Repeating post how to solve this
- single- and archive- templates not being applied to custom post types, not even after flushing permalinks
- Sort Events by Venue Title – Sort Post set by related post ids
- Need help writing loop to display posts by categories in separate divs
- How to change post template via url?
- Get posts by category or author
- Sort / Filter Queries
- get_page_by_title() not working if special characters are present
- Modify WordPress loop after it has been run
- how to remove entry meta from wordpress archive category and change its display
- Query post category & remove any post id
- My blog “page” used to show a list of posts, but now it’s just showing the page content?
- show latest authors blog post
- Custom template for different post types
- get “read more” with custom DB query like you would with WP Query
- How to get only current images of a post
- Ordering posts alphabetically by meta keys and title
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- How do I control the fallback query after the original query returned cero posts?
- Adding The Post Template Dropdown to WP-Admin
- Posts page template: How can I edit the markup for this?
- Remove duplicated posts in the loop if post has more than one category
- How to pass multiple checkbox values to wordpress query?
- Adding a category at even positions on main loop with modified pagination
- How to arrange different post categories in template
- How to limit the number of results for all query_posts on mysite
- How can I change the look of a post as is displayed
- How to get all post titles starting with numbers and symbols?
- How to inject a post within a loop
- How to get alphabetic listing x other posts, based on first letter post?
- wp_query select if have comments
- Which hooks are essential for post templates?
- Creating pages and getting their values from the database table
- Display the first post’s comments of category in comments.php template
- 1 post, 2 templates
- How to limit post query to only return a total count of items with certain post statuses?
- how to style an individual page in a category [duplicate]
- How to display a certain template element only for posts published within certain time range?
- Not displaying any articles on a custom made file
- Redirecting posts in WordPress to a specific page
- Creating / Editing a post from within site template
- wp trim function not working
- custom post type single page template not working
- WordPress “Posts Page” isn’t showing template dropdown
- How do I create a template page to show 3 blog posts?
- Change from all posts to specific categories post on main page?
- How to add a new page that will function as a separate blog/news article page
- excerpt in template for specific page
- Tag page that displays specific posts
- query_posts different amount of posts per page [duplicate]
- Count words for all posts by all authors
- Is there a block to print post link standalone in a block theme?
- Word count for all posts of all authors
- Do I need to create a multisite for querying posts from multiple WordPress sites?
- Dynamic archive of posts by date