As an alternative to using tabs, and as a genuine means of returning selective content on WordPress pages, we'll often use a select menu to return various types of hidden content to a page. If you're using our client plugin you'll be familiar with the experience since we'll routinely show the select menu as an alternative to tabs when the content itself is returned via a tab.
The result of our simple function is as follows (select a new option):
The PHP Function
You will want to alter the following function to suit your own purpose.
The function requires an array of data that includes the select menu titles and the DIV content. The array we used in our example is as follows:
If you were to use our example function you would return the menu with the following:
The jQuery function negates the need to include laborious if/else statements... so it doesn't matter how many block of content you wish to return; whatever is provided via the array will be rendered into your menu.
Download
Our example above may be downloaded below.
Title: Select Menu With Hidden Divs
Description: Create a Select Menu With Hidden Divs From an Array With PHP. Working example.
Download • Version 0.1, 913.0B, zip, Category: PHP Code & Snippets