Get terms and taxonomy from current post within a loop
-
Hi ..
I’ve got this shortcode down below I use to get date, permalink, and some custom fields.
I was wondering If your plugin could get the term of each post that is returned ?here is my shortcode :
/* ############## LATEST FUNDARGERDIR ARCHIVE ############### */ // create shortcode to list latest fundargerdir add_shortcode( 'naestu-fundargerdir-archive', 'post_listing_shortcode' ); function post_listing_shortcode( $atts ) { ob_start(); $query = new WP_Query( array( 'post_type' => 'fundargerdir', 'NONE' => 'NONE', 'posts_per_page' => 10, 'order' => 'DESC', 'orderby' => 'date', ) ); if ( $query->have_posts() ) { ?> <div > <?php while ( $query->have_posts() ) : $query->the_post(); ?> <ul id="nyjustu_fundargerdir" class="nyjustu_10_fundargerdir" style="list-style: none; margin: 0; padding: 0;"> <li><a href="<?php the_permalink(); ?>"><span class="fundargerd_dagurinn" style="float: leaft; margin-right: 5px;"><?php echo get_the_date('d.m.Y'); ?> </span><span class="fundar_nr"> <?php /* echo get_post_meta( get_the_ID(), 'ptb_text_4', true ); */ ?> - </span> <?php echo get_post_meta( get_the_ID(), 'ptb_text_2', true ); ?></a></li> </ul> <?php endwhile; wp_reset_postdata(); ?> </div> <?php $myvariable = ob_get_clean(); return $myvariable; } }
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Get terms and taxonomy from current post within a loop’ is closed to new replies.