0

I'd like to create a menu that can be selected on a page and display information pertaining to what was selected from the page menu. Just like what the WNBA has on this page for their teams schedules.

I tried to do some Google searching, but because I'm not exactly sure what the terms would be for this type of page / post, I can't find anything.

0

The term you are searching is Get and Set URL params, you can use this to set a param in an URL, like this:

add_query_arg( 'key', 'value', 'http://example.com' );

it will return:

http://example.com?key=value

and to get the value use this:

<?php  $value_from_URL = get_query_var( 'key' );  ?>

<h1>My value i just got <?php echo $value_from_URL; ?></h1>

all of this using WordPress functions.

0

David Lee's answer is pretty solid, but I doubt you understand how to write a template file or add any php to a page. Also, this would only work on page load, not as the user is actually selecting things in real time.

I would use jQuery to hide and show content using slideToggle() based on what the user clicks. If you need to have an actual url that specifies what to show, this link talks a little bit about it: https://stackoverflow.com/questions/19491336/get-url-parameter-jquery-or-how-to-get-query-string-values-in-js

But if you don't need URL variables then the solution is pretty simple. I could write out the code, but not knowing what you are actually working with makes it a little difficult.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.