[Plugin: All-in-One Event Calendar] How integrate ai1ev in page template?
-
How integrate ai1ev in page template? Which/How function i need to call to show calendar in custom place on page with needed event’s category?
Thank you!
https://www.ads-software.com/extend/plugins/all-in-one-event-calendar/
-
This is coming in v1.1
You will be able to use shortcodes as described here: https://trac.the-seed.ca/ticket/36I see
and calling calendar by php function instead of shortcode, will be to?Because shortcode int’s nor exactly what i needed: i what to integrate ai1ec in post template.
For example: i have several pages about some teachers and i need display their schedule on their page automatically without adding shotcode in post.
There are many ways for you to achieve it.
I will give you the first few that are on my mind:- Add category for each teacher and using shortcodes you can display a filtered by category calendar on each teacher’s page
- If you are a developer, you can adjust the plugin’s code yourself. The starting point is:
wp-content/plugins/all-in-one-event-calendar/app/controller/class-ai1ec-app-controller.php
line370
, function nameroute_request
- We offer paid support for custom modifications here: https://theseedstudio.com/get-supported/ You can hire us to implement your custom modification
Let me know if you have any questions.
Hi guys,
since I see in the roadmap that shortcode support has been moved to milestone 1.2 can I ask to alexvs or to anyone who knows it how to put the calendar in a custom template?I tried to declare a jquery selector in the settings page but it doesn’t work with my custom template (where I have several custom queries – could it be for this reason?) while it works like a charm on a blank test page where i put only a single div with the same selector declared.
Hope you can help me.
thanks anyway
keep up the great work!bye
CarloSorry for delay.
I have solved this task in such way:in header.php i call function ‘ai1ec_init();’
$calendar;
function ai1ec_init() {
global $ai1ec_settings,
$ai1ec_calendar_controller,
$ai1ec_events_controller, $calendar;
ob_start();
$ai1ec_calendar_controller->view();
$calendar = ob_get_contents();
ob_end_clean();
}this function init ai1ec-calendat: include java-scriptes and save html of calendar to global variable ‘$calendar’
then in page-template in needed point i call function to show calendar:
function show_ai1ec($desc=”)
{
global $calendar;
$content .=
‘<div id=”ai1ec-container” class=”ai1ec-container ‘.join(‘ ‘,get_init_ai1ec_class()).'”>’
. “<h3>Рассписание:</h3>”
. ‘<p class=”schedule_desc”>’ . $desc . ‘</p>’
. $calendar
. ‘</div>’;echo $content;
}Good luck
Hi Alexvs,
thank you so much for your reply.
I just need some clarification.When you say “in header.php i call function ‘ai1ec_init();'” you mean that I need to put
$calendar; function ai1ec_init() { global $ai1ec_settings, $ai1ec_calendar_controller, $ai1ec_events_controller, $calendar; ob_start(); $ai1ec_calendar_controller->view(); $calendar = ob_get_contents(); ob_end_clean(); }
in my function.php? and then call the function with:
add_action('wp_head', 'ai1ec_init');
also in my function.php?
What about:
function show_ai1ec($desc='') { global $calendar; $content .= '<div id="ai1ec-container" class="ai1ec-container '.join(' ',get_init_ai1ec_class()).'">' . "<h3>Рассписание:</h3>" . '<p class="schedule_desc">' . $desc . '</p>' . $calendar . '</div>'; echo $content; }
I need to put it in my template file?
Or I have to put it in the function.php and then callshow_ai1ec($desc='')
in my template file?
Thank you for your help.
I really appreciate that!Thanks
CarloHello
Yes, you can call init function in such way. In this case calendar will be init for all pages/posts.
Yes, put ‘function show_ai1ec(…’ in function.php and call from template
Good Luck
Hi Alexvs,
I’m trying to getting out of this calendar-trouble with your great tips but unfortunately I’m not so lucky!
I put this
in my functions.php
and then in the template file I call
show_ai1ec($desc='');
When I load the page I get
Fatal error: Call to undefined function get_init_ai1ec_class() in /web/htdocs/www.fddb.org/home/wp-content/themes/thematic-fddb/functions.php on line 1492
that is the line of my show_ai1ec($desc=”) function.
Any suggestion?
I’m making it wrong?Thanks again for your help.
Bye
CarloIt’s mu custom function, you can try without it:
function show_ai1ec($desc=”)
{
global $calendar;
$content .=
‘<div id=”ai1ec-container” class=”ai1ec-container “>’
. “<h3>Рассписание:</h3>”
. ‘<p class=”schedule_desc”>’ . $desc . ‘</p>’
. $calendar
. ‘</div>’;echo $content;
}or add function
function get_init_ai1ec_class() {
global $ai1ec_settings;$classes[] = ‘ai1ec-calendar’;
$action = $_REQUEST[‘action’];
if( ! in_array( $action, array( ‘ai1ec_month’, ‘ai1ec_agenda’, ‘ai1ec_term_filter’ ) ) )
$action = ‘ai1ec_’ . $ai1ec_settings->default_calendar_view;
$action = strtr( $action, ‘_’, ‘-‘ );
$action = preg_replace( ‘/^ai1ec-/’, ”, $action );$classes[] = “ai1ec-action-$action”;
if( ! $_REQUEST[‘ai1ec_month_offset’] && ! $_REQUEST[‘ai1ec_page_offset’] ) {
$classes[] = ‘ai1ec-today’;
}return $classes;
}Great Alexvs!
I’m really close to the end.
I finally get the calendar.The first time I get it, there were just the names of the events and their descriptions.
So I add in the <head> a call for the calendar.css and I get the right calendar layout.
Now I see that there are no effects on hover and when I click the “prev/next month/year” button on the top of the calendar they don’t work.
I think it’s just a matter of calling the right js scripts.
There’s a way to load them calling a function in the functions.php or I have to do it by myself.
Thanks again, I really appreciate your great support!
- The topic ‘[Plugin: All-in-One Event Calendar] How integrate ai1ev in page template?’ is closed to new replies.