Wordpress Question - Categories
- Started
- Last post
- 11 Responses
- mg33
I know there are some highly skilled WP devs around here, so hoping someone can point me in the right direction for something I'm trying to customize.
I"m customizing a theme right now that includes a filter for the portfolio. The thing that I think is missing from this is a designation of what category is active. Note: I'm working on updating the :hover, :active, :focus aspects for those filter links, but what what i want to do is to display the name of the selected category below the filter, like:
Displaying: [category name]
Then have it update when someone switches categories.
Anyone got the skills to suggest how i would do this?
- mg330
Oops - here's the theme, on the portfolio page:
- dbloc0
are you within the loop?
- dbloc0
<?php single_cat_title(); ?>
- ideaist0
If you're looking for a capable (but customizable) search filter, I've had great luck with Ajax WP Query Search Filter -> http://wordpress.org/plugins/aja….
- Shit, http://wordpress.org… is the updated Plugin...ideaist
- mg330
dbloc - I'm not sure... I'm sort of picking apart this theme figuring out what can be customized. I just need to find a way to display the active category. I'll look into what you suggested above.
- nocomply0
I think dbloc is correct... if you're referring to a category archive age that is.
See http://codex.wordpress.org/Funct…
If you use that in your template file, it should auto-update with the name of the current category archive page being displayed.
- mg330
Thanks no comply. Only thing is, it's not an archive page being displayed. I want the name of the selected category in the filter to display below it. Like: Displaying [name of chosen category].
Since it's not a page, I'm not sure it's going to work. I messed around with it earlier today but no luck.
On a related note, I've tried setting the filters to have :hover :active and :focus states, so that an active filter displayed in a different color. But the CSS on those category filters is weird. Just can't get it to work.
- Nathan_Adams0
That's not a WP thing then. The filter looks like it's Isotope. So you'd either want to modify the filter script itself, or just tack on some extra jQuery somewhere to check what the current filter is on click, and update a div with the filter category name.
- Hint: the filter click function is on line 836 of custom.jsNathan_Adams
- mg330
Nathan,
Thanks for the tips. I've spent a couple hours trying to modify the isotope js and have not had any luck. I think there are just too many things that I have to have right to get it to work. In actuality, I'm a little bummed that the theme developer who made this theme, and who used isotope, didn't use anything to help show which category selection is active.
Er... I think I'm probably confusing you. I was using the code reference you made above in the comment to try and display the selected category in the filter, in a different color. Like this: http://www.adamkdean.co.uk/blog/…
That's what I'm annoyed by; that seems like a standard isotope feature, and the theme maker didn't make that work.
- Why don't you just ask someone to do it for you? Wills ave you time by sounds of it.fadein11
- Nathan_Adams0
You can't just add a removeClass and addClass to the click function?
That should get you your active class.
(Edit of lines 832 to 843)$('.filter a').click(function() {
$('.filter a').removeClass('active');
$(this).addClass('active');
var selector = $(this).attr('data-filter');
$container.isotope({
filter: selector
});
return false;
});You can use the text function to take it a step further and grab the contents of the clicked filter link and apply it to another div to get your Displaying: [category name]
- mg330
Hi Nathan,
Thanks for the help! I ended up stepping away from that theme for numerous reasons, including that issue. There were a few too many quirks with the mobile version that I didn't agree with and just didn't want to invest time in figuring out way more than the isotope filter issue.
Appreciate your help though!