• silvanoir

    (@silvanoir)


    Hello.

    Please help!

    How to change the date format which appears in the header area? Now it looks like this: Sunday, November 20, 2016. I need it to look like this: Sunday, 20 November2016

    Is there any simple way – without making a child theme etc. to change this in code?

    Thank You for every response ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • Have you changed the date format under the Settings > General menu from within your Dashboard?

    l, j FY would create Sunday, 20 November2016

    Hope this helps.

    To ThemeSumo: unfortunately the WordPress settings> General date format chosen doesn’t change the date format in the theme header area.
    Best regards

    Okay, you can modify this date format using a Child Theme, add this to the functions.php file:

    function colormag_date_display() { ?>
       <div class="date-in-header"><?php 
            echo date_i18n('l, j FY'); ?>
       </div><?php
    }

    The above function will overide the default function that displays the date in the header, hope this helps.

    Thread Starter silvanoir

    (@silvanoir)

    Okay, you can modify this date format using a Child Theme, add this to the functions.php file:

    function colormag_date_display() { ?>
    <div class=”date-in-header”><?php
    echo date_i18n(‘l, j FY’); ?>
    </div><?php
    }
    The above function will overide the default function that displays the date in the header, hope this helps.

    Sorry but this doesn’t help. Where should I place this code directly?

    You need to use a Child Theme, this way you can use its functions.php file to modify a theme function.

    You can copy/paste the code I gave you above into the file and it should work without any issues as I tested it on my own environment.

    If you modified a theme file directly without using a child theme, you would lose all custom code changes the moment you update the theme in the future. The function we’re going to override resides within the /inc/functions.php file (line 514) of the colormag theme.

    Hope this helps.

    • This reply was modified 7 years, 11 months ago by ThemeSumo. Reason: typo

    Hello

    I have tried the code above ` function colormag_date_display() { ?>
    <div class=”date-in-header”><?php
    echo date_i18n(‘l, j FY’); ?>
    </div><?php
    }`
    on child theme. Good. But where can i change the Latest words with something like this :
    Infos :
    Thank you.
    Nb: i am on localhost in developping the website.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Colormag header date format problem’ is closed to new replies.