This worked for me:
include ('wp-blog-header.php');
and before:
while (have_posts()) : the_post();
you have to create wp_query, so do this for example:
query_posts('cat=1'); // or any other query args you wish
Related Posts:
- Different amount of posts on homepage than paged pages
- Blog post per page setting conflicting with custom WP_Query?
- How to inject a post within a loop
- query_posts different amount of posts per page [duplicate]
- Change Posts per page count
- 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
- Setting pagination for images attached to a post
- Pagination not working on Custom Page Template
- Query only Posts from Both of Two Category?
- Insert custom div between posts
- How to Display Post View Count
- JetPack Infinite Scroll not working on custom theme
- Load posts into sidebar and paginate via ajax?
- A way to detect which page a post is on
- Converting multiple loops into one single loop with pagination
- How would I get 1 latest post from a query for 5 posts?
- Unwanted Duplicate Posts Showing in Pagination Pages
- Can I set and show “important” post in my blog?
- Exclude posts with empty post_content in wp_query
- Is it possible to change the admin posts per page view?
- Lazy Load using WP_Query pagination
- Pagination on single post page?
- How to display different number of posts
- Should $found_posts be returned as string in ‘found_posts’ filter hook?
- Getting content from a single *page* of a post
- previewing my posts on static page?
- How do I detect which page I’m on within a paginated post?
- Duplicating Table of Contents for Paginated Post
- is there a way to show the the post title after the image?
- Category Foreach keeps looping?
- How to exclude latest x posts from a paginated query?
- How to Restrict Previous & Next Post Link to Posts of Same Category?
- pagination for single post by category
- 301 (static page instead latest posts)
- How to : pagination in 3 different custom loops on the same page
- Display an author’s posts on his own author page
- Start WP Pagination From Number 1 in URL
- Customizing Comments on Posts
- How to make multiple sections in home pulling posts category wise?
- Use two different post_per_page limits with infinite scroll
- Start post pagination at 0 instead of 1
- 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
- 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?
- Only show featured image on first page of paginated posts
- Post Filtering by GET URL parameters
- 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
- Echo the number of posts being displayed
- Exclude a category of posts in author template
- WordPress displays post on subcategory only
- Trying to query all posts in category 4
- Get posts from current category?
- Change content off every sixth element
- Pagination not give another posts
- 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
- Go back to the exact post page number
- Problem paginating a subquery on a post
- Pagination Stops
- How to display particular categorie’s post which associated to specific user?
- How can I get the last post while on the first post for pagination? As if it were infinite
- Code to display random ordered posts in Categories across pages [duplicate]
- Count posts for pagination
- How to correctly escape data
- Blog posts not displaying on blog posts page
- Posts are not showing up on next page.
- Repeating post how to solve this
- Sort Events by Venue Title – Sort Post set by related post ids
- Admin is showing all posts on page 1
- Get posts by category or author
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- How to pass multiple checkbox values to wordpress query?
- Pagination for custom query won’t let me back on page 1
- How do I paginate posts page with $wpdb?
- Can’t get pagination to work
- How to get all post titles starting with numbers and symbols?
- Creating pages and getting their values from the database table
- WordPress posts loop pagination – first page return 125 posts instead of 10 and the rest return 10
- How to get pagination working with “Pending” Posts
- wp trim function not working
- Single post pagination
- WordPress Custom Theme: My site shows the same posts on Page 1 and Page 2 and so on [duplicate]
- Show a page counter for pagination
- Sort Posts Alphabetically Based on Specific Category (Divi)