• Resolved MichiL

    (@michil)


    Hi Events Manager community,

    is it possible to show all the events (future an past) on the main homepage, like normal blog articles?
    Thanks a lot in advance
    Michi

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi Michi,

    Yes it is possible you can follow this tutorial to show events as you like
    https://wp-events-plugin.com/documentation/placeholders/

    Just to give an idea in your case, you can place this shortcode on your homepage where you want to show events:

    [events_list scope="all" limit=5 pagination=1]

    To show in another style:

    https://wp-events-plugin.com/documentation/shortcodes/

    Please let me know if you have any questions.?

    Warm regards,

    • This reply was modified 3 years, 10 months ago by imranpixelite.
    Thread Starter MichiL

    (@michil)

    HI imranpixelite,
    thank you for your fast reply.
    The solution you discribed is perfectly for the content of single pages or articles.
    But I want, that all events are listet in the main area of my blog.
    If I released a new event it is also shown at the main are of my blog.
    My Blog is configured to show the latest articles, not a static site.
    I hope you know what I mean ??
    Thank you!! ??

    Hi MichiL,

    You can try?the code snippet below in the?functions.php?file?of your child theme:

    add_filter( 'pre_get_posts', 'my_get_posts' );
    function my_get_posts( $query ) {
    
    	if ( is_home() && false == $query->query_vars['suppress_filters'] )
    		$query->set( 'post_type', array( 'post', 'event' ) );
    	return $query;
    }
    Thread Starter MichiL

    (@michil)

    Hi imranpixelite,
    thanks again for your help, the solution you are talking about worked with a theme I used, several years ago, but not with the one I use now (Sydney). Do you have any other ideas?

    Thread Starter MichiL

    (@michil)

    This solution worked for me:

    function custom_event_posts( $query ) {
        if ( ! is_admin() && $query->is_main_query() ) {
            if ( $query->is_home() ) {
                $query->set( 'post_type', array ('post', 'event') );
                $query->set( 'posts_per_page', 10 );
            }
        }
    }
    add_action( 'pre_get_posts', 'custom_event_posts' );

    I added this code at the end of your functions.php of your theme
    Thanks for your help!!

    Hi MichiL,

    You’re welcome! Glad to hear that your problem is solved now.

    Have a nice day! ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘All events as articles on Homepage’ is closed to new replies.