• poetmichealace

    (@poetmichealace)


    Presently, I repost each event as normal WordPress post (linked to the event page) in order to make the events show on the homepage.

    I need help on how to add the events to main blog loop so it automatically appears alongside normal posts.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    Hello, this here would work to show posts and events

    //adds events to homepage
    function my_em_homepage_events( $query ) {
    	if ( $query->is_home() && empty($query->query_vars['suppress_filters']) )
    		$query->set( 'post_type', array( 'post', 'event' ) );
    	return $query;
    }
    add_filter( 'pre_get_posts', 'my_em_homepage_events' );
    Thread Starter poetmichealace

    (@poetmichealace)

    Thank you for the response.

    This should be added to the functions.php right?

    Thread Starter poetmichealace

    (@poetmichealace)

    This worked perfectly. Thank you.

    One more thing, how possible it is to order events according to the date of publication (via a shortcode or placeholder)?

    Thread Starter poetmichealace

    (@poetmichealace)

    This code worked to add events to the homepage but it has disrupted all post type shortcodes.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    Hello, what do you mean by this? A screenshot maybe

    This code worked to add events to the homepage but it has disrupted all post type shortcodes.

    All this code snippet should do is add event CPT (i.e. our events) posts to your home page listing, nothing else.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to add my Events to the Main Blog Loop’ is closed to new replies.