Home › Forums › Calendar Products › Events Calendar PRO › Separate page for calendar view
- This topic has 14 replies, 3 voices, and was last updated 12 years, 11 months ago by
Michelle.
-
AuthorPosts
-
April 17, 2013 at 4:49 pm #46171
Michelle
ParticipantAt new.monadnockcenter.org, I am successfully using Events Calendar Pro in a number of different sidebars with different filters. This works great. I would like to have one page where the monthly calendar is displayed (no filters required). In reading the FAQ, I have come across:
“How can I embed the big calendar onto a given page?
This is doable using a PHP include. Simply add the following in any of your theme templates or via another function and it’ll display accordingly:
include(‘wp-content/plugins/the-events-calendar/views/gridview.php’);”
However, it is not clear really where this PHP should be added (what file of the theme) and also then how I can insert the calendar on a designated page. Thank you. Gordon PeeryApril 18, 2013 at 9:19 am #46232Jonah
ParticipantHi Gordon,
If you wanted to embed the calendar this way in a given page, you would want to put the code in your theme’s page.php template file and typically along with a page conditional (since page.php is used for all pages) like so:
if(is_page('your-page-slug') {
include(‘wp-content/plugins/the-events-calendar/views/gridview.php’);
}
Does that help?April 19, 2013 at 6:38 am #46297Michelle
ParticipantI must be doing something not quite right. I inserted:
if(is_page(‘calendar’) { include(‘wp-content/plugins/the-events-calendar/views/gridview.php’); } in the page php file, but the effect was that this text appeared at the top of every page. I am not that familiar with php,so I have pasted the entire file (it’s not that long) below so that you might suggest exactly where this would go. Also, I tried both the page name “calendar” but then also the post= (number), – I presume one of those is what you meant by the page slug.Thank you.
Gordon PeeryApril 19, 2013 at 7:55 am #46304Jonah
ParticipantHi Gordon,
Your code would only work if the page you we’re trying to include the calendar has the slug of ‘calendar’ – that’s how the conditional statement works. If you want to paste code or your page.php file, please post to http://snippi.com/ first and then paste the link to share here.
April 19, 2013 at 8:41 am #46313Michelle
ParticipantI have created a page called “calendar”, so to me it seems like I have done as you indicated.
http://new.monadnockcenter.org/calendar/
Here is the page.php code:
http://snippi.com/s/gbpt86fThank you.
April 19, 2013 at 1:00 pm #46375Jonah
ParticipantHi Gordon,
I don’t see the PHP include in your page.php – have you tried adding it?
April 20, 2013 at 6:41 am #46412Michelle
ParticipantYes, I had tried adding it, but it did not work – it just displayed the inserted text at the top of every page (see my earlier message). That is why (apparently) I need advise on exactly where within the php file to insert this (hence the snippet provided earlier). I have now added the code you provided back in, so you can see what happens. The site is not being promoted publicly yet so I can leave this for maybe 24 hours.
Thanks.
GordonApril 23, 2013 at 6:08 am #46602Michelle
ParticipantFollowing up on this Jonah, I presented this to a colleague who is php savvy. We have inserted the code into the page.php file. It is no longer displaying the code text on pages, but the calendar page is not showing anything. http://new.monadnockcenter.org/calendar/
April 23, 2013 at 10:44 am #46658Jonah
ParticipantHi Gordon,
I don’t know why it wouldn’t be showing without looking at the code. I need to see your page.php again… Can you please share it again?
April 23, 2013 at 4:00 pm #46695Michelle
Participanthttp://snippi.com/s/0rde2r9
This is in the parent theme.
The page on the site is:
http://new.monadnockcenter.org/calendar/
I have also tried the code in the child theme:
http://snippi.com/s/c9475vw
And it just shows the text of the inserted code at the bottom of each page.
And, I currently have the prefix <?php added (it was not in the original code you suggested, and I've tried it both ways – doesn't seem to make a difference)
Thanks,
GordonApril 24, 2013 at 11:06 am #46771Jonah
ParticipantHi Gordon,
Two things:
1. If you’re using a child theme, make sure you don’t also have a page.php file there because if you do, the site will be using that page.php instead of the parent theme. So you’d want to add the code to the child themes page.php (if it exists).
2. You need to wrap the code in PHP tags otherwise it won’t render: http://snippi.com/s/fc2t6qq
April 24, 2013 at 11:38 am #46781Michelle
ParticipantThere is a page.php file in the Child theme, so I added the code which you provided (with php wrap).
This results in the following error on the front end:
Parse error: syntax error, unexpected ‘{‘ in /home/monadn10/center/wp-content/themes/wp-bold109-child/page.php on line 31April 24, 2013 at 1:38 pm #46797James Kashetta
ParticipantGordon,
I was able to do exactly what you wanted to do by creating different pages. You can see the results here:http://xeroproject.com/RnRHotel/
What I did was create a page called page_live.php. and just kept the basic calendar page for the calendar view.
within my page.php i put the following code.if (is_page(‘live’)) {
include(TEMPLATEPATH.’/page_live.php’);
} else{
include(TEMPLATEPATH.’/page_default.php’);
}
?>WIthin page_live.php I included the list view and it worked like a charm.
April 25, 2013 at 9:31 am #46828Jonah
ParticipantHi Gordon,
You must not be putting in the PHP code correctly. Can you share your child theme page.php file now?
Thanks,
JonahApril 27, 2013 at 5:20 am #47001Michelle
ParticipantSuccess with the
jkash23686
solutionThanks everyone!
-
AuthorPosts
- The topic ‘Separate page for calendar view’ is closed to new replies.
