WordPress custom post between every five posts

custom post

I’m trying to figure out how in the best way to accomplish what the image show.
I’ve been trying with modulus to do a if/else, but since the custom post is also a post there will be duplicates. I’m thinking about creating 2 custom queries, one with all the ordinary posts and one with the custom post, but that will make it slower and it doesn’t seem like a good solution..

Here’s the code of home.php in the wp-contentthemesthemehome.php

get_header(); ?>

<div id="main" class="site-main" role="main">

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

        <div id="posts" <?php hive_blog_class( 'archive__grid  grid  masonry' ); ?>>
            <?php /* Start the Loop */
            while ( have_posts() ) : the_post();

                /* Include the Post-Format-specific template for the content.
                 * If you want to override this in a child theme, then include a file
                 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
                get_template_part( 'content', get_post_format() );

            endwhile; ?>

        <?php hive_paging_nav();
    else :
        get_template_part( 'content', 'none' );
    endif; ?>

</div><!-- #main -->

Read more here: WordPress custom post between every five posts

Leave a Reply

Your email address will not be published. Required fields are marked *