Separate page for calendar view

Home Forums Calendar Products Events Calendar PRO Separate page for calendar view

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #46171
    Michelle
    Participant

    At 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 Peery

    #46232
    Jonah
    Participant

    Hi 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?

    #46297
    Michelle
    Participant

    I 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 Peery

    #46304
    Jonah
    Participant

    Hi 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.

    #46313
    Michelle
    Participant

    I 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/gbpt86f

    Thank you.

    #46375
    Jonah
    Participant

    Hi Gordon,

    I don’t see the PHP include in your page.php – have you tried adding it?

    #46412
    Michelle
    Participant

    Yes, 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.
    Gordon

    #46602
    Michelle
    Participant

    Following 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/

    #46658
    Jonah
    Participant

    Hi 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?

    #46695
    Michelle
    Participant

    http://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,
    Gordon

    #46771
    Jonah
    Participant

    Hi 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

    #46781
    Michelle
    Participant

    There 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 31

    #46797
    James Kashetta
    Participant

    Gordon,
    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.

    #46828
    Jonah
    Participant

    Hi Gordon,

    You must not be putting in the PHP code correctly. Can you share your child theme page.php file now?

    Thanks,
    Jonah

    #47001
    Michelle
    Participant

    Success with the
    jkash23686
    solution

    Thanks everyone!

Viewing 15 posts - 1 through 15 (of 15 total)
  • The topic ‘Separate page for calendar view’ is closed to new replies.