Remove Link From Month View Single Events

Home Forums Calendar Products Events Calendar PRO Remove Link From Month View Single Events

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #999880
    Chris Chung
    Participant

    I know I am so close to figuring this out. I want to show events with certain categories on the calendar not as links, such as holidays or “office closed”. I am looking at the-events-calendar/src/views/month/single-event.php.

    I know to query specific events with taxonomy, tribe_events_cat, slug, & holiday

    I’m thinking of something like:

    //query events 
    //get_the_title
    //if category slug is 'holiday'  
    <h3 class="tribe-events-month-event-title entry-title summary"><?php echo $title ?></h3>
    //else
    <h3 class="tribe-events-month-event-title entry-title summary"><a href="<?php echo esc_url( $link ) ?>" class="url"><?php echo $title ?></a></h3>
    

    Thanks Again!

    • This topic was modified 8 years, 8 months ago by Chris Chung.
    • This topic was modified 8 years, 8 months ago by Chris Chung.
    • This topic was modified 8 years, 8 months ago by Chris Chung.
    #1000007
    George
    Participant

    Hey @cchung!

    Thanks for reaching out – just to be sure I understand your goals here, do you mean that you want events that are in certain categories to just appear as text in the Month View on your site?

    For example, if the event “Board Meeting” was somehow categorized “holiday” or “office closed”, then instead of looking like this:

    It would look like this:

    No I know the specific event would probably not be tagged “Holiday” or something, but it’s just an example of the display changes you’re trying to make when you say you “Don’t want it to appear as a link”.

    Is this right @cchung? If not, let me know exactly what design effect you’re trying to add when you say you “don’t want certain events to appear as links”.

    And finally, for now, if at all possible can you create a sample event or two on your site that are in the “Holiday” category and/or some that are in the “office closed” category? If this is a live site you can create these events far in the future and then just link me to that far-in-the-future month, so that the public is super-unlikely to actually see these test events…

    Thank you!
    George

    #1000024
    Chris Chung
    Participant

    Thanks for your response George.

    That is correct, if an event is categorized as “x” then echo the title otherwise echo the link/title.
    For example I am importing a csv with the US holidays. which I want to just be text.
    My idea was to declare a variable, initialize it to the tribe_events_cat, and then if else or switch case.

    Cheers,

    Chris

    #1000637
    George
    Participant

    Hey Chris,

    Thanks for verifying that – I asked about the specifics there because, based on what you’re trying to do, I’d actually recommend not messing with PHP at all here. In fact, you should just outright remove any and all custom PHP you have written for this customization so far. Make a backup of your customizations first, of course, then remove them all.

    The reason is because we can do this with CSS and that is much simpler. The basic plan is to first just remove background-colors on items in that category, as noted in this thread already, and then to use CSS’s “pointer-events” rule to totally disable the links there, so that it can’t be clicked by the user. We’ll also use CSS to keep the cursor the “default” cursor, instead of the “pointer” cursor that normally appears over links or something clickable.

    So, in essence, we’ll just be using CSS to sort-of “fake” the un-clickability of the link, while also genuinely making it un-clickable 🙂

    To do this, once you’ve cleared up that PHP you’ve tried thus far, just go to the very, very bottom of your theme’s style.css file, and add CSS like the following:


    #tribe-events-content div.tribe-events-category-board-mtg.hentry.vevent h3.entry-title a,
    #tribe-events-content div.tribe-events-category-board-mtg.hentry.vevent h3.entry-title a:hover {
    cursor: default !important;
    pointer-events: none !important;
    }

    .tribe-events-calendar .tribe-events-category-mtg {
    background: none !important;
    }

    Now, your site seems to have a ton of custom CSS related to The Events Calendar. There are many CSS rules and so if the code I shared above doesn’t work for you, then I’d recommend just playing around with the selectors a bit.

    Most importantly, perhaps, is to update the selectors to reflect the Category name you want. So, if these off days are categorized “Holiday” in reality, then instead of div.tribe-events-category-board-mtg.hentry.vevent use div.tribe-events-category-holiday.hentry.vevent and so on.

    I hope this helps!

    — George

    #1000925
    Chris Chung
    Participant

    Thanks a bunch George!

    I didn’t think about looking at the css, I will play around with it and let you know how it goes.

    – Chris

    #1000941
    Chris Chung
    Participant

    Worked! I and I set the div inside the category div to not display as well.

    Thanks again!

    – Chris

    #1001640
    George
    Participant

    Awesome!

    Thanks for the update Chris – be sure to keep backups of all custom code you write on your site 🙂

    Cheers,
    George

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Remove Link From Month View Single Events’ is closed to new replies.