Code to insert widget into page HTML?

Support for the WordPress Calendar plugin
jessicaperry
Posts: 1
Joined: Mon Mar 17, 2014 3:33 pm

Code to insert widget into page HTML?

Unread post by jessicaperry » Mon Mar 17, 2014 3:42 pm

I'd like to insert the widget code for events into the HTML of my home page. Do you have code to do this? I tried <?php echo upcoming_events(); ?> after reading through the FAQs, but that doesn't work.

Thanks so very much!

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

Re: Code to insert widget into page HTML?

Unread post by Kieran » Tue Mar 18, 2014 12:51 pm

That certainly should work, assuming of course you have any events upcoming in the first place - make sure that for the time period defined on the calendar options page you have an event happening within that frame.

peterf
Posts: 1
Joined: Sat Apr 12, 2014 11:13 am

Re: Code to insert widget into page HTML?

Unread post by peterf » Sat Apr 12, 2014 11:20 am

I tried entering that code in a test page (in Text tab), and Updating the page. Refreshing the page, the code had been changed to &nbsp;
The Editor doesn't seem to like embedded php code :(

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

Re: Code to insert widget into page HTML?

Unread post by Kieran » Mon Apr 14, 2014 9:39 am

Ah, so you can't enter that into a WordPress page - my instructions assumed a page in your theme, hand coded in PHP/HTML. To add upcoming events in a WordPress page you'll want to add the following text

Code: Select all

{UPCOMING_EVENTS}

wxmmoz
Posts: 6
Joined: Mon Apr 21, 2014 8:45 am

Re: Code to insert widget into page HTML?

Unread post by wxmmoz » Mon Apr 21, 2014 8:49 am

Kieran wrote:Ah, so you can't enter that into a WordPress page - my instructions assumed a page in your theme, hand coded in PHP/HTML. To add upcoming events in a WordPress page you'll want to add the following text

Code: Select all

{UPCOMING_EVENTS}
Any way of doing this for selected categories only?

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

Re: Code to insert widget into page HTML?

Unread post by Kieran » Tue Apr 22, 2014 10:51 am

Yes

Code: Select all

{UPCOMING_EVENTS;1}
Where 1 is the category ID

wxmmoz
Posts: 6
Joined: Mon Apr 21, 2014 8:45 am

Re: Code to insert widget into page HTML?

Unread post by wxmmoz » Tue Apr 22, 2014 1:24 pm

Thanks. One more thing.

Is it possible to do

Code: Select all

<echo upcoming_events(2); ?>
So it shows categories 2 and 5 for example?

This doesn't work...

Code: Select all

<echo upcoming_events(2,5); ?>

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

Re: Code to insert widget into page HTML?

Unread post by Kieran » Tue Apr 22, 2014 2:15 pm

You'll want

Code: Select all

<?php echo upcoming_events('2,5'); ?>
Note yea the single quotes :)

wxmmoz
Posts: 6
Joined: Mon Apr 21, 2014 8:45 am

Re: Code to insert widget into page HTML?

Unread post by wxmmoz » Tue Apr 22, 2014 2:22 pm

Thanks ever so much. Just started on Wordpress for the Scouts and this is just what I needed to make my site work.

wxmmoz
Posts: 6
Joined: Mon Apr 21, 2014 8:45 am

Re: Code to insert widget into page HTML?

Unread post by wxmmoz » Wed Apr 23, 2014 10:05 am

Sorry, one last question...

Any way of making the 'upcoming events' widget on my front page (www.clwydscouts.org.uk) have a white background and padding so it looks like the twitter widget?

The category colours on the orange background is a bit of a clash! ;)

Ta!

Post Reply