WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
[resolved] how to add different color text in calendar view for all subcategories (20 posts)

  1. arpitap
    Member
    Posted 3 years ago #

    Can anyone tell me how differentiate all the subcategories for root Events category using different color text for each category in Calendar view?

    Any help would be appreciated.

    Thanks in advance.

    Arpita

  2. Jeff Mann
    Member
    Posted 3 years ago #

    Amazing Event Calendar Plugin.

    Would love to know how to change the coloring for each category.

    I'm aware the #tec-content in events.css is customizable, but would love to assign different colors for each sub-event category.

  3. arpitap
    Member
    Posted 3 years ago #

    do you want same as below link? If yes, then I can give you instructions.

    I have solved this problem already.

    http://professionalplanner.com.au/?cat=949&eventDate=2010-11&eventDisplay=month

  4. Jeff Mann
    Member
    Posted 3 years ago #

    yes, that would be great! was this done in your events.css?

  5. Jeff Mann
    Member
    Posted 3 years ago #

    Just following up. Would you be able to to provide instructions to solve this? I'd be greatly appreciative. Thank you!

  6. charlieo
    Member
    Posted 3 years ago #

    I'm interested in this exact issue as well. Did you post the answer somewhere?

    Thanks!

  7. arpitap
    Member
    Posted 3 years ago #

    I will post the answer by end of this week for sure.

    I am running busy somewhat that's why not able to post it, but will do it by end of this week.

    Cheers,
    Arpita

  8. Jeff Mann
    Member
    Posted 3 years ago #

    Great! Thank you Arpita!

  9. charlieo
    Member
    Posted 3 years ago #

    Thanks arpitap! Look forward to it.

  10. arpitap
    Member
    Posted 3 years ago #

    I made changes in display_day function which is in table.php file.

    the file is under views folder in the plugin.

    at line 120:

    in place of

    <div id='event_<?php echo $eventId; ?>' class="tec-event
    <?php
    foreach((get_the_category()) as $category) {
    echo 'cat_' . $category->cat_nickname . ' '; //Arpita
    }
    ?>
    ">

    I replaced it with :

    <div id='event_<?php echo $eventId; ?>' class="tec-event
    <?php
    foreach((get_the_category()) as $category) {
    echo 'cat_' . $category->cat_name . ' ';
    }
    ?>
    ">
    <?php
    foreach((get_the_category()) as $category) {
    if($category->cat_name == 'Professional Planner Events')
    {
    ?>
    " style="color:#990066;"><?php the_title(); ?>
    <? }
    else if($category->cat_name == 'Media Partner Events')
    {
    ?>
    " style="color:#0099CC;"><?php the_title(); ?>
    <? }
    else if($category->cat_name == 'Industry Events')
    {
    ?>
    " style="color:#339933;"><?php the_title(); ?>
    <? }
    else if($category->cat_name == 'Webinars Events')
    {
    ?>
    " style="color:#CC0000;"><?php the_title(); ?>
    <? }

    }
    ?>

    basically what it is doing is getting sub category name and based on that subcategory, it will display different color title.

    I don't think this is proper way to do it but still it is working fine for me.
    Let me know if you need anymore help in this from me.

    Arpita

  11. charlieo
    Member
    Posted 3 years ago #

    Thank Arpita. Looks great. The only issue I have is that the code is duplicating my event entry. I only want my "Away-Games" to be a different color.
    Here's my code:
    <div id='event_<?php echo $eventId; ?>' class="tec-event
    <?php
    foreach((get_the_category()) as $category) {
    if($category->cat_name == 'Away-Game')
    {
    ?>
    " style="color:#999999;"><?php the_title(); ?>
    <? }

    }
    ?>

    **Any feedback would be great!**

  12. Jeff Mann
    Member
    Posted 3 years ago #

    Thanks arpitap! This did the trick! Much appreciated!!!

  13. TriangleAE
    Member
    Posted 3 years ago #

    I have four categories under Events

    Theatre, Music, Art, Dance

    But when I use the code it shows the --- " style="color:#123456;"> in addition to properly changing the color

    Am I missing something?

  14. Jeff Mann
    Member
    Posted 3 years ago #

    Here is the code I used based on @arpitap. Hopefully this helps you.

    <div id='event_<?php echo $eventId; ?>' class="tec-event
    <?php
    foreach((get_the_category()) as $category) {
    echo 'cat_' . $category->cat_name . ' ';
    }
    ?>
    ">
    <?php
    foreach((get_the_category()) as $category) {
    if($category->cat_name == 'Academic Events')
    {
    ?>
    <a href="<?php the_permalink(); ?>" style="color:#ff0000;"><?php the_title(); ?></a>
    <? }
    else if($category->cat_name == 'Art Events')
    {
    ?>
    <a href="<?php the_permalink(); ?>" style="color:#00cc1f;"><?php the_title(); ?></a>
    <? }
    else if($category->cat_name == 'Athletic Events')
    {
    ?>
    <a href="<?php the_permalink(); ?>" style="color:#ffaa00;"><?php the_title(); ?></a>
    <? }
    else if($category->cat_name == 'Corporate Events')
    {
    ?>
    <a href="<?php the_permalink(); ?>" style="color:#1100ff;"><?php the_title(); ?></a>
    <? }
    else if($category->cat_name == 'Alumni Events')
    {
    ?>
    <a href="<?php the_permalink(); ?>" style="color:#ea00ff;"><?php the_title(); ?></a>
    <? }
    
    }
    ?>
    	<div id='tooltip_<?php echo $eventId; ?>' class="tec-tooltip" style="display:none;">
  15. TriangleAE
    Member
    Posted 3 years ago #

    Thanks,

    I'll give it a shot.

    Have you had a problem with event list?

  16. Jeff Mann
    Member
    Posted 3 years ago #

    No. you?

  17. TriangleAE
    Member
    Posted 3 years ago #

    I have a problem with the event list and the comments section

    My theme has sidebar on left

    also have pro and pro beta version updates

    lost google rank when went pro, created new directory that 111 performing arts groups linked to

  18. TriangleAE
    Member
    Posted 3 years ago #

    Thanks,

    It's working well.

    I'm confused by some double lines

    http://triangleartsandentertainment.org/category/events/

  19. Jeff Mann
    Member
    Posted 3 years ago #

    if you're speaking of the double lines appearing at the top of dates 15-19 of Nov, it appears you have events trying to appear that aren't. I'm a noob coder, but from what I see, for example, Nov 16, "N.C. Museum of Art's Fall Film Series" and "November Events at the N.C. Museum of History" are in the code and trying to appear, but coming up blank. The border is still appearing. Other than that, not a good person to ask.

  20. TriangleAE
    Member
    Posted 3 years ago #

    I guess I need to add museums

    thanks for all the help

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic