exclude front page categories plugin not working
#2 Updated by Matt Gold about 7 years ago
- Target version changed from Not tracked to 1.4
Yeah -- wow -- that was a pretty poor ticket, huh?
I just tested the "Front Page Category" plugin, and it does not appear to be working to me. When one activates the plugin and selects certain categories that should not appear on the front page, they show up there anyway through the categories widget. Maybe doing something wrong?
Here's a blog on which it is active:
#5 Updated by Dominic Giglio almost 7 years ago
I have created a test blog in my local dev env with multiple categories and a single post in each.
@matt, I believe you are misunderstanding how this plugin works. It DOES NOT exclude categories from the Categories Widget. It excludes POSTS from being displayed in the chronological list of posts in the main content area. For example, I created five categories with one post in each category. When I load the home page of my test blog I can see all five categories in the categories widget AND all five recent posts in the main content area. Then I enabled the Front Page Categories plugin and in its settings I set it to show ONLY categories one, two and five. When I reload the test blog's home page the main content area only displays the posts from those three categories. The posts from categories three and four are not displayed (again in the main content area). The categories widget is not affected by this plugin, it continues to display all five categories no matter what the settings of the Front Page Categories plugin are set to. I've attached a screenshot so you can see what I'm seeing.
There is no error or issue with this plugin. I reviewed the code and all it does is look at its database settings and then attaches an action to the 'pre_get_posts' hook that is called when WordPress runs the loop to output posts.
I believe this issue should be closed, as it is not an error and there is nothing to be "fixed".
#6 Updated by Matt Gold almost 7 years ago
- Status changed from Assigned to Reporter Feedback
Thanks, Dom -- that's really helpful. Can you do a quick check to see whether there is a plugin out there that does affect the category widget? I know I've used one on WordPress that did this before (and I thought it was this one), but that may have been five or six years ago.
#7 Updated by Dominic Giglio almost 7 years ago
@matt, I found this snippet of code that I could add to an mu-plugin file. It would add the ability to exclude categories from any sidebar since all it does is add the functionality to the existing WordPress categories widget. It would also remove the need for a user to enable another plugin.
@boone, What do you think?
#8 Updated by Boone Gorges almost 7 years ago
- Status changed from Reporter Feedback to Assigned
I don't have a problem with the snippet you linked to, Dom, but I would rather not have it in an mu-plugin so that everyone sees it. There are already a lot of widgets on the screen; adding another one that does something almost exactly like the built-in Categories widget will make things worse. (Also, the UI of having to enter comma-separated category IDs is a bit cumbersome.)
The following two options seems like the most viable routes:
1) Wrap the new widget stuff in a plugin wrapper, and allow users like Matt to activate it on their own blogs.
2) Deregister the WP core Categories widget and add our own version of that widget, which adds the ability to exclude categories.
In a perfect world, (2) would be cool, but it will take probably 10x the dev time as (1), and this seems to me to be a relatively unimportant issue in the grand schema of things. So I lean toward (1).
#9 Updated by Dominic Giglio almost 7 years ago
I was under the impression that this code just added category exclusion functionality to the existing WP provided category widget. I agree that forcing users to find out the cat ids in order to exclude them is not ideal. I was planning on looking into expanding this code to add check boxes to exclude categories.
I'll update again once I find out a little more.
#10 Updated by Dominic Giglio almost 7 years ago
Had a few minutes to get that code snippet into a topic branch and you are correct Boone, it doest instantiate a whole new widget (not that I didn't trust you).
Gonna mess around with it and see if I can integrate it's functionality into the default WP cats widget. I think it would be a nice addition, maybe even something I could get into core??? :-)
#13 Updated by Dominic Giglio over 6 years ago
I started writing a plugin that would remove the default categories widget and replace it with our own custom one that would enable the exclusion of categories. While looking through the plugin directory to grab a different piece of code, I came across this plugin which I didn't know was installed. I activated it and started testing it out. I think it's what you're looking for. Not only does it give you the ability to exclude certain categories, it also adds a lot of other functionality to the standard WordPress category features.
Would you please check it out and let me know if it solves this issue? I'd rather not write a new plugin if one already fits the bill.
#14 Updated by Matt Gold over 6 years ago
- Status changed from Assigned to Rejected
Great catch, Dom -- many thanks. I think that AVH Extended Categories does provide the functionality I was looking for (not that I can remember why I was looking for it after all this time. I vaguely remember that this ticket was instigated by a user query). At any rate, I'll close the ticket now, as this appears to be a non-issue on more than one level.