Guest User

Untitled

a guest
Mar 17th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. add_filter( 'template_include', 'wpsites_cpt_archive_page_template', 99 );
  2. /**
  3. * @author Brad Dalton
  4. * @example http://wpsites.net/
  5. * @copyright 2014 WP Sites
  6. */
  7. function wpsites_cpt_archive_page_template( $template ) {
  8.  
  9. if ( is_post_type_archive(array( drzewa_formowane, pre_bonsai ) ) ) {
  10. $new_template = locate_template( array( 'archive-cpt.php' ) );
  11. if ( '' != $new_template ) {
  12. return $new_template ;
  13. }
  14. }
  15.  
  16. return $template;
  17. }
  18.  
  19. <div class="center">
  20. <?php
  21. // the query
  22. $the_query = new WP_Query( array(
  23. 'order' => 'asc',
  24. 'orderby' => 'name',
  25. 'post_status' => 'publish'
  26. )
  27. );
  28. ?>
  29. <?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
  30. <?php include 'product.php' ?>
  31. <?php endwhile; else : ?>
  32. <p>
  33. <?php esc_html_e( 'Sorry, no posts matched your criteria.' ); ?>
  34. </p>
  35. <?php endif; ?>
  36. </div>
Add Comment
Please, Sign In to add comment