Highlight Current Category

edited April 2018 in Blog
Hello!

I use the Filters (show only categories) as the main navigation for my portfolio website, for which I use the blog (not the portfolio post types). I really like the jQuery filtering inline, but unfortunately, this doesn't give the option to get back from one single post to the previous category selected (as being inline, there is no actual URL for it). I gave it up for the normal filtering that just takes you to a new page (website/category), this way I can give the user the option to get back to the category previously selected. But the problem is that in the code of the normal filtering, there is no .css class for the current category and I would like to highlight of course in the filters navigation the category he's currently in.

Example:
I use for navigation the Filters/Categories: ALL , WEB DESIGN, BRANDING, PRINTS, ILLUSTRATIONS...etc

1) - in jQuery filtering i have the <li class="current-cat"> - but of course, since it's done in-line, I'm missing an actual URL so I just can't give the users the option to get back to their selected category
image

2) - in normal filtering i don't have the "current-cat" .css class, but I have the URL
image

I would find it normal to be able to have the Current Category available as well on the normal filtering, so I can show the users the category they are in.

Any tweaks for this?

Thank you so much!


[LE]
Actually, I did found a tweak, for the jQuery Filtering - I just added the snippet to show the categories in the single post as well ... but if a user returns to the category "2"- let's say, by clicking on it..it just takes him to website/category2 - this making all other filters to filter in-line inside the "category2"..so practicallly, all other filters (cat3,4,5) will just filter inline inside "cat2" , even "ALL" will just filter inside "cat2" ..which makes it not such a good tweak - so my only solution is to use the normal filtering, goining to new pages for every click...but I just need to have the "current-category" class so I can highlight it :) - any ideas for this? Thank you!

Comments

  • Hi,
    sorry but this will not work for the cateogry pages. The jQuery filtering does not need category pages, if you are using cateogry pages then you do not need a live filter.
    thanks
  • edited April 2018
    Hi! Thank you for your reply! Not what I actually expected but I know I'masking a lot and realized it may be too much :) I understand what you are saying :) In more simple words, what I wanted was to have the jQuery filtering only on the homepage, which is using the index.php template - and when getting back from the single post (where i added the snippet to get the categories) to go to mysite/category and have a normal filtering, without jQuery (to use another template..because this way, the filtering will be done only in the category selected, not in all the categories) - but I know this is kind of imposible due to how the theme is built ..so I gave this up :) 

    I do have another question..on filtering with jQuery when the posts align they seem to tremble at the end of the animation - is there a way to get rid of this trembling? 

    Thank you!
  • This trembling you speak of could be just css loading from the JS sorting function.
    Maybe you have some plugins that make this happen, or this is just a browser issue.
    We cannot do anything about it unfortunatelly.
    thanks
Sign In or Register to comment.