Support

Account

Home Forums Front-end Issues Loop Category with custom text field and add current-cat class Reply To: Loop Category with custom text field and add current-cat class

  • Thank you very much @hube2, the solution seems pretty easy, but I have a problem: in this way each div “item” has the name of each category and I predict every category name in my CSS.

    How instead I could transform your $ cat_class into a generic variable in the sense: I take the name of the current category (the one I’m seeing) and I associate it with a generic class (example: current-class) so in my CSS I could say: if the class is current-class then this is the rule.

    My CSS Code:

    
    .category-carousel .cat-icon{
       border:2px solid #0057ff;
       display:inline-block;
       height:50px;
       width:50px;
       line-height:46px;
       border-radius:100%;
       -webkit-border-radius:100%;
       -moz-border-radius:100%;
       -webkit-box-shadow: 1px 1px 10px -6px rgba(0,0,0,0.3);
       -moz-box-shadow: 1px 1px 10px -6px rgba(0,0,0,0.3);
       box-shadow: 1px 1px 10px -6px rgba(0,0,0,0.3);}
    
    /*Current Category*/
    .category-carousel .cat-icon.category-fotografia{
        border:2px solid #000;}
    

    Thanks a lot for the answer.