Disable archive in Wordpress -


i've run following problem. have custom post type named books , page named books. want output posts custom post type holds onto page named books.

i'm using following query:

        <?php         $args = array( 'post_type' => 'books');         $loop = new wp_query($args);         while ($loop->have_posts()) {             $loop->the_post();     ?>         <div <?php post_class('col-lg-5'); ?> id="post-<?php the_id(); ?>">             <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>             <?php the_content(); ?>         </div>     <?php         }     ?> 

problem is, keeps reverting archive.php, if choose books template. if change url /books2/ works fine, if use /books points me archive.php.

i've disabled has_archive arg in functions.php , don't know else do.

it's simple, don't want archive exist, instead want output custom posts on page.

try this, when registering custom post, rewrite post slug different name (other "books")

'rewrite' => array(    'slug' => __( 'book' )   ),  

add argument in $args array. , try.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -