Viewing 19 posts - 1 through 19 (of 19 total)
  • Author
    Posts
  • #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 7 years, 9 months ago by Yigit.
    #662159

    Hi 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,
    Yigit

    #662166

    I 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?

    #662172

    Hi!

    Please post login credentials here privately so we can look into it.

    Cheers!
    Yigit

    #662174

    see private

    #662183

    Hey!

    I made a syntax error, i am sorry. Can you please post FTP credentials privately as well so i can fix it?

    Best regards,
    Yigit

    #662198

    Id prefer to fix on my own, can you advise which code file you want to see? I will paste it here

    #662205

    Hey!

    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,
    Yigit

    #662251

    confused should i not wait for you to have the code ready before changing the function.php file?

    #662252

    Hi,

    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,
    Yigit

    #662255

    Weird, 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?

    #662256

    Hi!

    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,
    Yigit

    #662268

    thx works again, let me know what the code should be thanks

    #663201
    #663700

    got 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 ?

    #663983

    Hi,

    Please go to Settings > General and change it as needeed

    Best regards,
    Yigit

    #663986

    Yigit, 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 7 years, 9 months ago by yingyang.
    #664871

    Hi,

    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,
    Yigit

    #664876

    awesome 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 7 years, 9 months ago by yingyang.
Viewing 19 posts - 1 through 19 (of 19 total)
  • The topic ‘Display date and time in icon box’ is closed to new replies.