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.

Adding a class to a specific text

  • Hi guys,

    I’m looking to automatically add a CSS class (such as “site-name-dkt”) to a specific string of text (such as “Dong Knows Tech”) for any post.

    Is there a simple PHP snippet for this?

    Thanks,

    -Dong.

  • Hello Ngodong,

    To clarify, are you looking to add that class to any Block that has the text “Dong Knows Tech”?

  • I want the class for the actual text string itself, like in case I want to add change color or font for that particular text, no matter where it appears in the page.

  • You’ll need Javascript for that. This would be out of our scope.

    It might be good to reach out to a developer regarding this as this may be a bit complicated.

  • So what should I do if I want to add the class to an entire block with the text string?

  • Can you provide a link to a page and point us to an example block/text you wish to add the class to?

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