Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function factorian_post_list( $atts, $content = null ){
- extract(shortcode_atts(array(
- 'posttype' => '',
- 'count' => '',
- ), $atts));
- $q = new WP_Query(array(
- 'post_type' => array($posttype),
- 'posts_per_page' => $count,
- 'order' => '',
- 'orderby' => '',
- ));
- $list = '<div class="custom_post_list"> ';
- while($q->have_posts()) : $q->the_post();
- $idd = get_the_ID;
- $custom_field = get_post_meta($idd, 'custom_field', true);
- $post_content = get_the_content();
- $list .= '<ul>';
- $list .= '<li><a href="'.get_permalink().'">'.get_the_title().'</a></li>';
- $list .= '</ul>';
- endwhile;
- $list .= '</div>';
- return $list;
- }
- add_shortcode('post_list', 'factorian_post_list');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement