Support » Plugin: The Events Calendar » Get the category name to customize css (add background)

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi,
    I’m trying to customize this great plugin and color the events by categories.
    I’ve done with the titles in table and list view according to http://tri.be/coloring-your-category-events/.
    I have also added the list of used categories in th top of the page. What I’m going do now is to customize the background for every category in that list. The problem is I do not know how to add the appropriate class for that (class=”cat_nameoftehcategory”).

    This is the code for the category list:

    <?php //***Add the list of categories ***
    		$terms = get_terms("tribe_events_cat");
     		$count = count($terms);
     		if ( $count > 0 ){
     		    echo "<ul class='EventCat'>";
     		    foreach ( $terms as $term ) {
     		     echo "<li><a class='" . $cat . "' href='http://mywebsite.com/events/category/" . $term->slug . "'>" . $term->name . "</a></li>";
    
     		    }
     		    echo "</ul>";
     		}
    	?>

    I tryed that:
    echo "<li><a class='" . $cat . "' href='http://mywebsite.com/events/category/" . $term->slug . "'>" . $term->name . "</a></li>";

    But it does not work. How can I get the name for the category to put it in the class?

    Why don’t you get The Events Calendar Category Colors plugin? I wrote it to do exactly as you want.

    Andy, thank you!
    I missed the information that your plugin can hide the categories while gridview. I played around and finished that staff. Now everything works like a magic.

    Not sure what you mean by hiding categories while in grid view. But I’m glad you got it working.

    Well, I mean the Legend Superpowers. When I ckick one category all th others become almost invisible (=hidden).
    Sorry for my English:)

    Podsolnuh, it sounds like everything is working for you. Can we consider your problem solved?

    Yes. Thanks.

    Plugin Author Rob La Gatta

    (@roblagatta)

    Thanks for helping get this one resolved, Andy! Most appreciated as always. Going to close this one out per the last clarification there.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Get the category name to customize css (add background)’ is closed to new replies.