• Hello,

    What I would like to do is for the post of the event to appear as a normal post within the loop on the main page…

    Is it possible? Furthermore, is it possible with using functions.php, or do I need to bash index.php on its head?

    No real urgency here, so take your time answering this.

    https://wordpress.org/plugins/am-events/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Atte Moisio

    (@moisture)

    Hi,

    Sure it is possible. Add the following to functions.php

    add_filter( 'pre_get_posts', 'am_events_get_posts' );
    function am_events_get_posts( $query ) {
    
    	if ( is_home() && $query->is_main_query() )
    		$query->set( 'post_type', array( 'post', 'am_event' ) );
    
    	return $query;
    }

    Explained here: http://justintadlock.com/archives/2010/02/02/showing-custom-post-types-on-your-home-blog-page

    You could also modify the post loop in index.php to achieve the same thing.

    Thread Starter midori

    (@midori)

    Wow, that was fast, and works well. Except for one thing: my “normal” posts have the category just above them, and not the AM Events posts (not even AM Event or Calendrier). Can you think/guess why?

    Here is the temporary setup I’m still tweaking…

    http://www.loutan.net/Ludiblog/

    Also, in the menu, the events appear in the right order, which is the one of happening. But on the page (more events), they appear in… a weird order.

    Anyhow, thank you so much for your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Trying to mix it to the loop…’ is closed to new replies.