0

I have a custom template named "eshop". In there, it calls a separate API out from WordPress and clicking on a link returns something like : eshop/ABC-123/

Is there a way I can make all the URLs that contain the word "eshop" to use the custom template I have created? Thanks!

Sylph
  • 1,195
  • 3
  • 22
  • 36

1 Answers1

0

Step one: Pull the URI into a variable (http://webcheatsheet.com/php/get_current_page_url.php)

Step two: Search the variable string for the string you're looking for (How do I check if a string contains a specific word in PHP?)

Step three: use an if statement (If variable includes string "eshop", include the template) with a PHP include statement.

Community
  • 1
  • 1
Jacey
  • 581
  • 4
  • 11
  • Thanks for your reply. I am using WordPress template, where I create the Page from the CMS. Thus unable to perform step (3) . – Sylph Jan 06 '16 at 14:56
  • You tagged PHP so I thought you wanted to do this with PHP. – Jacey Jan 06 '16 at 15:29