• Resolved bjtalbot

    (@bjtalbot)


    Great plugin, I’m continuing to find it very useful. Could you tell me if there’s a way to change the default content for new Calendars?

    Right now I get this for every new Calendar, and I’d like to change this if possible (so I don’t have to modify it for every new Calendar in the future):

    <strong>[title]</strong>
    
    [when]
    [location]
    <div>[description]</div>
    [link newwindow="yes"]See more details[/link]

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Nick Young

    (@nickyoung87)

    Yeah you can use the filter simcal_default_event_template to change the default content.

    Here is how it is setup initially to give you an idea: https://github.com/sureswiftcapital/Simple-Calendar/blob/dev/includes/functions/shared.php#L275-L286

    Thread Starter bjtalbot

    (@bjtalbot)

    Awesome, so if I plunk that function into functions.php and edit to suit me, that will get me what I want?

    Thread Starter bjtalbot

    (@bjtalbot)

    Actually I must be missing something, because when I just plunk that code into functions.php, the site breaks (“currently unable to handle this request”).

    Thread Starter bjtalbot

    (@bjtalbot)

    I think I fixed it:

    add_filter( 'simcal_default_event_template', 'bjt_simcal_default_event_template' );
    function bjt_simcal_default_event_template() {
    	$content  = '<strong>' . '[title]' . '</strong>';
    	$content .= "\n\n";
    	$content .= '[when]' . "\n";
    	$content .= '[location]';
    	$content .= "\n";
    	$content .= '<div>' . '[description]' . '</div>';
    	$content .= "\n" . '<a href="https://www.google.com/calendar/render?cid=https://calendar.google.com/calendar/ical/xxxxx%40group.calendar.google.com/public/basic.ics" target="_blank" rel="noopener">SUBCRIBE</a>';
    	return apply_filters( 'bjt_simcal_default_event_template', $content );
    }
    Thread Starter bjtalbot

    (@bjtalbot)

    That “xxxxx” is where I want the Google Calendar ID to go, by the way — which is what I was asking about at the end of this thread.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Change default content for New Calendar’ is closed to new replies.