Adding Events + events posts to my Featured posts feed

Hello I have a section on my home page that displays any posts that are in the category Featured. I added a category to the events + posts and want those to show up in the same feed but can't seem to get them to show up in the same feed. Can someone please help me with this? Bellow is my code that I am using to attempt this:

<?php

$category_id = 'featured';
$category_label = 'Featured';
// $post_type = ;

$count = 0;

$featured_args = array(
    // Arguments for your query.

	'post_type' => 'any',
	'category_name' => $category_id,
	'incsub_event-category' => $category_id,
	'tax_query' => array(
		array(
			'taxonomy' => 'category',
			'field'    => 'slug',
			'terms'    => array( 'featured' ),
		)
	)
);

// Custom query.
$featured_query = new WP_Query( $featured_args );

   <?php if( is_home() ){ ?>

    <div class="clearfix">
    	<div class="float-left">
		<?php echo '<h1 class="float-left">' . $category_label . '</h1>'; ?>
        </div>

        <section class="search float-right" style="max-width: 200px;">
            <form role="search" method="get" class="search-form" action="<?php bloginfo('home'); ?>">
                <div class="input-group">
                    <label>
                        <span class="screen-reader-text show-for-sr">Search for:</span>
                        <input class="search-field input-group-field" placeholder="Search..." value="" name="s" title="Search for:" type="search">
                    </label>
                    <div class="input-group-button">
                        <button class="search-submit button" type="submit">
                            <span class="show-for-sr">Search</span>
                            <span aria-hidden="true">
                                <i class="fi-magnifying-glass"></i>
                            </span>
                        </button>
                    </div>
                </div>
            </form>
        </section>

        <div class="float-right">
            <a href="#" class="social-btn button float-right"><i class="fi-social-instagram"></i></a>
            <a href="#" class="social-btn button float-right"><i class="fi-social-facebook"></i></a>
            <a href="#" class="social-btn button float-right"><i class="fi-social-twitter"></i></a>
        </div>
    </div>

    <?php } ?>

    <?php if( !is_home() ){ ?>
<?php echo '<h3>' . $category_label . '</h3>'; ?>

    <?php } ?>

	<div id="psad-featured-posts" class="orbit" role="region" aria-label="Featured Posts" data-orbit>
		<ul class="orbit-container">

        	<?php if( is_home() ){ ?>

                <button class="orbit-previous"><span class="show-for-sr">Previous Slide</span>◀︎</button>
                <button class="orbit-next"><span class="show-for-sr">Next Slide</span>▶︎</button>

            <?php } ?>

			<?php
			// Start looping over the query results.
			while ( $featured_query->have_posts() ) {

				$featured_query->the_post();

				// Contents of the queried post results go here.
				?>

                <li class="orbit-slide">
                    <article id="post-<?php the_ID(); ?>" <?php post_class('row'); ?> role="article">	

                    	<?php if ( has_post_thumbnail() ) : ?>

                            <section class="featured-image large-4 medium-4 columns float-left">
                                <a href="<?php the_permalink() ?>"><?php the_post_thumbnail('full'); ?></a>
                            </section>
                            <div class="featured-details large-8 medium-8 columns float-right">

                        <?php else : ?>

                        	<div class="featured-details large-12 medium-12 columns">

                        <?php endif; ?>

                            <header class="article-header">
                                <?php if( is_home() ){ ?><h2><?php } ?> <?php if( !is_home() ){ ?><h4><?php } ?><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a><?php if( is_home() ){ ?></h2><?php } ?> <?php if( !is_home() ){ ?></h4><?php } ?>
                            </header> <!-- end article header -->
                            <section class="entry-content" itemprop="articleBody">
                            	<?php get_template_part( 'parts/content', 'byline' ); ?>
                                <?php the_excerpt('<button class="tiny">' . __( 'Read more...', 'jointswp' ) . '</button>'); ?>
                            </section> <!-- end article section -->
                            <footer class="article-footer">
                                <p class="tags"><?php the_tags('<span class="tags-title">' . __('Tags:', 'jointstheme') . '</span> ', ', ', ''); ?></p>
                            </footer> <!-- end article footer -->
                        </div>
                    </article>
                </li>

			<?php } ?>

            <?php wp_reset_postdata(); // May be needed to move this before if statement close ?>

		</ul> <!-- end orbit-container -->

        <!-- Wrap this in another while loop with $featured_query -->
        <nav class="orbit-bullets">

        	<?php
			// Start looping over the query results.
			while ( $featured_query->have_posts() ) {

				$featured_query->the_post();

				// Contents of the queried post results go here.
				?>

        		<button class="" data-slide="<?php echo $count; ?>">
                	<span class="show-for-sr"><?php the_title(); ?></span>
                </button>

       			 <?php $count +=1; ?>

        	<?php } ?>

       	</nav>

        <?php wp_reset_postdata(); // May be needed to move this before if statement close ?>

	</div> <!-- end orbit -->

<?php } ?>

<?php $count = 0; ?>
  • Adam Czajczyk

    Hello Jonas,

    I hope you're well today and thank you for your question!

    Try replacing this part of your code

    $featured_args = array(
        // Arguments for your query.
    
    	'post_type' => 'any',
    	'category_name' => $category_id,
    	'incsub_event-category' => $category_id,
    	'tax_query' => array(
    		array(
    			'taxonomy' => 'category',
    			'field'    => 'slug',
    			'terms'    => array( 'featured' ),
    		)
    	)
    );

    with this one:

    $featured_args = array(
    	// Arguments for your query. 
    
    	'post_type' => 'incub_event', // * see note below
    	'tax_query' => array(
    				'relation' => 'AND',
    				array(
    					'taxonomy' => 'eab_events_category',
    					'field' => 'slug',
    					'terms' => array ('featured')
    				)
    			)
    	);

    A note: if you wish to use more than a single post type than use an array enlisting those post types. That shouldn't however bring any other posts than just events because the taxonomy is related strictly to events, therefore "insub_event" post type should be strictly specified here.

    Let me know please if this works for you.

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.