• I want duplicate words on a single page in predefined div to be bold on a WordPress site, and I do not know how to accomplish this. Who can help me out?

    So let me roughly describe what functionality is needed. Here’s the layout of my page:

    DIV A
    keyword 1, keyword 2, keyword 3, keyword 4
    End DIV A
    Bunch of other divs and content

    DIV F
    keyword 2, keyword 4, keyword 7, keyword 8
    End DIV F

    I want the keywords 2 and 4 located in DIV F to be in bold text, based on that there are duplicates in DIV A.

    So I need something that looks in both DIV A and F, determine if there are any duplicates and if there are mark those duplicates in bold in DIV F only.

    Do i need CSS, PHP, a function or a plugin to accomplish this? Who can point me in the right direction?

Viewing 1 replies (of 1 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    What I’d do… (I’m sure there are other ways)

    Create a filter on the_content()

    Make an array of words from DIV A. For each word in DIV F, look to see if it’s in the array from DIV A. If so, use strreplace in the string of DIV F to replace WORD with <strong>WORD</strong>.

    You could write this as a fairly simple plugin.

Viewing 1 replies (of 1 total)
  • The topic ‘Make duplicate text bold automatically’ is closed to new replies.