Want more features on Pastebin? Sign Up, it's FREE!
Guest

Email Adress Encoder - shortcodes.php

By: digitalCULT on Jan 18th, 2013  |  syntax: PHP  |  size: 0.92 KB  |  views: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. /**
  3.  * Display category posts via shortcode (shows the full post)
  4.  */
  5. function aaa_show_posts($atts){
  6.         extract(shortcode_atts(array(
  7.                 'category_id' => '',
  8.                 'category_name' => '',
  9.                 'posts' => 0,
  10.                 'order_by' => 'date',
  11.                 'order' => 'DESC',
  12.         ), $atts));
  13.  
  14.         $return_string = '';
  15.         query_posts(array('orderby' => $order_by, 'order' => $order, 'cat' => $category_id , 'category_name' => $category_name , 'showposts' => $posts));
  16.         if (have_posts()) :
  17.                 while (have_posts()) : the_post();
  18.                         $content = get_the_content();
  19.                         $content = apply_filters('the_content', $content);
  20.                         $content = str_replace(']]>', ']]>', $content);
  21.  
  22.                         $return_string .= '<div class="listed-post">';
  23.                         $return_string .= '<h2>'. get_the_title() .'</h2>';
  24.                         $return_string .= $content;
  25.                         $return_string .= '</div>';
  26.                 endwhile;
  27.         endif;
  28.  
  29.         wp_reset_query();
  30.         return $return_string;
  31. }
  32.  
  33. add_shortcode( 'show-posts', 'aaa_show_posts' );
  34. ?>
clone this paste RAW Paste Data