Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. function show_product_pages() {
  2.  
  3. global $post;
  4. $child_pages_query_args = array(
  5. 'post_type' => 'page',
  6. 'post_parent' => $post->ID,
  7.  
  8. );
  9. $child_pages = new WP_Query( $child_pages_query_args );
  10.  
  11. if ( $child_pages->have_posts() ) :
  12. ?>
  13. <div class="columns product-archives">
  14. <?php
  15. while ( $child_pages->have_posts() ) : $child_pages->the_post();
  16. ?>
  17. <div class="col col-md-4">
  18. <a href="<?php the_permalink(); ?>">
  19. <div class="product_thumb"><?php the_post_thumbnail(array(240, 240)); ?></div>
  20. <h3 class="product_title"><?php the_title(); ?></h3>
  21. </a>
  22. <div class="product-desc"><?php the_content($post->ID); ?></div>
  23. <a class="cta-link" href="<?php the_permalink(); ?>">Learn More </a>
  24. </div>
  25. <?php endwhile; ?>
  26. </div>
  27. <?php endif;
  28. wp_reset_postdata();
  29. }
  30. add_shortcode('show_product_pages', 'show_product_pages');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement