Spintax In WordPress Template Files?

#478826
  • Resolved Jack Brown
    Rank Math free

    Hello Sir,

    I am wondering that Can I use Rankmath Spintax function to wordpress template file instead of Using in Rankmath Title or Description ? if Yes then can you please share it how ?

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math support and bringing your concern to our attention.

    Since our Spintax feature is implemented via variables, you need to ensure that you have pre-process the variable you will include in the template file.

    Please refer to this sample code:

    $random = RankMath\Helper::replace_vars("%randomword(Tesla|BMW|Ferrari)%");

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Jack Brown
    Rank Math free

    Hello Sir,

    $random = RankMath\Helper::replace_vars(“%randomword(Tesla|BMW|Ferrari)%”);

    It’s working fine.. Now, Can I add hyperlink or bold text like Tesla ?
    Can I add any HTML tag ?

    Hello,

    This variable was made to generate texts/word only and no other formatting. Adding HTML tags will be stripped before we output the chosen random word.

    You may wrap the HTML tag in the outputted word, not inside the %randomword(...)% variable.

    Looking forward to helping you.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this ticket.