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
- the_author() returns empty string
- How to display posts by current user/author in a custom page template?
- post_name empty after wp_insert_post
- Query only Posts from Both of Two Category?
- Insert custom div between posts
- Accessing $post variable from template part
- Only display posts with comments
- how to show all post in my page-grid.php template page
- Use template of parent category for single post sub-categories
- loop not displaying posts on custom template page
- How to Display Post View Count
- Including text at the end of every post
- Different amount of posts on homepage than paged pages
- Adding variable for post title so post template can include auto-generated link to view on external website.com/{post title}
- How to display different single post template based on author?
- How would I get 1 latest post from a query for 5 posts?
- Display page content AFTER a loop of posts
- Different template for posts of all subcategories of category
- Can I set and show “important” post in my blog?
- Exclude posts with empty post_content in wp_query
- Single post as homepage?
- Change post_date to post_modified date on post template?
- previewing my posts on static page?
- What part of template to edit to remove category name from the top of posts?
- How can I pass the ID of a post to a page template by clicking a url?
- is there a way to show the the post title after the image?
- Category Foreach keeps looping?
- Setting posts_per_page for taxonomy term template
- Blog post per page setting conflicting with custom WP_Query?
- How to exclude latest x posts from a paginated query?
- Send post id through ajax and get the post content back
- Display an author’s posts on his own author page
- How to make multiple sections in home pulling posts category wise?
- How to create new post content templates for my users?
- wp_posts table: safely remove unused columns to save database storage
- Query Posts by Custom Field
- How to get posts from a current post’s month?
- Wrong post title displayed from loop
- While loop articles – if statement order
- Conditionals if tags exist?
- Get the amount of posts on a current page
- Hide a specific post from a page template
- Posts – display all posts except a post by an ID
- why the same code got different results when using query_posts in functions.php and index.php
- Archive template combined with post slider and regular posts
- How to get posts published on the latest date?
- How to only publish posts with image in it
- Why won’t pagination work?
- Create a custom posts page
- how to set social icons to product / post template (Auros theme)? [closed]
- Post Filtering by GET URL parameters
- showing posts of an specific category in admin custom menu with style of admin posts section
- WP_Query: Show 10 posts in date order, first three random
- Get post by tag
- Random posts that always include a particular post?
- Bootsrap carousel for post
- Display a post via template
- Single post full screen template not inheriting WordPress role permission
- Echo the number of posts being displayed
- Exclude a category of posts in author template
- WordPress displays post on subcategory only
- Output Buffer Issue with Single Post View
- Change content off every sixth element
- Prevent 404 of Author pages without posts
- Custom post type and taxonomy page templates
- How to save template data into wp_post table (post_content column)
- get posts, run a custom query, and join the results
- Show posts from two specific category in WP_Query
- How to create loop of posts except post ID defined via ACF field
- Displaying all posts from other sites on the network on one site
- Multisite how to display merged posts from two sites and sort by latest date?
- Why does my “Add New Post” page have an old post in it?
- How to display particular categorie’s post which associated to specific user?
- Manipulate query to show specific post
- How to correctly escape data
- Blog posts not displaying on blog posts page
- 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
- Get posts by category or author
- Sort / Filter Queries
- how to remove entry meta from wordpress archive category and change its display
- get “read more” with custom DB query like you would with WP Query
- How to pass multiple checkbox values to wordpress query?
- How to arrange different post categories in template
- 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?
- Display the first post’s comments of category in comments.php template
- How to display a certain template element only for posts published within certain time range?
- Creating / Editing a post from within site template
- wp trim function not working
- WordPress “Posts Page” isn’t showing template dropdown
- How do I create a template page to show 3 blog posts?
- How to add a new page that will function as a separate blog/news article page
- excerpt in template for specific page
- query_posts different amount of posts per page [duplicate]
- Do I need to create a multisite for querying posts from multiple WordPress sites?
- Dynamic archive of posts by date