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
- How do I search an array stored in a custom-field using WP_Query?
- How to make an meta_query optional?
- How to sort CPT by custom meta value (date), and return posts month by month
- Comparing timestamps in meta query doesn’t work
- How can update custom meta for all posts
- Unique key for each row in a repeater field
- Using a javascript file to access a get posts array
- Sorting Posts | Alphabetical Order
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Storing Array from returned database query and using the array in a new query
- How to use an associative array in post__in with WP_Query?
- How can I get the number of custom post type posts that have a specific attachment image set?
- Including metaboxes from custom post types in global search — continued
- Alter required message using comment form api
- Saving zero in meta box
- How to array only one key from another array
- Why does this update_post_meta function not delete the custom field itself?
- How to get specific post meta by title or id
- Why is an array created in a function hooked to customize register populated when customizer is loaded but not when the front-end is loaded?
- Convert a string into a decimal number for use in query
- Increment paged on WP_Query
- Hide posts if user is added to it WP_query
- Get data from PHP to JavaScript to set position of each post on front page
- WP All Import / Update stock quantity from multiple XML files
- How to insert wp_users ->user login name to wp_terms when a new user registering?
- Concatenate Custom Field Value & HTML Value
- posts_nav_link pulling in multiple post types
- Display background color or image with custom meta box?
- Modifying WP URL handing code?
- Replace a single variable with add_filter
- Products listing check if meta checkbox is checked
- meta_query search names when they have middle initials
- Inserting a class on before_widget if checkbox is checked
- What is the correct way to search 3 custom fields only in WordPress?
- How do I get the value of a current user’s custom field?
- Multiple Arrays for Custom Post Query using Boostrap accordions and ACF repeater fields
- How to filter specific element of an array in wordpress/php?
- Filter custom WP_Query by first letter of a custom field – hopefully using Search and Filter Pro?
- Query to show average # of months all accounts with specific role have been active
- Remove item from post_meta array via AJAX
- PHP Notice: Unidentified index
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- Query doesn’t display text data with apostrophes
- PHP array to jQuery array ” Uncaught SyntaxError: Unexpected token < "
- Custom fields changes the formatting of metabox input
- get_post_meta for Custom Post Type ( CPT )
- How to display all custom fields associated with a post type – IN THE ADMIN AREA?
- Masonry layout within the loop
- How can I put a custom field as the link of a button shortcode?
- I want Page titles and excerpts to show up on home.php in certain order
- Display ACF object field data using Elementor Custom Query
- WordPress custom field sorting, weird behavior: the latest post is at the end
- How do you create a front end form that enables the editing of member-specific custom fields in WordPress?
- How to use a conditional statement in a post loop but not count towards the “posts_per_page” if false
- How to make multiple custom taxonomies sit under custom post type slug?
- Problem with custom user fields default value and retrieval
- Cannot Access ACF Field Values via my Plugin
- Remove slug and custom post type name from URL
- Options of select field in a custom divi module ignore sorting