Site logo

Archived topic

Add current date to homepage & category pages

17 replies · Started by oge on September 20, 2019

Viewing posts 1–15 of 18

Hi

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

Thanks

Hi there,

Where would you like to add it?

Let me know :)

My homepage title tag and category pages title tag

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'); ?>

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

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?

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.

How can I send you the link in private?

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

I have edited the topic and added my URL details.

Thanks

Can you try changing the Hook to the after_header_content hook

Hi

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

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.

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

This archived topic is closed to new replies.