Links do not work

Support for the WordPress Calendar plugin
explica
Posts: 2
Joined: Mon Mar 03, 2014 11:01 am

Links do not work

Unread post by explica » Mon Mar 03, 2014 11:06 am

Hi,

I create events, and they appear in the calendar, but when I click on the event it goes to http://www.apei.es/#

I want to make it go to a post link. Is it possible?

Thanks and regards,
Jorge.
www.apei.es

User avatar
Kieran
Posts: 2059
Joined: Sat May 26, 2007 1:55 pm
Location: London
Contact:

Re: Links do not work

Unread post by Kieran » Mon Mar 03, 2014 3:37 pm

Did you copy and paste the link to the post in the URL field when you created the event? Also is this the full page calendar you're talking about? There are no functional links on the sidebar calendar.

explica
Posts: 2
Joined: Mon Mar 03, 2014 11:01 am

Re: Links do not work

Unread post by explica » Mon Mar 03, 2014 3:51 pm

Yes, I copied the link in the Event link field before saving the event.

I uploaded an image. I mean if I click on that link, can I make it go to some URL?

Thanks,
J.
Attachments
Dibujo.jpg
Dibujo.jpg (16.22 KiB) Viewed 15419 times

User avatar
Kieran
Posts: 2059
Joined: Sat May 26, 2007 1:55 pm
Location: London
Contact:

Re: Links do not work

Unread post by Kieran » Mon Mar 03, 2014 5:35 pm

That's the sidebar calendar, so no, links are not going to work there. Only on the full page calendar will they work. For the time being at least.

DeBAAT
Posts: 4
Joined: Tue Apr 15, 2014 8:37 pm

Re: Links do not work

Unread post by DeBAAT » Tue Apr 15, 2014 8:44 pm

Links in the widget do work when the code for function "minical_draw_events()" is replaced with the following:

Code: Select all

// Used to create a hover will all a day's events in for minical
function minical_draw_events($events,$day_of_week = '')
{
  // We need to sort arrays of objects by time
  usort($events, "time_cmp");
  // Only show anything if there are events
  $output = '';
  if (count($events)) {
    // Setup the wrapper
	//$output = '<span class="calnk"><a href="#" style="background-color:#F6F79B;">'.$day_of_week.'<span>';
	$output = '<span class="calnk">';
    // Now process the events
    foreach($events as $event)
      {
		if ($event->event_link != '') {
			$linky = stripslashes($event->event_link); 
		} else {
			$linky = '#';
		}
		if ($event->event_time == '00:00:00') {
			$the_time = 'all day'; 
		} else { 
			$the_time = __('at ','calendar').date(get_option('time_format'), strtotime(stripslashes($event->event_time))); 
		}
		$output .= '<a href="'.$linky.'" style="background-color:#F6F79B;">'.$day_of_week.'<span>';
		$output .= '* <strong>'.$event->event_title.'</strong> '.$the_time.'<br />';
		$output .= '</span></a>';
      }
    // The tail
	//$output .= '</span></a></span>';
	$output .= '</span>';
  } else {
    $output .= $day_of_week;
  }
  return $output;
}

DeBAAT
Posts: 4
Joined: Tue Apr 15, 2014 8:37 pm

Re: Links do not work

Unread post by DeBAAT » Tue Apr 15, 2014 9:06 pm

Sorry, the following code is a bit more robust as it shows the day number for the first event and the '+' sign for consecutive events:

Code: Select all

// Used to create a hover will all a day's events in for minical
function minical_draw_events($events,$day_of_week = '')
{
  // We need to sort arrays of objects by time
  usort($events, "time_cmp");
  // Only show anything if there are events
  $output = '';
  [b]$day_to_show = $day_of_week;[/b]
  if (count($events)) {
    // Setup the wrapper
	//$output = '<span class="calnk"><a href="#" style="background-color:#F6F79B;">'.$day_of_week.'<span>';
	$output = '<span class="calnk">';
    // Now process the events
    foreach($events as $event)
      {
		if ($event->event_link != '') {
			$linky = stripslashes($event->event_link);
		} else {
			$linky = '#';
		}
		if ($event->event_time == '00:00:00') {
			$the_time = 'all day';
		} else {
			$the_time = __('at ','calendar').date(get_option('time_format'), strtotime(stripslashes($event->event_time)));
		}
		$output .= '<a href="'.$linky.'" style="background-color:#F6F79B;">'.[b]$day_to_show[/b].'<span>';
		$output .= '* <strong>'.$event->event_title.'</strong> '.$the_time.'<br />';
		$output .= '</span></a>';
		[b]$day_to_show = '+';[/b]
      }
    // The tail
	//$output .= '</span></a></span>';
	$output .= '</span>';
  } else {
    $output .= $day_of_week;
  }
  return $output;
}

aguycalled80
Posts: 1
Joined: Wed Jun 18, 2014 2:47 pm

Re: Links do not work

Unread post by aguycalled80 » Wed Jun 18, 2014 2:58 pm

I tried to implement your code DeBAAT, but I get an error.

Parse error: syntax error, unexpected '[' in /home/content/93/11890293/html/wp-content/plugins/calendar/calendar.php on line 2898

I looked through it to see if I could find anything missing or extra, but I'm not an expert by any stretch.

Are you able to look at this again to see if you can find the error?

DeBAAT
Posts: 4
Joined: Tue Apr 15, 2014 8:37 pm

Re: Links do not work

Unread post by DeBAAT » Thu Jun 19, 2014 6:21 am

Hai,
Sorry for the inconvenience.

I just compared my original code with the code shown above and there is a difference.
There are three lines different in using "$day_to_show", each indicated by a set of

Code: Select all

[b]
and

Code: Select all

[/b]
tags.

These are probably copied over unintentionally.
The code should work if you remove these tags.

jbood
Posts: 1
Joined: Mon Jul 28, 2014 10:33 pm

Re: Links do not work

Unread post by jbood » Mon Jul 28, 2014 10:35 pm

When I use that code, edited with the removed (all three sets) I get a syntax error at the final line 3113...

DeBAAT
Posts: 4
Joined: Tue Apr 15, 2014 8:37 pm

Re: Links do not work

Unread post by DeBAAT » Tue Jul 29, 2014 6:11 am

Sorry to hear that.

Maybe you can check the copied code again.
In my calendar.php file, the last line is at 3124 with the closing "?>" php tag.
Followed by an empty line 3125.

Post Reply