Show Element at Certain Time in WordPress
Show Element at Certain Time in WordPress
Show Element at Certain Time in WordPress
To be able to do this your post meta values need to be strings in a valid date format, e.g. 2022/01/31 for January 31st 2022. Note I used ISO standard timestamp format with the biggest value first, then everything descending, and avoided using a regional value such as 31/1/2022 from the UK, or 1/31/2023 from … Read more
Resolved. My error are there : $FirstDayThisMonth[] = date(‘Y-m-01 00:00:01’, mktime(0, 0, 0, $x, 1)); $LastDayThisMonth[] = date(‘Y-m-t 23:59:59’, mktime(0, 0, 0, $x, 1)); instead of : $datestart = strtotime(date(‘Y-‘.$nbofmonth.’-01 00:00:01′)); $dateend = strtotime(date(‘Y-‘.$nbofmonth.’-t 23:59:59′)); It’s always very annoying to have well written code and to realize that a small element breaks everything
There are 3 problems here It’s Using a Non-Standard Date Format The dates are being stored like this: 20230131 Which is ok for us as we can interpret that as a date with no spaces, but it needs to stored like this: 2023 01 31 Specifically, it needs to be timestamp like this: YYYY-MM-DD HH:MM:SS … Read more
The “unreadable format” you have posted is known as a UNIX timestamp. It is the number of seconds from January 1, 1970, to the date represented. Using a handy online tool, you can quickly see what that timestamp equates to if needed: http://www.unixtimestamp.com/index.php In order to reformat this timestamp, in your case YYYY-MM-DD, you will … Read more
General WordPress rule: when a function starts with get, it will return the value. If it starts with the, it echoes the value. Here, you need get_the_date(‘d-m-Y’) instead of the_date(‘d-m-Y’).
Although this is not a WP question, it could be done with some PHP/MySQL code. Just the psuedocode: generate a GUID value on each main page visit check if the GUID is already in the GUID database if not, store the GUID in the GUID database if GUID exists in the database, redirect to another … Read more
Before WordPress 4.1, you can show the date archive page titles with the following code: (Taken and slightly modified from the twentyfourteen theme) if ( is_day() ) { printf( __( ‘Daily Archives: %s’, ‘twentyfourteen’ ), get_the_date() ); } elseif ( is_month() ) { printf( __( ‘Monthly Archives: %s’, ‘twentyfourteen’ ), get_the_date( _x( ‘F Y’, ‘monthly … Read more
The post_date is the post_date_gmt after the Timezone value (in Settings) has been applied. So, if you like, the reasoning is that there’s a standard time for everybody, and then your own site’s time depending on your Settings, so say you want to change that later, the standard time is always left untouched.
I don’t see any reason why your code should not work, and when I test things it does work. I think that one of the following is happening: Your meta_key is wrong. Perhaps it is prepended by a _ for example. You don’t have correct, or consistent, timestamps You have sticky posts getting in the … Read more