Trying to replicate archivesingle url behaviour in a custom page

Question

I created a custom page ‘page-channels.php’

since I get all the data from api requests I don’t need or want to open a custom post type for channels but I would rather alter the behaviour of the page to act like it one (url wise and passing parameters wise)

for example :

example.com.com/channels : would open in page-channels.php

example.com.com/channels/sport : would open in page-channels.php will recognize the sport id and include code single-channels.php with sport variable

I was able to do that when I made my permalinks structure look like this

/%postname%/

But I only able to reach page-channels.php where I enter numeric values

for example: example.com/channels/12 would work

example.com.com/channels/sport wouldn’t work

Would love if someone can shed some light on how can I resolve this.

I know that it can be achieved via query params but I rather not use it.

Thanks in advance,

0
, , Yoni 2 years 2020-01-16T08:38:22-05:00 0 Answers 73 views 0

Leave an answer

Browse
Browse