• Resolved loauc

    (@loauc)


    Hi,

    I’m trying to build a custom loop for retrieving 8 events from the category 133:

    $args = array( ‘post_type’ => ‘event’, ‘posts_per_page’ => 8, ‘category’ => 133, );

    But if I change 133 for the category slug ‘highlights’ or if I leave it blank I get the full list of posts, not only the posts in category 133.

    What I’m doing wrong?

    Thanks

    http://wordpress.org/extend/plugins/events-manager/

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

    have you tried something like

    $EM_Events = EM_Events::get( array('scope'=>'future','category'=>133) );
    foreach ( $EM_Events as $EM_Event ) {
     echo $EM_Event->output("#_EVENTNAME");
    }

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    i think it’s because you’re searching ‘category’ whereas we have a custom taxonomy, not post categories

    Thread Starter loauc

    (@loauc)

    Thanks,

    I did a loop with the following query:

    $args = array(
    	'post_type' => 'event',
    	'event-categories' => 'highlights',
    	'order' => 'DESC',
    	'posts_per_page' => 9,
    	'orderby' => 'event_start_date',
    	);
    $loop = new WP_Query( $args );

    It’s working great. Thanks.

    Felix

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to get posts from one category?’ is closed to new replies.