Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'template_include', 'wpsites_cpt_archive_page_template', 99 );
- /**
- * @author Brad Dalton
- * @example http://wpsites.net/
- * @copyright 2014 WP Sites
- */
- function wpsites_cpt_archive_page_template( $template ) {
- if ( is_post_type_archive(array( drzewa_formowane, pre_bonsai ) ) ) {
- $new_template = locate_template( array( 'archive-cpt.php' ) );
- if ( '' != $new_template ) {
- return $new_template ;
- }
- }
- return $template;
- }
- <div class="center">
- <?php
- // the query
- $the_query = new WP_Query( array(
- 'order' => 'asc',
- 'orderby' => 'name',
- 'post_status' => 'publish'
- )
- );
- ?>
- <?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
- <?php include 'product.php' ?>
- <?php endwhile; else : ?>
- <p>
- <?php esc_html_e( 'Sorry, no posts matched your criteria.' ); ?>
- </p>
- <?php endif; ?>
- </div>
Add Comment
Please, Sign In to add comment