简体   繁体   中英

Wordpress URL Parameters

I have a 'Portfolio' page in Wordpress, that uses it's own custom Portfolio template. It displays all Categories currently.

What I want to happens is, when a user clicks on a Category link, I want it to display the same page, but with the Categories narrowed down, based on what the user clicked. I want it stay on the Portfolio page though...so the url would still be http://www.site.com/portfolio , or http://www.site.com/portfolio/the-category-they-clicked

Whats the best way to do this? If I pass the Category in url like above, will it still go to the Portfolio template? And do I access that Category param with $_GET? Or is there a more 'Wordpress' way of doing it?

There are several methods for doing this, you can have a category.php in your themes folder, which is the copy of portfolio-template, except that the query is modified to display the narrowed down results.

But I'm guessing you want something more elegant, so I suggest filtering categories using a jquery plugin like isotop you can see an example of this done here - Hope that helped.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM