0

I'm building a site using "theretailer" as a base and I cant figure out where to place code to get the loop to work for a custom post type "News"? the loop the theme uses is

                //$wp_query->query('posts_per_page=1'.'&paged='.$paged);

                $wp_query->query('posts_per_page='.get_option('posts_per_page').'&paged='.$paged);

                while ($wp_query->have_posts()) : $wp_query->the_post();
                ?>

                    <?php get_template_part( 'content', get_post_format() ); ?>             

                <?php endwhile; // end of the loop. ?>

                <?php 
                if (function_exists("emm_paginate")) {
                    emm_paginate();
                }               
                ?>

I'd like to keep the same loop set up so I can use the built in paginate function?

Thanks

1
  • 1
    Your use of the $wp_query object here is, unusual to say the least. Was there a particular reason you couldn't create a standard WP_Query object and loop, or use the pre_get_posts filter like most code?
    – Tom J Nowell
    Aug 16, 2015 at 3:36

1 Answer 1

0

To display 'news', you'll have to add it to your loop arguments:

$wp_query->query(
  'post_type' => 'news', 
  'posts_per_page='.get_option('posts_per_page').'&paged='.$paged
);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.