Rather than querying for a single item and then querying again for 6 more excluding the first, you can just do a single query for 7 items and selectively output markup by checking which post you’re currently outputting in the loop via $your_query_object->current_post
. You can also combine that with $your_query_object->rewind_posts()
to run through the same loop multiple times within a template.
Beyond that, you can store your menu in a transient so you’re not doing all those queries on every request. I always recommend people use a caching plugin as well, like W3TC or similar.
Related Posts:
- Display tags with random thumbnail from selection of posts with that tag
- Posts with at least 3 tags of a list of tags
- Differences Between WP_Query() and get_posts() for Querying Posts?
- Should I use Transients with W3 Total Cache APC Caching? [closed]
- What is the most efficient way of querying posts based on visits and date for current day?
- Better way to get tag stats?
- Is it true $wpdb->get_results is faster than WP_Query in most cases?
- Given a WP_Query, how can I get a list of tags?
- Executing Queries in tag.php
- How to order posts tag by tag?
- Slow SQL_CALC_FOUND_ROWS Query
- post_type is ignored by WP_Query when ‘tag’ argument is included
- WP Rest API v2 return posts with specific tag
- Loop through all tags & output posts in alphabetical list
- get_the_title($postID) OR get_the_title()?
- Order posts by tags count?
- Stop all SQL_CALC_FOUND_ROWS wordpress queries
- How to get any tag ID
- Get all posts without tags
- WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)
- Slow speed and high CPU usage for my code. How to improve it?
- Multiple queries on Home Page – page load/site speed issue
- WP_Query Performance Issues with meta_query
- How to exclude products by tag from woocommerce shop page?
- Pagination problem after WP_Query with tag filtering
- Too many posts cause slow load when paginating
- WP_Query times out
- Improve wp query perfomance on large db
- Query post from all category with same tag on 1 pages
- WordPress Related Post by tags in Single.php
- How to build a WP_Query using mulitple tags and using AND or OR operator between them
- Include tags in WP_Query
- Search for multiple tags?
- Display posts from only one post form in custom query and exclude in main query
- Fastest way of counting posts of a custom post type in a specific taxonomy term?
- Use more than one query, but prevent duplicates – at scale!
- How can I make WP_Query get posts that have a tag but also have random other tags?
- Cluster WooCommerce products in each Category Archive by Tags assigned to products
- Is it a good idea to improve meta query performance by adding tax query?
- Slow page loads due to WordPress Core Query
- Query posts intersecting tags and categories
- Should wp_query automatic meta and term cache priming be used in an enviroment with an object caching
- Loop Performance > JSON files vs. WP_Query vs. REST API
- Combining categories (Query posts with multiple taxonomy terms)
- How to increase load time of an archive/search page (WP_Query)
- use of 10 new WP_Query : loading too slow (with url) [closed]
- Which is faster wpdb & get_row or wp_query & ge_post_meta?
- Order by most used tag
- WP Query with multiple tags by get the tags
- How to not display tags with less than X posts
- What is the best way (regarding performance) to set transients for logged in users?
- Query Posts by Tag and exclude
- Get posts that do not have the same tags as current
- exclude product with available tag
- WP_Query by keyword OR post tag
- Display posts by tag
- Creating attachments archive in tags and categories
- Get posts with no tags?
- How to avoid filling up an array each time I run a WP_query?
- Performance concerns: index.php vs taxonomy-$taxonomy.php
- Which is from this queries is more faster
- Disable (or limit) queries when certain content (or data) is not needed (or showed)
- Filter products on category AND tag
- Only show tag with the same id as the post
- Get posts that match defined arrays of tags
- Order posts by tags count?
- Fix wp_term_relationships slow query in get_posts
- Unusual high query of user meta data
- update_post_meta performance in a loop woocommerce
- update_post_meta performance in a loop woocommerce
- getting posts by tags
- Search with WP_Query, but ignore href URLs in anchor tags?
- WP_Term_Query->get_terms() very slow query for WordPress filter
- Show posts from categories instead of tags
- Showing the correct number of posts_per_page when avoiding the use of post__not_in
- post_type not working when tag__in is present?
- Calculating efficiently on large amount of data generated by wp_query
- Related Post by Tags Code
- Exclude all tagged posts from WP_Query loop
- I cannot get tax_query in get_posts() to work with custom taxonomy
- WordPress custom query by archive title
- How to create page that lists tags by initial letter?
- Random posts in WP_Query when searching by tag
- Website goes slow down after importing long database
- Issue attempting a wp_query_posts with tags
- Optimising amount of calls to custom fields
- Post OrderBy slow performance
- Limit Tags display and ad Drop Down Menu
- Can’t seem to get an else statement correct? [closed]
- Get posts that were most recently tagged
- How do I show related posts from categories instead of tags?
- New template file does not load category-specific post
- Show a message if there are no active posts in category
- Where is the coding error for the unexpected ‘}’ in this if / else choice of loops?
- get_posts return only first result
- Get authors list and sort them by recent posts
- Show custom content when loop or wp query reaches specific time?
- WordPress Query by Category using Post Slug
- How can I write a WP_Query that is this specific?
- How to allow a variable with “/” in wordpress url