
Email Adress Encoder - shortcodes.php
By:
digitalCULT on
Jan 18th, 2013 | syntax:
PHP | size: 0.92 KB | hits: 7 | expires: Never
<?php
/**
* Display category posts via shortcode (shows the full post)
*/
function aaa_show_posts($atts){
extract(shortcode_atts(array(
'category_id' => '',
'category_name' => '',
'posts' => 0,
'order_by' => 'date',
'order' => 'DESC',
), $atts));
$return_string = '';
query_posts(array('orderby' => $order_by, 'order' => $order, 'cat' => $category_id , 'category_name' => $category_name , 'showposts' => $posts));
if (have_posts()) :
while (have_posts()) : the_post();
$content = get_the_content();
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
$return_string .= '<div class="listed-post">';
$return_string .= '<h2>'. get_the_title() .'</h2>';
$return_string .= $content;
$return_string .= '</div>';
endwhile;
endif;
wp_reset_query();
return $return_string;
}
add_shortcode( 'show-posts', 'aaa_show_posts' );
?>