Custom post types, taxonomy in shortcode problems
-
I’m trying to make a short code that prints out a glimpse of all the custom post types in a custom taxonomy. As far as I can make out it should work, but it doesn’t.
I’m not a programmer and this has been put together trawling the web, forums and the codex.
It could be I’ve made a spelling mistake or missed a comma – but I can’t find the mistake.function wg_album($wguse){ extract(shortcode_atts( array('use' => 'work'), $wguse)); $args = array( 'post_type' => 'work_gallery', 'tax_query' => array( array( 'taxonomy' => 'use', 'field' => 'slug', 'terms' => $wguse ) ) ); $workpages = new WP_query($args); ob_start(); ?> <ul class="work-pages"> <?php foreach ($workpages as $wpage) { ?> <li> <a href="<?php echo get_page_link( $wpage->ID ); //the permalink?>"> <?php echo get_the_post_thumbnail($wpage->ID)//the featured image?> <h3><?php echo $wpage -> post_title ; ?></h3> <p> <?php echo $wpage -> post_excerpt ; ?></p> </a> </li> <?php } ?> </ul> <?php return ob_get_clean(); }
Please help
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Custom post types, taxonomy in shortcode problems’ is closed to new replies.