How to display custom post type archive next to post archive on front-page.php? - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Wednesday, August 17, 2022

How to display custom post type archive next to post archive on front-page.php?

In Wordpress, where my front-page.php shows newest posts, i created custom post type which i want do display below normal posts, but i can't find how to display it in the front-page.php.

I create separate template - content-airdroppost.php for this custom post type, also create separate archive archive-airdrops.php. Can anyone help, how to build a query for displaying custom post type archive below normal post type?

Below is the code of front-page.php, where posts archive is displaying well, but i need custom post type archive. Thanks a lot!

<!-- Home content -->

<!-- ARTICLES AND NEWS archive-->
<div class="singlepost_headline" id="articles_section">
                <div class="singlepost_title_div">
                <h2 class="singlepost_title">Crypto researches and insights</h2>
                </div>
</div>


<div class="archive_container">
    <?php 
    if ( have_posts() ) {
        while( have_posts() ) {
            /*the_content();*/
            the_post();
            get_template_part('template-parts/content', 'archive'); 
    }
    }
    ?>

<?php previous_posts_link(); ?>
<?php next_posts_link(); ?>

</div>




<!-- AIRDROPS -->
<div class="singlepost_headline">
                <div class="singlepost_title_div">
                <h2 class="singlepost_title">Airdrops and giveaways</h2>
                </div>
</div>

<div class="archive_container">
   
    <!-- Custom post type  -->

</div>


source https://stackoverflow.com/questions/73377968/how-to-display-custom-post-type-archive-next-to-post-archive-on-front-page-php

No comments:

Post a Comment