Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #284780

    I would like to add the standard php echo date code to the footer socket ( the copyright area )

    When I add the following:<?php echo date("Y") ?>

    it gets stripped out with <!– remarks

    I tried wrapping them in [raw] and [code] – no joy
    How can we add this, anyone?

    #284825

    Hey AntonNovikov!

    Insert this code into the child theme functions.php or enfold/functions.php file:

    
    add_shortcode('year', function(){return date('Y');});
    

    and then insert the shortcode

    
    [year]
    

    into the copyright text field to show the current year.

    Regards,
    Peter

    #284879
    This reply has been marked as private.
    #284885

    Hi!

    Try changing the function to:

    function year_func($atts) {
    return date('Y');
    }
    add_shortcode( 'year', 'year_func' );

    You could also try replacing the “year” for another string, maybe there is a plugin that already has registered that shortcode name.

    Cheers!
    Josue

    #284891
    This reply has been marked as private.
    #284892

    Create a test.php file on your server with this content and check if it works:

    <?php 
    echo date(‘Y’);
    ?>

    If it doesn’t return anything, then it’s a server issue and you’d need to contact your hosting provider regarding that.

    Best regards,
    Josue

    #284902
    This reply has been marked as private.
    #284906

    Ok, let us know how it goes.

    Regards,

    Josue

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.