WordPress.org

Ready to get started?Download WordPress

Forums

Testimonials by Aihrus
[resolved] [Plugin: Testimonials Widget] Categories & Tags - Best Practices? (14 posts)

  1. brit77
    Member
    Posted 1 year ago #

    I've just started using this plugin, and so far it is truly excellent. Thank you!

    One thing regarding the way it works about which I could use some help - the use of categories and tags.

    So far, I've added a couple of testimonials to see how this plugin works, and I've assigned them a new 'Testimonials' category. Doing so added 'Testimonials' to my Categories widget and I assume other places that output a list of all categories.

    I don't really want the Testimonials categories I create to be visible; plus when I click the category link and go to mysitename.com/category/testimonials/, nothing is displayed. The previous testimonial plugin I tested also allowed for category assignment, but since the categories created seemed to be separate from post categories, this was not an issue. But I still prefer this plugin and am determined to make it work for me!

    I've found adding a line of CSS (.cat-item.cat-item-20 {display:none;} with 20 being the specific category id) removes the unwanted category from the widget listing, but I worry there may be some other instance this line of CSS doesn't cover. Or should this be sufficient?!

    So, any thoughts on if there is a better approach to categorizing testimonials? Or better ways to removing the display of a specific category? Should I use tags instead? Just hoping to get some input before I really dig in and start adding testimonial content. Thanks!

    http://wordpress.org/extend/plugins/testimonials-widget/

  2. Michael Cannon
    Member
    Plugin Author

    Posted 1 year ago #

    Ah, very good questions. I recently noticed the dead-end links as well on a bare system.

    The thing is, Testimonials Widget is a pretty pure custom post type plugin than most. This means, only the testimonial itself is "custom" and the tags and categories are relations via the default systems. As such, little issues like this one have crept up when themes or widgets don't check for the post_type being page or post before displaying data.

    Are you using the default categories widget to display categories?

    What's the URL to your website?

  3. brit77
    Member
    Posted 1 year ago #

    I am indeed using the default categories widget.

    My site is in the very early stages, still setting up the structure (haven't even uploaded the logo!); you can reach it here. I removed the "display:none" line from my CSS, so you can see the "testimonials" category link in the Categories widget in the footer.

    Also, my theme (DaVinici by Solostream) has a couple of templates I've implemented that list the categories. The Site Map page does display the "testimonials" category. But the Blog page does not, perhaps because it is not finding any posts?

    I was beginning to think that maybe addressing this with that short line of CSS code would suffice. But then I found one more instance that is not corrected with the CSS fix: in the sidebar, the bottom "Side Tabs" widget, under the Archive tab and Categories drop down. And using tags instead wouldn't be a solution in this instance either. Maybe I should find a better plugin to replace this one?!

    Thanks for looking into this, Michael!

  4. Michael Cannon
    Member
    Plugin Author

    Posted 1 year ago #

    Looks like you've gotten the CSS figured out for this.

    Are you sure you didn't by accident set a private post category to testimonials?

    For why the testimonials category is showing up in the first place, I'm not positive but look into again when back home in Taiwan next week.

  5. brit77
    Member
    Posted 1 year ago #

    Sorry, I forgot to comment out the CSS after testing out a few things! I've disabled the line of code again so you can see the default behavior.

    With display:none CSS active on the cat id, the Testimonials category does disappears from the footer Category and the Site Map, but it still does show up in the drop down menu in the bottom most sidebar widget, (under Archives). So, I guess I got the CSS about 90% figured out!

    I'm not sure how to use the same CSS trick for the dropdown. The Testimonials category code looks like: <option value="20" class="level-0">Testimonials</option>.

    I didn't know I could make post categories private! Is it done with a plugin? Could that be the solution I need?! Or would it also privatize the contents of the category?

  6. Michael Cannon
    Member
    Plugin Author

    Posted 1 year ago #

    For right now, there's no means to hide the testimonial category option via CSS. However, you might try using jQuery to remove that particular entry.

  7. katiewp
    Member
    Posted 1 year ago #

    This is a little late, but this is what I did to exclude testimonial categories from Category widget.

    Add this to your child theme's functions.php file:

    function exclude_widget_categories($args){
    $exclude = "8,10"; // The IDs of the excluding categories
    $args["exclude"] = $exclude;
    return $args;
    }
    add_filter("widget_categories_args","exclude_widget_categories");

    I also have a site map, so to exclude it from that, I looked for wp_list_categories.... in sitemap.php (or whatever page you want to edit).

    Before:

    <?php wp_list_categories('sort_column=name&optioncount=1&hierarchical=0&title_li='); ?>

    After:

    <?php wp_list_categories('sort_column=name&optioncount=1&hierarchical=0&title_li=&exclude=8,10'); ?>

    Make sure to replace the category IDs 8,10 with yours.

  8. Michael Cannon
    Member
    Plugin Author

    Posted 1 year ago #

    @Katie, thank you for these suggestions, I've added them to the FAQ. They show up in a future release.

  9. abmeeg
    Member
    Posted 1 year ago #

    This is a little late, but this is what I did to exclude testimonial categories from Category widget.

    Add this to your child theme's functions.php file:
    function exclude_widget_categories($args){
    $exclude = "8,10"; // The IDs of the excluding categories
    $args["exclude"] = $exclude;
    return $args;
    }
    add_filter("widget_categories_args","exclude_widget_categories");

    This fix does not work on my site. Perhaps it is now outdated?

  10. Michael Cannon
    Member
    Plugin Author

    Posted 1 year ago #

    What theme are you using?

  11. theressa
    Member
    Posted 1 year ago #

    Hi there, I am having the same trouble.
    I've created a category "Testimonials" which shows up under category list in my sidebar.
    If I click the testimonial category link, I am sent to the url
    http://mysite/category/testimonials/ which just says "Empty"
    I have found my list of testimonials actually live at the url
    http://mysite/testimonial/

    Why is that so? How come it doesn't show at http://mysite/category/testimonials/ like it should?

    I'm using The Mask theme if that helps?

    Thanks

  12. Michael Cannon
    Member
    Plugin Author

    Posted 1 year ago #

    For the URL http://mysite/category/testimonials/, that's the built-in WordPress archive. It won't list testimonials widget custom post type unless you've enabled them through something like FAQ 52.

    The URL http://mysite/testimonial/ is the testimonials widget default slug for it's own post entries.

  13. Michael Cannon
    Member
    Plugin Author

    Posted 1 year ago #

    For the URL http://mysite/category/testimonials/, that's the built-in WordPress archive. It won't list testimonials widget custom post type unless you've enabled them through something like FAQ 52.

    The URL http://mysite/testimonial/ is the testimonials widget default slug for it's own post entries.

  14. brit77
    Member
    Posted 9 months ago #

    Wow, thanks Katie! I successfully removed the testimonial category from the widget with your code for functions.php, and your sitemap code change lead me in the right direction to remove it (and some unwanted tags) from my site map page. Thank you for the easy fix!

    abmeeg, could it be the code you tried didn't work because you did not change the category id? In this snippet, replace 8,10 with the id number of your category: $exclude = "8,10";

    Hope that does it for you!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.