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
- Search multiple custom fields by using meta_query
- If Custom Field is empty don’t display div
- Duplicates with WP_Query loop
- how to increase custom post value by one most efficiently?
- Create a post in custom post type using field in registration form after users submit form
- Use wp_get_recent_posts with search term
- Parsing php string in jquery [closed]
- WP_Query: include custom post type only with specific meta value
- Call global variable array() in woocommerce child/template
- Passing the custom field values in the wp_get_current_user array function
- Advanced Meta Query for Large Calendar Website (12k+ posts) (175k+ wp_postmeta rows)
- Problem querying Custom post type by custom fields
- Using custom field content as expression in IF statement [closed]
- How to store post ID’s in cookie or session to display the same posts later
- Query Multiple Custom Posts by Custom Fields
- PHP Array Returning [object Object]. Tried existing answers results with no luck
- Automatic Shortcode Creation with Custom Fields [closed]
- How to use if statement in an array? [closed]
- How to check if a PHP string is different than meta field?
- Loop increase number
- Is This Code Efficient – Or is there a better way?
- Hide Heading if ACF Field is empty
- Creating an image from a custom field
- User Meta Value not echoing despite Var_Dump Showing correct string
- Custom post type permalinks do not appear using the link functions
- how to make an array of post id’s in is_single
- Unable to render custom field after attempt to generate a list of recent post in page template
- Conditional On custom field plugin metabox
- WordPress stripping out custom field tags
- How do I list a custom field and custom taxonomies for each result in a loop?
- How to create repeater field manually, without plugin (ACF Pro)?
- orderby meta_value_num is not working, giving default order
- How can I modify this code to make the search box include tags and meta
- Woocommerce Custom Meta Boxes- How to only display if they actually have content
- How do you save the values from custom fields to a products data
- How do I make these combination select filters work when only one dropdown is set? They work in WordPress 5.8.2 but don’t in 5.8.3
- set object terms after some some time of published post – functions.php
- Is it possible to update the dataset using update_post_meta
- WordPress hide post from custom post-type on a single page
- How can I show how much water got saved on this order (making use of the number of items bought) on a thank-you-page?
- How can I query and sort custom-post type using WP_Query
- Getting info about selected posts using one WP_Query
- Get field in readable word
- Make sticky post with FacetWP
- How to return count of items found in SQL query
- Get meta_query value by user meta array
- Error in WP Query. If variable is empty it is displaying previous post value
- How to use foreach and if statement within array of arrays?
- For each 3 posts, show a different post type
- Include a custom field in mysql query
- Exclude Post ID from Array Specified in Custom Field
- Query category-specific, paginated posts and allow viewer to change sort order
- wordpress is_main_query() breaks
- Posts sortable column not sorting properly for custom field numbers
- Why does a meta_query break this WP_Query?
- ACF Date fileds to Age Convert [closed]
- Save custom field value to variable for conditional – why is this not working? [closed]
- XML WP_Query problem in PHP 8.0 and 8.1
- How to sort search result by post_title, then by post_content
- Custom Admin Menu Report for Specific User ID
- How to get posts by a certain author in inner loop using outer loop variable or post title WordPress