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)
- Getting Position of a post in a category
- Pagination not working on Custom Page Template
- How can I specify a category post on my home page
- How to search only by post title and category?
- $post object is null
- Is there any WordPress alternative to Book module of Drupal?
- How can i sort the categories by ID
- Display posts in three columns by category
- Add ajax load more function using WP API
- Pausing and Resuming WP_Query results
- Sharing post from archive page (loop) doesn’t work
- Disable sticky option for specific categories
- date issue with category post retrival
- Change default category when I publish a post
- WP_Query: Show 10 posts in date order, first three random
- How to check if there are posts with the same tag
- Unable to differentiate between two categories under custom post type on single.php
- How to show next/prev link, when it’s not active?
- Can I restore restore content from old Worpress site to a new Worpress site from an archive
- Display hierarchical categories/sub-categories for a single post only
- Want to change the post every three days with in specific category
- Why do I have categories with duplicate slugs?
- How can I get the last post while on the first post for pagination? As if it were infinite
- Call posts of particular category in a page
- Add wp-link-pages to post
- Display selected category on post page
- How to use in_category?
- ‘get_previous_post’ in same category returning (!empty) when no previous post in category exists
- How do I create a template page to show 3 blog posts?
- blog post displaying within older post – loop issue?