Add date on navigation bar

Home Forums Support Add date on navigation bar

Home Forums Support Add date on navigation bar

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #201890
    Michael B.

    Is there a way to add the current date such as “June 13, 2016” on the navigation bar to the far right? Or at least some where at the top of the website? Thanks Michael

    #201974
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Good question!

    Give this code a try:

    add_action( 'generate_inside_navigation','generate_date_navigation' );
    function generate_date_navigation()
    {
        ?>
        <span class="nav-date">
            <?php the_date(); ?>
        </span>
        <?php
    }

    Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/

    Then add this CSS:

    .nav-date {
        float: right;
    }

    Adding CSS: https://generatepress.com/knowledgebase/adding-css/

    That should get you going ๐Ÿ™‚

    #212017
    Mosche

    Hi Tom,

    What would the code be if I want to add it to the secondary Nav Menu?

    Regards,

    Mosche

    #212126
    Tom
    Lead Developer
    Lead Developer

    This would be the function for the secondary navigation:

    add_action( 'generate_inside_secondary_navigation','generate_date_secondary_navigation' );
    function generate_date_secondary_navigation()
    {
        ?>
        <span class="nav-date">
            <?php the_date(); ?>
        </span>
        <?php
    }
    #212133
    Mosche

    Thanks Much Tom.

    Works like a charm.

    Regards,

    Mosche

    #212158
    Tom
    Lead Developer
    Lead Developer

    Glad I could help ๐Ÿ™‚

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