Recent Posts Widget with Category Exclude
-
I just needed to modify the default WP_Widget_Recent_Posts widget so I could exclude specific Categories. I needed the Exclude fields to be editable in the Admin Widget so if the client adds new Categories they can manage the Widget themselves. This is probably better off as a Plug-in, but I just threw it in my theme’s functions.php for simplicity.
Here’s the code in case someone can use it, just drop it into your theme’s functions.php file (if I’ve made this needlessly complicated, I’d love to hear it, I could probably do this with a filter, but it would be hard-coded and not editable in the Admin):
[Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]
- The topic ‘Recent Posts Widget with Category Exclude’ is closed to new replies.