Is there any particular reason not to use the front-page.php
template file, and just not bother with trying to pull WordPress headers into external files?
Using the front-page.php
template file is easy:
- Create a new static Page, with any arbitrary name (let’s call it “Front Page”)
- Go to
Dashboard -> Settings -> Reading
and set “Front Page Displays” to “Static Page” - Set the “Front Page” dropdown to the “Front Page” static Page you created in step 1.
- Create a new template file for your theme, called
front-page.php
, and include in it your custom Loop code, above.
Also, you should properly filter the main Loop query as output on front-page.php
, rather than using the && $count <= 6
conditional in your call to the Loop.
I would recommend using a simple call to get_posts()
, and set the numberposts
argument to 6
.
Related Posts:
- When to use WordPress loop or Foreach loop?
- How do I query based on the modified date?
- WordPress loop problem: Multiple loops, index.php and is_paged causing duplicate posts on next page
- How do I query by post format in WordPress 3.1
- How to return results of a get_posts() in explicitly defined order
- Modify main WordPress loop with a parse_query filter
- How should I intercept the main query and inject custom join / order by / group by criteria
- query_posts sort in multiple directions
- Dynamically excluding current page id
- How to order results by date and meta key?
- Adding Variables to post query
- Is it possible to query_posts using post__in and then Loop through them in the ordered they were queried?
- How to insert content from another Custom Post type into Post?
- Placing post data (title, date, and excerpt) nested in static content
- query_posts() ALWAYS displays something?
- Displaying recent post excerpts on static front page
- Page-loop is looping content from custom loops on the same site. How to avoid that?
- How to remove a plugin filter’s priority on specific loops (custom queries)?
- Custom loops, sticky posts, and pagination nightmare
- Filter Loop by Custom Field Value
- Modify loop but keep the original query, what am I doing wrong?
- Post per page not working if no category specified
- Calling Posts from Specified Cat
- Magazine style frontpage with multiple categories/loops and no duplicate posts
- Most Effective Method? Exclude Category and Number of Posts Per Page
- Script that gets the first tag of post and query all other posts with the same tag
- How to add an “or” instead of and “and” (&) in a WordPress query?
- Query add html after set amount of posts?
- Modify main loop query for paged and meta key
- Create a Loop with Posts Ordered by Most Recent Comments
- query_posts and sub pages?
- The_content display a different content from a previous loop
- Including post data in a sidebar occurring outside of and before the Loop
- Multiple loops with / without sticky posts and different post limits
- Limitless amount of posts in custom archive page
- WP-API: get posts in multiple categories
- How exclude 3 latest posts of a category in query_posts
- Make tag archive display post are ordered by post format
- Query Products & Store IDs in array
- Way to cache a query for 24 hrs
- WordPress loop not working on static front page
- Multiple posts/pages in one page?
- Order for custom field after the loop
- toggle Multiple Loop with tittle
- query_posts clarification needed
- 2 queries with counters
- Query all post types but limit to parents
- Frontpage pagination by week
- Integrating WordPress with Your Website
- How to create a custom WordPress front page
- Problem with Front-Page.php loading recent posts
- Custom post query error
- How to Fix an Archive.php That Displays All Posts?
- Add Class according to the order of appearance
- query_posts orderby multiple ways
- Optimize CPT-function with a loop
- Display specific posts on home page
- Make query_post category name dynamic
- How can I list posts with different formats depending on order?
- query_posts orderby postmeta [closed]
- Can I use WP_Query one time and then filter the results multiple times
- pagination broken – clicking next displays “page not found”
- How to remove/replace current page template?
- Multiple instances of query_posts
- WordPress Query based on random taxonomy
- Paginate pages with dynamic query
- Displaying and Querying Posts with Featured image
- Pagination linking to first page
- List post only under the category, exclude child category content
- Restrict query_posts by Date?
- Different layout based on post amount?
- How to break up php code to avoid echo
- Query Multiple Custom Post Types & Exclude a Taxonomy Term
- Custom Post type showing up in loop, regular posts are not showing up
- Posts being viewed
- How to solve this without flushing the rewrite rules for each post query the visitor triggers?
- Display 3 posts with different HTML markup using a loop
- View Achive with Category Filter, but Page per post not working
- Performance concerns: index.php vs taxonomy-$taxonomy.php
- Determine if ID is page or post and query the ID
- Pagination for two loops
- Custom template for password protected page
- Sort post by custom field numeric value
- Meta query stopped working
- If Query Post Returns 1 Post
- Custom Post Type Single Loop Outputting Wrong Post
- Weird problem on if statement
- Sticky posts don’t show up first in custom loop
- Exclude current post ID from loop in sidepbar.php
- How to check a list or feed of all posts under a category and tag?
- Want Page Descendants when using query_posts post_parent or child_of
- grab neighboring content in a query
- Issue with sidebar widgets not showing when I do custom queries
- Why would post_type be ignored in this query?
- query_posts call sets is_home() to true
- show all in query_posts on category.php?
- Notting but the latest post content keeps on being loaded
- query_posts doesnt show pages with given ID when post_type => page
- Query Posts Incorrectly Displaying Tags Archives
- Keeping get_posts’ offset and is_paged() synchronized