• wavesdream

    (@wavesdream)


    I have a custom post type namely “Slider” for a banner slideshow on the website. I run a custom loop query to get the slides from the custom post type. I have put the code on every template file (index, page, search, 404) and it works fine. The issue is only in archive.php page. The query loop does not work and consequently there is no slider in my archive page.

    Here is the query loop I use.

    <?php
    		$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
    		$loop = new WP_Query(array(
    		'post_type' => 'Slider',
    		'cat' => 'myslider-category-id',
    		'posts_per_page'=>-1,
    		'paged' => $paged,
    		'order'=>'DESC'
    		));
    		while ( $loop->have_posts() ) : $loop->the_post();
    ?>

    What is the wrong in my code to work on archive.php page? Please suggest.

  • The topic ‘Custom Post Type query not working in archive.php’ is closed to new replies.