This members-only tutorial provides the steps to parse the text in a URL parameter or query variable and display its value on the page in Oxygen.
After implementing the steps in this tutorial, you can have the heading text show
"Hello Sri"
at
https://example.com/landing-page/?fname=sri
and
"Hello Louis"
at
https://example.com/landing-page/?fname=louis
Use Case
Most email marketing list providers provide an option to insert dynamic variables or tokens in the body of emails that you can blast to your list subscribers.
Let's say you launched a new product and want to make your list users feel special by displaying the user's first name on the product landing page.
You could build a link and append something /?fname={first_name}
Now each user is going to see his/her first name next to "Hello" in the landing page header/body text.
Process
We are going to
add fname
to the list of public query variables that WordPress can process- define a custom PHP function that displays the value of specified query variable (this will be sent in when calling this function), sanitizes it and converts the first letter to uppercase. Update: Added instructions to show a fallback text.
- use the PHP Function Return value feature in Oxygen and call our function defined with
fname
as the input
Step 1
Install and activate Code Snippets plugin.
Go to Snippets > Add New.
Title: Add "fname" query variable
Code:
This is a premium members-only content.
To view the rest of the content, please sign up for membership ($47/month or $599 one-time).
Already a member? Log in below or here.