Okay,
Have the shortcode down. Only problem is, whether I use the shortcode or not, the above code gives me the latest posts of that taxonomy, regardless of what term I enter. Any thoughts?
Here is the code, shortcode and all:
function np_coupon_shortcode($atts) {
extract(shortcode_atts(array(
"mod" => 'lenovo-thinkpad-coupon-code-2'
), $atts));
$args=array(
'Models' => '$mod',
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => 1,
'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<p>Get the latest <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php echo strip_tags(get_the_term_list( $post->ID, 'Models', '', ', ', ' Coupon Code' )) ?></a>.</p>
<?php
endwhile;
}
wp_reset_query(); // Restore global post data stomped by the_post().
}
add_shortcode ('coup','np_coupon_shortcode');
This is the shortcode I am inserting into the post:
[coup mod="thinkpad-edge-coupon-code-2"]
I am using the correct slugs for the terms as well, but I've also tried using the term name to no avail.