This sounds like a pure PHP and array question so I believe I can help.
You may wish to make friends with these to PHP functions:
-
array_push() – Push one or more elements onto the end of array
-
array_shift() – Shift an element off the beginning of array
There are more efficient ways to reorder an array, but this will work.
array_push($days,array_shift($days));
This should pull the first item from the array and put it on the end of the array. This is not necessarily the most efficient way but an array of 7 items probably does not matter too much.
Also: FYI, I’ve not tested this code but I am pretty confident it will cycle an array by one. You are still going to want logic for how many cycles to us (probably doing nothing on 7).
Related Posts:
- Redirect to another page using contact form 7? [closed]
- Order a WP_Query by meta value where the value is an array
- Can an array be used as a meta_query value?
- How do I dynamically generate args for wp_query?
- Conditional to modify query results
- How to use $query->set with post__in?
- Why do WP_Query results change after updating unrelated Advanced Custom Fields (ACF)?
- Exclude posts based on meta value
- auto-populating custom nav with all items from custom post type
- Advanced Custom Fields – display label and value only if value entered
- Is it possible to retrieve all posts with a certain value for metadata?
- WP_Query: getting posts where custom field exists
- How to show meta value code HTML after x paragraph
- WordPress loop by meta key that is an array? and how loop multiple arrays
- Getting posts to exclude from array
- Get all posts as an array ID => Name
- extract serialized array to use for wp-query
- How can I split my query result in 2 arrays?
- array_rand not working correctly?
- Using multiple variables to assign categories to an array
- Add custom fields from different posts
- Sending simple variable on single page to WP JSON
- Alike Shortcode using in Custom Shortcode
- Query custom post type that has a serialized relational advanced custom field value
- in_array not working on dev server but works on localhost
- Sort custom post column by generated value?
- Query on a repeater date (acf)
- WP post meta – for loop inside for loop
- Combine multiple queries, array_unique returns nothing
- Store custom field’s multiple values in one user meta key
- WordPress loop add heading before first of type
- How to make a shortcode for my WP_Query Loop? [duplicate]
- WP query with variables gives no result for specific user
- Display all categories (with link) of custom post type – WordPress
- Grabbing value of input field inside of array
- Displaying custom meta box value in a custom post page
- How to sort custom sortable column by custom table value
- I want to show image from custom field image on my custom page template
- How do I exclude the current post from the upcoming post query
- fetch from an external api call and display results in page
- Want to add custom post type for facebook feed
- Display posts in correct month order using single date custom field
- Sort by two dates. Default entry date and custom field if present
- Generate an array of parent/child page IDs, based on parent page name
- Make custom field meta not display if there is not data in it
- WP_Query meta_query results date by date
- How add a custom posttype name using ACF field to a query post array
- Count number of published posts by type
- How do I output a database option that is an array into a get_posts array?
- How to display custom field on homepage
- Display Post co-authored in Author Page
- WP_Query sort using multiple numeric meta values
- WP_Query search posts by custom post type and custom taxonomy
- Display related products with custom output
- Help with adding pagination to custom wp_query
- WooCommerce: update custom fields after checkout validation failure
- Can’t increase posts_per_page by variable
- Listing and displaying WooCommerce Shipping Zones in the frontend? [closed]
- List of posts by day of the week
- How to add custom taxonomy slug in CPT permalink?
- WordPress WP_Query() Not working properly
- Check if term object is in array
- If Meta Checkbox is checked, do something?
- Show custom field if it exists, and show different elements if it doesn’t
- Filtering by Post Meta Custom Fields – Performance
- wp_query to find posts by year and month
- Sorting Posts | Alphabetical Order
- WP_Query is printing out only one post when posts_per_page is set to multiple
- Get taxonomy terms only of the WP_Query current posts
- WP Query to displaying date and posts for that date?
- WP Query—Relationship between two custom post types and their fields
- how to increase custom post value by one most efficiently?
- Must Use Plugin Causing Query Error
- Create a random unique 6 digit number as custom field for custom post type
- How to get to a specific position in wp_query?
- Get category name from custom loop and echo it once
- How to dynamically attach pictures to a carousel
- Looking for most performant way to execute several similar WP queries within shortcodes
- Using several custom fields as custom post title
- ‘orderby’ => ‘rand’ alternative for better performance?
- API response to be stored locally
- How to convert objects into arrays
- Create a post in custom post type using field in registration form after users submit form
- Get all Posts If has same custom field values in Posts
- Use wp_get_recent_posts with search term
- WP_Query loop, does not display special characters in title correctly
- Remove query string specific key value
- Parsing php string in jquery [closed]
- Hide post if matches current month and year
- Can’t get order_by meta_value_num to work properly
- Admin Options page. Save as Array
- Get the last month with posts using a recursive function…
- Custom field value not saving when it contains a URL?
- Use WP_Query in shortcode
- Custom Post type and Custom Field WP_Query
- have_posts() execution failure
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Sum custom field values of particular taxonomy
- Save an array from drop-down in custom meta box
- WP Query Returning All Posts