WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Choose a color for a category (17 posts)

  1. whoaloic
    Member
    Posted 2 years ago #

    Hello!
    I choose a color for a category, but where the color is supposed to display.
    I thought the color would display in the widegt's calendar.
    Regards

    http://wordpress.org/extend/plugins/events-manager/

  2. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    you can use placeholders e.g. #_CATEGORYCOLOR

  3. whoaloic
    Member
    Posted 2 years ago #

    I'm sorry but I really don't know where to use the placeholder #_CATEGORYCOLOR so that the cell in the mini calendar get the color defined in the categories settings.
    The ideal would be to have a legend below the mini-calendar with the colors and their corresponding categories.
    Any way to do that,
    Regards

  4. agelonwl
    Member
    Posted 2 years ago #

    If you want to use it in the calendar then you could customize the calendar template and use the placeholder.

    http://wp-events-plugin.com/documentation/
    http://wp-events-plugin.com/tutorials/
    http://wp-events-plugin.com/documentation/using-template-files/

  5. Goodling
    Member
    Posted 2 years ago #

    I can't figure this out either! Would you be able to show us how to use #_CATEGORYCOLOR in the small calendar?

    Thank you thank you!

  6. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    within your formats, if you make an element e.g.

    <div style="background:#_CATEGORYCOLOR;">...

  7. Goodling
    Member
    Posted 2 years ago #

    Thanks Marcus. I'm just not sure where to put it? The small calendar in formats only allows for a title field and a separator. I would like to add the category color to the background of the day the event is on, on the small calendar...

    Thank you

  8. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    for that you'd have to edit the calendar template php file itself, which would require some php skills

    it's located within templates/templates/calendar-small.php

    if you copy that to yourcurrentthemefolder/plugins/events-manager/templates it'll override the default one.

  9. Goodling
    Member
    Posted 2 years ago #

    Thanks for your help Marcus! I think this might be a little out of my php league :)

  10. sohum
    Member
    Posted 2 years ago #

    Hi Marcus,

    I posted this question elsewhere, but am hoping by posting here, it will get a response?

    I've followed your instructions, as best I could, templates/templates/calendar-small.php, I've edited the following copy:

    <a href="<?php echo esc_url($cell_data['link']); ?>" title="<?php echo esc_attr($cell_data['link_title']); ?>" style="color:#_CATEGORYCOLOR;"><?php echo date('j',$cell_data['date']); ?></a>

    To read:

    <a href="<?php echo esc_url($cell_data['link']); ?>" title="<?php echo esc_attr($cell_data['link_title']); ?>" style="color:#_CATEGORYCOLOR;"><?php echo date('j',$cell_data['date']); ?></a>

    But so far can still only see orange as color displayed for events, despite having 3 catogries with different categories and the events listed belonging exclusively to one of the 3 categories.

    My site is: http://abbyravera.com/romeing/ and you can see the small calendar displayed towards the top of the page.

    Thank you so much for your help. hoping you can help!

  11. iamarogue
    Member
    Posted 2 years ago #

    I have the same question as sohum; I'd like an answer to his question too.

  12. agelonwl
    Member
    Posted 2 years ago #

    you can try something like

    Put this above the file -> global $EM_Event;
    style="color:<?php echo $EM_Event->output("#_CATEGORYCOLOR"); ?>"

  13. sohum
    Member
    Posted 2 years ago #

    Hi agelonwl,

    Thanks for your help!

    I tried to give your advice a shot, but think perhaps I placed the suggested code incorrectly because I'm still not seeing individual category colors showing on the small calendar...

    I'm also confused: should this not happen automatically (if you're asked to enter category colors during the category creation stage, shouldn't this show automatically)?

    The code for my calendar-small.php file looks like this:

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    Hoping there's something really small and silly that I'm missing :)

    Thanks again for your help!

  14. iamarogue
    Member
    Posted 2 years ago #

    I might be able to help and so might be able to clarify the discussion.

    I was trying to do the same thing as sohum, with no success, but with the following two exceptions:
    1. I was trying to edit the full calendar, not the small calendar
    2. I was trying to change the font (link) color, not the background

    At first I tried editing in Settings/Formats/Calendar, (Full calendar events format) but I must have been putting the wrong code in because I got nothing. So I tried to edit the template file and had the same results as sohum.

    I put this <li><a style="color:#_CATEGORYCOLOR;" href="#_EVENTURL">#_EVENTNAME</a></li> in the aforementioned field and got the right results.

    Anyways, I think the settings on the format page might be overriding the template edits, so perhaps if you add similar formatting to Small calendar title that might help. Otherwise there might be a bug...

  15. agelonwl
    Member
    Posted 2 years ago #

    @sohum

    can you paste again your template code?

  16. Keakan
    Member
    Posted 2 years ago #

    @iamarogue

    I want the same result as you.
    In which field did you put that code?

  17. Elysa
    Member
    Posted 2 years ago #

    @imarogue - thank you SO much for your post. Worked perfectly for me too! I might add that I agree with the above poster that if you choose a color for a category the event link color should correspond. So happy to have found your post! :-)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic