Hello the community,
I would like to know if is it possible to generate menu links using the PHP Get Method instead of the regural one used in Wordpress? e.g :
www.mybeautifulwebsite/category/sport?sport=football
instead of
www.mybeautifulwebsite/category/sport/football
Explanation:
My page about sports news list 1 news per sport, like this:
My page about a particular sport news list all of its news, like this:
As you can see, it's quite the same page. So I want to reuse my page about "Sports News" to display the news about each sport.
For information:
Football, Basket-ball, ... are sub-categories of the Sport category
I registered my sport sub-menu via register_nav_menus() in my functions.php and called it via wp_nav_menu() in my category-sport.php.
I think I can create this sub-menu manually or create my menu with custom links to do what I want, but:
- I want to know if there is a more beautiful way to do it
- I want to know if my way of thinking is good because I'm new in Wordpress development
Thank you!
Hello the community,
I would like to know if is it possible to generate menu links using the PHP Get Method instead of the regural one used in Wordpress? e.g :
www.mybeautifulwebsite/category/sport?sport=football
instead of
www.mybeautifulwebsite/category/sport/football
Explanation:
My page about sports news list 1 news per sport, like this:
My page about a particular sport news list all of its news, like this:
As you can see, it's quite the same page. So I want to reuse my page about "Sports News" to display the news about each sport.
For information:
Football, Basket-ball, ... are sub-categories of the Sport category
I registered my sport sub-menu via register_nav_menus() in my functions.php and called it via wp_nav_menu() in my category-sport.php.
I think I can create this sub-menu manually or create my menu with custom links to do what I want, but:
- I want to know if there is a more beautiful way to do it
- I want to know if my way of thinking is good because I'm new in Wordpress development
Thank you!
Share Improve this question edited Jan 28, 2020 at 14:37 Gerald asked Jan 28, 2020 at 13:42 GeraldGerald 12 bronze badges 6 | Show 1 more comment1 Answer
Reset to default 0Well.
After a little search with the intention to find a way to re-use my category template (Sport), I found the solution of my problem: Force sub-categories to use the parent category template
So I let this solution here in case of someone has the same problem and the same weird idea to resolve it than me.
GET
parameters rather thanPOST
parameters? APOST
request doesn't add things to the URL as it sends parameters in the HTTP headers – Tom J Nowell ♦ Commented Jan 28, 2020 at 13:55get_queried_object()
) in the template to get the data, there's no need to change the URL and use$_GET
– Tom J Nowell ♦ Commented Jan 28, 2020 at 15:34