[Resolved] Add current date to homepage & category pages

Home Forums Support [Resolved] Add current date to homepage & category pages

Home Forums Support Add current date to homepage & category pages

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #1014763
    oge

    Hi

    Is there a way I can add the current date to my homepage title and category pages title?

    Thanks

    #1014765
    Leo
    Staff
    Customer Support

    Hi there,

    Where would you like to add it?

    Let me know 🙂

    #1014766
    oge

    My homepage title tag and category pages title tag

    #1014882
    David
    Staff
    Customer Support

    Hi there,

    you can use a Hook Elememt – and select the after_logo hook. And add this PHP snippet:

    <?php echo date('l jS F Y'); ?>

    #1015109
    oge

    Hi

    I can’t get this to work.

    I have the display rules set for the entire site and all users.

    I need the date to display in the page title.

    Thanks

    #1015143
    David
    Staff
    Customer Support

    Can you link me to your site so i can see the setup?
    When you say it doesn’t work – what does this mean – is nothing being displayed?

    #1015281
    oge

    Yes nothing is being displayed.

    You can view my settings here – https://ilado73.imgbb.com/

    #1015367
    Leo
    Staff
    Customer Support

    That link requires a login to view.

    Can you link me to the live site in question?

    Make sure execute PHP is checked in element settings as well.

    #1015385
    oge

    How can I send you the link in private?

    #1015391
    Leo
    Staff
    Customer Support

    You can edit the original topic and use the private URL field.

    #1015426
    oge

    I have edited the topic and added my URL details.

    Thanks

    #1015531
    David
    Staff
    Customer Support

    Can you try changing the Hook to the after_header_content hook

    #1015842
    oge

    Hi

    It appears in the header area but how do I get it to display in the page title?

    #1015969
    David
    Staff
    Customer Support

    Change the code to this:

    <p class="main-title" itemprop="headline">
    	<?php echo 'My Site Title ' . date('l jS F Y'); ?>
    </p>

    And then disable the Site Title in the Customizer.
    This way the title meta tag will preserve your actual site title.

    #1016877
    oge

    Hi

    How can I get the current date to display inside the title tag (<title></title>), either at the beginning or at the end?

    Thanks

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