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.com/category/sport?sport=football
instead of
www.mybeautifulwebsite.com/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!
GET
parameters rather thanPOST
parameters? APOST
request doesn't add things to the URL as it sends parameters in the HTTP headersget_queried_object()
) in the template to get the data, there's no need to change the URL and use$_GET