Support » Plugins » Hacks » Displaying a filterable/sortable information database

  • Hello!

    I’m a bit new to WordPress so I would greatly appreciate everyone’s help on solving a very important problem to me.

    So, using a form I’ve collected more than 500 entries that contain some basic information about organizations relevant to my users. The idea is to help users get in touch with volunteer organizations that suit their interests. So each of my entries contains the name of the organization, location, contact information, website, short description, and purpose/tag (predefined) ie women, children, disability, etc.

    I collected the information with “Gravity forms” and stored them also in “Contact Form DB.” Both have worked very well and I am able to display different information on a page using the shortcode.

    The problem is right now I only know how to create a page that displays information matching certain predefined criteria (using the shortcodes). Such as a page on all volunteer organizations in the Philippines that help children.

    What I would like to do is create something much more useful and dynamic. Like many other websites I would like to have a page where users are given several drop-down menus and then based on what the user selects the appropriate entries from my database will be displayed. These drop-down menus would be something like country and purpose, also since many organizations have more than one purpose it would be useful if users could select more than one purpose (many with check boxes).

    So when users first come to this page (Organization database) it would initially display all 500+ entries. Then a user could select Philippines, women, and refugees, which would then substantially narrow down which organizations are displayed.

    What would be the best way to accomplish this? Using a table? I’ve tried but with no success? Or perhaps I need a certain plug in?

    Any and all help is super helpful!!!!!!!!!!!!

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • To give everyone an idea of what I’m thinking about in case I am not very clear it would look like something on these webpages:

    Example 1

    Example 2

    Sorry one more thing for me the purpose category would ideally be a drop-down checkbox menu like this:Drop-down checkbox menu

    That way users can select multiple purposes.


    Moderator bcworkz


    There is no predefined form element in browsers that include check boxes inside a dropdown. You can have a multi-select dropdown without checkboxes though. Users select multiple items with cmd-click or ctrl-click. There are various code snippets and modules that simulate what you are looking for through various CSS and JavaScript tricks. I’m unsure what the data looks like from such a module, it may be an array of selections or a list of individual selections, it depends on the implementation you end up using.

    In the case of the multi-select dropdown, ensure the name attribute includes “[]” at the end or you will only get the last selected element instead of an array of selected data. I imagine you would still want to somehow convert this data into a shortcode that displays the results. How this is done depends on the format the shortcode requires its data. It’s going to be a list of some sort I imagine, so you’d loop through the array of data with foreach(){} to construct this list.

    Once you’ve constructed a complete shortcode string with the appropriate data listed, you can cause it to be executed with something like echo do_shortcode('[shortcode data="option1,option2,option3"]').

    Of course you cannot put such a statement inside of page content like you would a normal static shortcode. If the shortcode’s output is complete enough, you wouldn’t need surrounding content, or it’s minimal. Thus you could generate a complete page of content through a custom page template. It doesn’t even need to use the usual content, it could all be generated by a combination of PHP and shortcode.

    The page you add based on this template would be the target of the form’s action attribute. All the code needed to process the form data into a shortcode and display the results is accomplished by the template code. If this page also has the form, then the action attribute can be empty. If so, the entire data processing portion should be wrapped in a conditional that only executes when there is data to process, otherwise you get various undefined this or that errors when the page first loads.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Displaying a filterable/sortable information database’ is closed to new replies.