First thing : you should not use category ids directly. Use slugs instead : it’s easier to maintain.
<?php query_posts('category_name=portfolio'); ?>
Second thing : why did you put a query parameter in the_post
? This function does not accept any parameter (see the Codex).
Third thing : the call to query_posts('cat=-4');
will show all posts EXCEPT the one that have the category N°4 (portfolio, if I guess well). This is not want you want, right ?
Want you want is query_posts('category_name=portfolio');
in your portfolio page and query_posts('category_name=blog');
in your blog page.
Related Posts:
- How to distinguish pages created by woocommerce?
- Display all posts from specific categories on a page
- How to show list of posts by author and category?
- Why do I need to use The Loop on pages (inside page.php etc)?
- posts page – different lengths of excerpt
- Multiple loops in same page, without duplicate content
- Can I hide a specific post from latest posts page?
- How to show post(excerpt) from specific category on wp page?
- Divide Loop Into Days & Categories
- Differentiate between posts and pages in search results
- How to filter posts that belong to a specific category only if that is the only category
- page.php showing loop of posts and not page content
- Can I divide the pages into categories?
- Display post category in foreach loop with category link
- Child_of not displaying all children posts.. via get_posts
- Multiple loops are not reset
- Should I use posts or pages in this scenario?
- post categories
- Exclude category from
- Pulling in post category and children within category
- Post categories to pages
- Listing Specific Categories from Current Post with Depth
- How to make the first post in the loop be styled like a “new / featured” post?
- How do I stop the loop from repeating in my category template?
- get_the_category listing in hierarchial order
- Display Posts on Custom Page
- why does wordpress ignore the post args?
- Multiple Loops Breaking Pages
- Showing categories and subcategories with posts
- WordPress Query Posts From Category Post on Static Page
- How to create a “latest news” page showing a list of posts from blog category
- Having pages after specifying post_type post
- Are post, page and category IDs unique to each other?
- WP_Query of Category Not Showing First Post
- Get post category as a separate string and url
- Pagination for normal (standard) posts on a page with a custom loop?
- Changing wp_link_pages() to “Next Page” and “Previous Page” buttons?
- How can I add a page that shows posts from a single category?
- Get current taxonomy and display query accordingly
- Different post views for different category views
- Only the most recent post is showing on my category page (working on localhost, not live site)
- Automatic duplicate/copy of post to a related page in WordPress
- Yoast breadcrumb URL shows category instead of the page
- Current post categories and subcatecories outside of the loop
- How to add a block to a category page?
- Page with Category Returning 1
- How to show category image if no featured image is set?
- Post Category link is same with Page link
- Display new posts categories in separated divs
- How do I make it so that new posts within a certain category go into a certain page?
- Posts are not showing up on next page.
- Precedence of page permalinks over woocommerce product category links?
- List Authors For Current Category
- Show only top 3 posts from 3 categories in order on home page
- Multiple Post Repeat for Related Post Loop by Category
- Show post if in category
- Displaying categories items among posts
- Make assigning post to a specific category equivalent to assigning it to all categories
- Displaying only posts from a certain category on my custom page template
- I need to create a page or post hierarchy
- Where are my posts linked to? I keep getting a Not Found Error, and I have no single.php page
- how to style an individual page in a category [duplicate]
- The loop: more posts than I want to fit on one page
- Redirecting posts in WordPress to a specific page
- Show all posts in category
- When and how will php code in a user made WordPress page be executed?
- CSS – Change height of Storefront / WooCommerce product categories, but not products
- What function does the loop of displaying posts?
- wordpress category Description not allowed tag
- View post with specific category id and name which I selected in the backend (drop-down option)
- Is there a way to save different data when USER interacts with the same POST?
- how to put post customized in page
- post and page and custom post type
- How to display particular categorie’s post which associated to specific user?
- Display Specific Categories posts on the home page
- How do I customize the post page
- Clicking on a Post takes 10+ seconds for the server to respond, Pages will respond immediately
- show loop id post , only first id can read
- Excluding category from post navigation in WordPress?
- Save All Post Permalink From A Specific Category into a .txt file
- How can I get the last post while on the first post for pagination? As if it were infinite
- Show code only on WooCommerce Pages
- Disable pagination in posts and pages
- I want to show recent post according to category of the post in single.php?
- Limit amount of categories displayed in a post
- How to make a page show posts only from specific categories without editing php files
- show image gallery in archives or category page
- show only one category and filter by tag
- Single Sidebar; multiple templates! How?
- Automatic Table of contents with categories and posts
- Loop and output 4 rows of posts on home page
- Code to display random ordered posts in Categories across pages [duplicate]
- More Than 50K Categories and WordPress Admin Panel Stop Showing Categories and Posts
- Get posts from category from custom query
- Count posts for pagination
- Re-order Category Meta-data
- Very weird behaviour after removing WP pages
- Double loop output
- AJAX load more posts not using correct category and repeating the same few posts
- Custom permalink for wordpress page / post