-
AuthorPosts
-
July 17, 2016 at 7:44 pm #661805
Hi,
I’d like to display the local server date and time in the icon box text box, i think i need to add a shortcode like this to my quick CSS ?
I tried both tutorial but no luck, i’d like the format to be like so: Sunday July 17th 2016 6:43 PM
- This topic was modified 8 years, 3 months ago by Yigit.
July 18, 2016 at 5:43 pm #662159Hi kilimats!
You should add following code to Functions.php file of your child theme in Appearance > Editor
function displaydate(){ return date('F jS, Y'); } add_shortcode('date', 'displaydate');
and then add following shortcode in text tab
[date]
Code should not go Quick CSS.
Best regards,
YigitJuly 18, 2016 at 5:49 pm #662166I added this code at the bottom of my child function.php file like so
/* *Display date and time in icon box” title *https://kriesi.at/support/topic/display-date-and-time-in-icon-box/#post-662159 */ function displaydate(){ return date('F jS, Y'); } add_shortcode('date', 'displaydate'); }
Then added [date] in the icon box content seen on top of the private link, still doesnt show, what did i do wrong?
July 18, 2016 at 5:54 pm #662172Hi!
Please post login credentials here privately so we can look into it.
Cheers!
YigitJuly 18, 2016 at 5:57 pm #662174see private
July 18, 2016 at 6:23 pm #662183Hey!
I made a syntax error, i am sorry. Can you please post FTP credentials privately as well so i can fix it?
Best regards,
YigitJuly 18, 2016 at 6:56 pm #662198Id prefer to fix on my own, can you advise which code file you want to see? I will paste it here
July 18, 2016 at 7:07 pm #662205Hey!
Please go to wp-content/themes/enfold-child/functions.php file and remove the code from the file. I modified it a little. I will try to reproduce on my local installation and post working code here.
Regards,
YigitJuly 18, 2016 at 8:21 pm #662251confused should i not wait for you to have the code ready before changing the function.php file?
July 18, 2016 at 8:24 pm #662252Hi,
You can remove it now but this does work for me – https://kriesi.at/support/topic/display-date-and-time-in-icon-box/#post-662159
Best regards,
YigitJuly 18, 2016 at 8:25 pm #662255Weird, now my site crash when i use this file: wp-content/themes/enfold-child/functions.php
when i rename OLD the site works again, can you see whats wrong?
July 18, 2016 at 8:31 pm #662256Hi!
Removing the code from functions.php file should fix the error. If not, please post FTP credentials so we can look into it.
Best regards,
YigitJuly 18, 2016 at 8:50 pm #662268thx works again, let me know what the code should be thanks
July 21, 2016 at 5:48 am #663201Hey!
This is the updated code: https://kriesi.at/support/topic/display-date-and-time-in-icon-box/#post-662159
Regards,
IsmaelJuly 22, 2016 at 5:36 am #663700got it working thx guys, now the issue is that its using the UTC time instead of the local, how do i tell WP to use the local time as default ?
July 22, 2016 at 5:16 pm #663983July 22, 2016 at 5:30 pm #663986Yigit, it is set correctly under general setting, this is what i see there: Universal time (UTC) is 2016-07-22 15:28:53. Local time is 2016-07-22 11:28:53.
when i use your code, it uses the UTC time instead of the local time, how do i make it use the local time?
- This reply was modified 8 years, 4 months ago by yingyang.
July 25, 2016 at 10:29 pm #664871Hi,
Please change the code to following one
function displaydate(){ echo date( 'Y-m-d H:i:s', current_time( 'timestamp', 0 ) ); } add_shortcode('date', 'displaydate');
Best regards,
YigitJuly 25, 2016 at 10:33 pm #664876awesome that worked ! here is the final code i used to produce this result (Monday, July 25, 2016 4:32:29 PM) for anyone that is interested
function displaydate(){ return date('l, F j, Y g:i:s A', current_time( 'timestamp', 0 )); } add_shortcode('date', 'displaydate');
- This reply was modified 8 years, 3 months ago by yingyang.
-
AuthorPosts
- The topic ‘Display date and time in icon box’ is closed to new replies.