Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.24 KB | None | 0 0
  1. /*--------------------------------------------------------------
  2. ## Footer FAQ Category Shortcode
  3. --------------------------------------------------------------*/
  4. function footer_faqs_cat_query() {
  5.     $args = array(
  6.         'posts_per_page'    => 4,
  7.         'post_type'         => 'faqs',
  8.         'cat'               => 53,
  9.         'post_status'       => 'publish'
  10.     );
  11.     $faqs_cat_query = new WP_Query( $args );
  12.     if ( $faqs_cat_query->have_posts() ) :
  13.         $html_out = '<ul class="recent-faqs-cat">';
  14.         while ( $faqs_cat_query->have_posts() ) :
  15.             $faqs_cat_query->the_post();
  16.        
  17.             $title = get_the_title();
  18.  
  19.             // Do stuff with each post here
  20.             $html_out .= '<li>';
  21.                 $html_out .= '<i class="icon-box-v3-icons ff-font-et-line icon-document fg-text-dark ffb-icon-1"></i>';
  22.                 $html_out .= '<a href="http://www.ankitdesigns.com/demo/hu/patient-resources/#downloads">' . $title . '</a>';
  23.  
  24.             $html_out .= '</li>';
  25.         endwhile;
  26.         $html_out .= '</ul>';
  27.     else : // No results
  28.         $html_out = "No FAQs Found.";
  29.     endif;
  30.     wp_reset_query();
  31.     return $html_out;
  32. }
  33.  
  34. add_shortcode( 'show_footer_faqs_cat', 'footer_faqs_cat_query' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement