OpenAgenda / wordpress

Display customizable OpenAgenda calendars on your WordPress site
GNU General Public License v2.0
3 stars 2 forks source link

Include multiple agendas on one page #30

Closed eur2 closed 11 months ago

eur2 commented 1 year ago

Hi, I'm trying to render a page with multiple openAgenda calendars. As openAgenda WP plugin is using one page by agenda/uid in Agendas post-type, I thought to use one extra classic page (outside Agendas) and getting each agenda page by using this kind of code:

<?php 
$id=47; 
$post = get_post($id); 
$content = apply_filters('the_content', $post->post_content); 
echo $content;  
?>  

I have put the shortcode [openagenda] in the agenda page content In my classic extra page (outside the agenda), I have this result: Cette page n’est pas une page agenda. Les événements s’afficheront peut-être de façon inattendue. Is there any way to make it working? What would be the best way to render multiple agendas on a page? Many thanks in advance

vincedubroeucq commented 1 year ago

Hello, The simplest way to display events from multiple agendas is by using multiple [openagenda_filter_preview uid="123" size="6"]shortcode, passing it the uids you need.

Or you could use a code like this :

$openagenda = new OpenAgenda( $uid, $atts, false, false );
ob_start();
include openagenda_get_template( 'preview-loop' );
$filter = ob_get_clean();

You could create a function with this code, and pass it the uids you need.

Hope that helps !