In my blog I'm displaying lists of posts from every category I have in the homepage. I have a column for each category. The code is this:

$categories = array('3', '4', '5');

foreach ($categories as $category):
        <div class="four columns">
            <h2 id="first_column" class="category_title"><?php echo  get_the_category_by_ID($category); ?></h2>
        <div class="post-list">
global $post;
$args = array('numberposts' => '3', 'category' => $category, 'post_status' => array('publish', 'future' ));
$myposts = get_posts($args);

Now I'd need to display also posts occurring in the future. They are called events, I guess. I know I cannot use the wordpress status flag of the posts, because it has another purpose.

I also tried the Event Manager plugin, but I can't find any way to mix these custom posts with the normal ones. Any suggestion?

  • 1
    Have you created a custom post type? That isn't completely clear. – s_ha_dum Dec 12 '12 at 23:53
  • The Event Manager plugin creates a custom post type. I just have no clue how to display these posts mixed with the other ones. – Carlo Dec 13 '12 at 10:04

Add the post type parameter to your get_posts args.

$args = array(
  'numberposts' => '3', 
  'category' => $category, 
  'post_status' => array('publish', 'future' )
  'post_type' => array('post','slug-for-the-event-manager-post-type')

$myposts = get_posts($args);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.