Build Your Own Business Website header image

Community Library Website Case Study – Part 30, Using a Query String in a URL

Difficulty Level -

Filed Under Topics - , , , ,

Listed Under Lesson Subjects -

Applies to - ,

Whoops, you've found some premium content!

Watch the opening clip of this video to preview it,
the full video is available to paid members.

This is the thirtieth in a series of live lessons on using WordPress and Thesis as a Content Management System (CMS). In this lesson we introduce how to include taxonomy queries in a URL. We’re going to use the native WordPress functionality to add a custom query inside the URLs for the searchable catalog menus. We show you an example of this type of query string from a previous search that we created for the Adult Non-Fiction category.

Video Transcript

So the next part of this is actually learning something brand new. And that brand new something we’re going to learn is about how to include taxonomy queries in a URL. Because you might have thought that… and to tell you the truth, I did think this at first as I was looking at this, was that when you would create a page for each one of these things and then put a custom query in for each one of these so that it queried our catalog items and it displayed all books that were in the nonfictional occasion that have the audience of adults. So that’s a complex query. It’s querying… the query identifies 2 taxonomies that have to be included, right? It’s not books and adults but it’s books that are for adults and it includes the custom post type.

And so… however, the good news is that we don’t actually have to do that. The good news is we’re going to be able to rely on WordPress’ native functionality for this putting a custom query inside of our URL. And I have an example here that I created just so that you can see this.

Here is adult nonfiction. This tab shows all books that are nonfiction that have audience of adults. And it doesn’t show anything else but catalog items that are for adults that are in the nonfiction category. Not only that but the holy grail that is pagination, the pagination works so you can scroll down to your 10 items or 20 items or whatever it was and then hit previous entries and scroll down for more or hit next entries. And you can go you know, all the way through these things. And the way we accomplish that is by creating this URL. It’s and then we put the query variables in here or the query string in which is ?for query and then audience = adult and location = nonfiction.

And so, if we come back over to the menus for a second, you can see this adult nonfiction, that’s what I put in here. It is

0 Comments… add one

Save $200 on Membership Now!

Start learning today for as little as
$0.82 PER DAY!
Subscription Options
0 comments… add one