Notice: These forums are now retired and closed. For active support, please Submit a Ticket or visit our official WordPress.org community pages.
Kadence Theme | Kadence Blocks | Starter Templates | WooCommerce Email Designer | Ascend | Virtue | Pinnacle

How to replace the city name based on url

Home / Forums / Kadence Blocks / How to replace the city name based on url

This topic is: Resolved
[Resolved]
Posted in: Kadence Blocks

Tagged: 

July 25, 2025 at 11:48 am

I’m trying to replace a city name based on the city name “being part of” the URL. For Example:

The text is:
Serving {city-state}

The URL is:

Result is:
Serving Tampa FL

I have a bunch of city-state, so I just want to one line, not repeat the line N times and use the Kadence URL conditional display approach as it’s inefficient

Some PHP code to look for and extract the string would likely work, but I need a simple IF statement that matches the {city-state} in the URL with any entry in an ACF or similar table, and then replaces the {city-state} parameter with the matching field value. Is there a way to achieve this within Kadence or with Kadence plus another plugin? Any other ways to pull this off in a simple fashion? I’m not an expert on PHP or Java, but links to any examples that pull this, or are close to this, would be appreciated. If Kadence can’t do this, it would be a killer feature IMHO.

Thanks in advance!

Ken

  • The forum ‘Kadence Blocks’ is closed to new topics and replies.