• Resolved tiabohinc

    (@tiabohinc)


    I have a list of my categories on the left. Is there a way of indicating which category has been selected and is being displayed on the right?displayed? (highlight text, show text in a different color, etc.)

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Steven

    (@shazahm1hotmailcom)

    Add the following CSS to the theme’s custom CSS area found in the Customizer:

    .widget_cnw_categories li.cat-item.current-cat {
        background-color: #666;
        padding: 6px 12px;
    }
    
    .widget_cnw_categories li.current-cat a {
        color: #fff;
    }

    Tweak the colors as desired.

    I hope this helps; please let me know.

    Plugin Author Steven

    (@shazahm1hotmailcom)

    Oh, sorry I forget to mention what will change…

    This will make the currently active category have a background color with white text. I chose a grey color from the theme for the background color.

    Thread Starter tiabohinc

    (@tiabohinc)

    Thank you Steven,

    I added this CSS which sort of worked. It does highlight a category but does not change when I select a new category. (see https://1963mustangsreunion.com/class-members/)

    .widget_cnw_categories li.cat-item.current-cat {
    background-color: #2c651a;
    padding: 6px 12px;
    }

    .widget_cnw_categories li.current-cat a {
    color: #fff;
    }

    Plugin Author Steven

    (@shazahm1hotmailcom)

    Are you using any page caching on your site with a plugin or web host service?

    Thread Starter tiabohinc

    (@tiabohinc)

    No, I don’t think so (searched both plugins and host). It doesn’t seem to be working at all. ??

    Thread Starter tiabohinc

    (@tiabohinc)

    Yes, there is one in fact

    Plugin Author Steven

    (@shazahm1hotmailcom)

    Ok, all caching solutions provide some method of excluding pages. You need to exclude the /class-members/page. This way, a static page is not served, and the dynamic, active category class can be set, allowing the custom CSS to style the active category appropriately.

    I hope this helps; please let me know.

    Thread Starter tiabohinc

    (@tiabohinc)

    Thank you again. I excluded the page and the highlighted category is showing but it still does not change when a different category is selected.

    Plugin Author Steven

    (@shazahm1hotmailcom)

    OK, first, apologies; page caching is only one part of the issue. I had forgotten that the widgets utilize a technique called fragment caching. Because the widgets are cached, the active category class can not be set, so the CSS would not work.

    I’ll have to add a method either with a filter or a setting to disable the fragment cache for the widgets. I’m leaning toward a filter. I”ll work on this and release an update to the Widget Pack.

    Thread Starter tiabohinc

    (@tiabohinc)

    Darn, it there anything I can do in the meantime? Any idea when you’ll have time for an update?

    Plugin Author Steven

    (@shazahm1hotmailcom)

    RE: there anything I can do in the meantime?

    Sorry, no.

    RE: Any idea when you’ll have time for an update?

    Sorry, no ETA. I did work on this all afternoon, but unfortunately, I did not make much progress.

    Thread Starter tiabohinc

    (@tiabohinc)

    Would I be able to do this with “Enhanced Categories“? If so, can i get a credit for the widgets plugin and get this instead?

    Plugin Author Steven

    (@shazahm1hotmailcom)

    RE: Would I be able to do this with “Enhanced Categories“?

    Sorry, the Enhanced Categories add-on would not affect the Categories Widget’s use of the fragment cache optimization.

    I just pushed an update to the widgets, version 2.12. I’ve implemented a filter that can be hooked into to disable the fragment cache for the Categories widget.

    Install and activate the Code Snippets plugin. Add and activate a new code snippet with the following code to disable the Categories widget fragment cache:

    add_filter(
    	'Connections_Directory/Widget_Pack/Widget/Category/Use_Fragment_Cache',
    	'__return_false'
    );

    With this code snippet active and the CSS code I supplied earlier, the active category will be highlighted.

    I hope this helps; please let me know.

    Thread Starter tiabohinc

    (@tiabohinc)

    Yay, it works!! Thank you so much for your great customer service.

    Plugin Author Steven

    (@shazahm1hotmailcom)

    I just added this to the Widget Packs documentation in the FAQs section to help make sure this info is more widely available to others who may want to accomplish the same:

    I would genuinely appreciate a review if you have a moment, as they really make a difference.

    Thanks in advance for your time!

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Category Widget’ is closed to new replies.