Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wow_theme_post_list_shortcode($atts){
- extract(shortcode_atts(array(
- 'count' => -1,
- 'post' => 'page'
- ), $atts));
- $q = new WP_Query(array(
- 'post_type' => $post,
- 'posts_per_page' => $count
- ));
- $list = '<ul>';
- 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 .= '<li><a href="'.esc_url(get_permalink()).'">'.get_the_title($idd).'</a></li>';
- endwhile;
- $list .= '</ul>';
- wp_reset_query();
- return $list;
- }
- add_shortcode('post_list', 'wow_theme_post_list_shortcode');
Advertisement
Add Comment
Please, Sign In to add comment