I have a calendar working well but I want to remove the default links at the top but not sure what I should be changing in the Views section. Does anyone know what item I would be changing in the Calendar Views to remove those Year, Month, Week, Day links that appear at the top?

Another question, is why does the "Day" link open to the March 1st instead of the current day, how do I make this open to the current day?

Comments

rhymeswithcamera’s picture

To remove Year/Month/Week/Day links: In the view, visit each display (Year view, Month view, etc.). There's a section called "Attachment settings." The "Attach to:" field is probably linked to "Calendar page." Just uncheck for each display.

I had to test out your second question. It appears that the Week and Day links display in context of the current display - which is good to know. For example:

  • Display the March month calendar. If you click the Week link, it displays the full week of March 1st (Feb 27-Mar 5). If you click the Day link, it defaults to March 1st.
  • Display the February month calendar. The Week link displays week 6 (Jan 30-Feb 5); the Day link displays February 1st.
  • Now display week 6 and click the Day link. It displays the first day of that week - Jan 30.

Hmm, now that I understand what it's doing, I'm not so sure if it will be all that intuitive to end users. Thanks for asking a question I needed to know too.

cabplan’s picture

thanks rhymeswithcamera for your reply, so I was able to remove the Year, Week, and Day links off the Month view but when I tried to remove the Month link the calendar disappeared. So how would I also be able to remove the Monthlink. I changed all the "Attachment settings" in the Month View to No but the "Month" link still appears. Any more advice would be most appreciated.

Also if I were to re-activate the rest of the link (Year, Week, Day) is there any way to set it up so that when you click on Day, it actually goes to the current day instead of the first of the month? Just thinking for the future if someone does want those links on there.

rhymeswithcamera’s picture

Another approach you can take is to use CSS to hide the links. Something like this worked for me:

.view-content .calendar-calendar ul.links {
  display: none;
}

The other approach I mention not only removes the links, but it also removes the ability to display the Year view of the calendar, the Month view of the calendar, etc. - which may be more than you want. By hiding the links via CSS, you will still have all the displays available (Year, Month, Week, Day) - just without the 4 links at the top.

As for your second question: The default Calendar view is already set up to display a Month view based on the current date. The Day link functionality makes sense (but as I mentioned before, it may not be intuitive for end users). What you really want (I think) is a "Today" link, so you can always return to the current day/date. You can either create a new views display that basically mimics the Day view display or you can modify the Day view display. You will want to modify the granularity of the Date argument you're using. I'm assuming it's currently set to the default of "Month"; just change to "Day." You'll probably want to change the link label from "Day" to "Today" - but I'm not quite sure how to do that (yet). Hope that helps.

cabplan’s picture

The CSS worked perfect thx for your help.

middlenewman’s picture

The CSS option also worked for me, however I had to modify it to:
.view-header .calendar-links.inline {
display: none;
}

Also, then if you want those filters to be visible and link to the current day or week, what I did was create a block and link to the /calendar/day /calendar/week etc and it works perfect! Then I just apply that block to every calendar page.

olofbokedal’s picture

The best approach is to copy to calendar-main.tpl.php from the module folder to your theme, and simply override it.

Remove the line that says if (empty($block)) print theme('links', $links); and the links are gone.

/Olof Bokedal - COO at Odd Hill. Acquia Certified Developer.

amphioxus’s picture

I'm using version "calendar-7.x-3.x-dev" and I can't find anything that looks like your solution in the tpl.php files. In fact, I can't even find the file "calendar-main.tpl.php" in the theme folder of the calendar module, so something must have changed.

I can't figure out how to get rid of the links (except by setting the css attribute to "invisible", which I don't like because it still shows up in the source and might be annoying for accessibility issues.)

Does anyone know how to get rid of the "month | week | day | year" links in the newer version? Or am I missing something here....

Thanks!

raydenxxx’s picture

Same thing for me...
None of the solutions given in this topics works :(
Seems that something change.

For the moment, I just comment the line 40 in the theme.inc file in \sites\all\modules\calendar\theme

//$calendar_links['calendar calendar-'. $type] = array('title' => $title, 'href' => $href); // CETTE LIGNE A ÉTÉ COMMENTÉE POUR ENLEVER LES LIENS EN HAUT DU CALENDRIER

I will see when a better solution will be given by the module developper.

skh’s picture

In your template.php:

function MYTHEME_preprocess_calendar_main(&$vars) {
  unset($vars['calendar_links']);
}
nicodv’s picture

I´m with the same problem (the month, week, etc tabs)
I´ll try the proposed solutions shown in this thread tomorrow (I´ve been the whole day struggling with the tabs)
I have other question that maybe some of you can solve: do you know how to make every day in the calendar clickable? that is: if you click in one of the dates (it doesn´t have to contain an event) it opens the day view of the calendar.

If anyone can point me in the correct direction, i would be very appreciated.

Thanks in advance

nico

THE VERY LITTLE AGENCY

scotthooker’s picture

To remove the menu local task just disable the menu item for each page in the view. It's views generating the links not calendar.