Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Time HTML Tag

  • I’ve been trying to add the time html tag for a couple of days now. I’ve noticed that GPT is pretty good with code and helping implement semantic html. However, I am struggling only with the time tag which isn’t on GeneratePress by default, but nor was a few others I have used. I want to implement it on my publish date and last updated date on my posts in my hero element section. Thanks.

  • Hi there,

    Do you mean you want to change the text block’s HTML tag from div to time?

    If so, try adding this PHP code, then you should be able to see the time option in the html tag dropdown list:

    add_filter('block_type_metadata', function($metadata) {
        if (isset($metadata['name']) && $metadata['name'] === 'generateblocks/text'){
            $metadata['attributes']['tagName']['enum'] = array_merge(
                $metadata['attributes']['tagName']['enum'],
                ['time']
            );
        }
        return $metadata;
    }, 10, 1);

    Adding PHP: https://docs.generatepress.com/article/adding-php/

  • I must have gone through over 100 prompts with GPT trying to implement this lol

    It’s not perfect, because it said i need datetime=”…” for machine readability but there was simply no way to add this. I tried and tried and tried! But having that time tag as an option in the dropdown is fantastic and at least the html reads as time now.

    Thanks a lot Ying 🙂

  • You are welcome   🙂

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