“all in one” show events as regular posts – Cerca con Google

The one thing I really liked in “The Events Calendar” from Modern Tribe, Inc. is its ability to show its events in the flow of WordPress posts. Sadly its calendars cannot sync so people can’t just say “let’s subscribe to this nice calendar and see all those events in my calendar on my smartphone or at home”.

[cml_media_alt id='1155']All in one event calendar[/cml_media_alt]All-in-One Event Calendar on the contrary has everything I need for the forthcoming website of my parish “SS. Siro and Materno” in Desio. There is one thing it lacks that I find quite useful: the ability to show its events in the flow of WordPress posts.

As usual Google is your frient and searching for «”all in one” show events as regular posts» gave me quite some hints:

WordPress in this case demonstrates the infinite ductility of interpreted scripting languages like PHP.

All I had to do is to add this function in the PHP functions.php file:

add_filter( 'pre_get_posts', 'my_get_posts' );

function my_get_posts( $query ) {

    if ( is_home() && $query->is_main_query() )
        $query->set( 'post_type', array( 'post', 'ai1ec_event' ) );

    return $query;
}

In fact “All in one event calendar” create a new custom post type name ai1ec_event.

Now all I got to do is to find a nice magazine-like theme that fits the needs of my parish and looks sleek and shiny. You can’t believe how long it takes to find a satisfactory theme.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.