• Hi

    I want to make a website like avvo.com or martindale.com having list of lawyers. I am novice in wordpress. I know wordpress can build categories (example – cities like NY and California) and tags (example – areas of practice like divorce lawyers, accident lawyers). I can add list of lawyers (as blog posts) having cities as categories and tags as areas of practice. If I click on California, wordpress can show all lawyers in california with all areas of practice. If I click on divorce lawyers (tags), I will get all lawyers from all cities who practice in divorce law.

    My problem is this. I want that when I click on a city, it should show areas of practice. Once I click that area of practice, I should get a list of lawyers filtered by city AND area of practice.

    I can do so directly with search and filter plugin displayed on search page. But I dont want to do that directly. I want to display clickable cities first, then display of clickable areas of practice and then once an area of practice is clicked, I want to show list of lawyers.

    Is this possible with wordpress core? Or with a plugin? Please guide me in right direction.

    Regards
    Simranjeet

Viewing 2 replies - 1 through 2 (of 2 total)
  • Everything is possible but what you say on my eyes it would require custom coding for that type of form ( the idea of click 1 to show 2 to show 3 to show results ).

    As I understand though there’s a need for a plugin on this case, there are quite a few that extend the core search of WordPress even with filters etc but you’ll have to test them out to see which one fits your needs and if it’s possible to set it up as you would like since we are not talking about a simple filter list here.

    Moderator bcworkz

    (@bcworkz)

    If you set up your forms to send the right requests, this may not be too difficult to code.

    Maybe you start with a page using a custom template that lists all category terms. Clicking a city sends a request using for example the assigned city term ID 123 like so: example.com?cat=123

    That normally returns all posts with that term assigned. But you can alter that template to instead list all tags within that city, taken from posts in the city. Clicking a tag sends a request for example using the assigned tag term ID 456 like so: example.com?cat=123&tag_id=456

    That link will return all posts with both terms assigned. With many themes, those requests may all use the archive.php template, but you can name special templates that are used for certain situations, like only category requests. See Template Hierarchy.

    Additionally, a template could be coded to do one thing when a tag_id query var exists, such as list posts, otherwise do another, such as list tags. So most of the coding will be in the custom templates. A well constructed form will automatically generate the right request.

    BTW, it’s possible to add custom taxonomies that make more sense to users, such as “cities” and “practice”. It’s really just changing labels in a way, the logic does not change. You could go back and do this after you get your main filters working, but it would be a pain altering all the posts and code. I think it’s worth it in this case to learn how to add custom taxonomies before you even start entering any data. It’s always possible to write a script to change taxonomies after the fact, but easier to start off well to begin with.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Cross taxonomy or sorting options in wordpress’ is closed to new replies.