Welcome to W3 Relations, We are a Digital Service Provider Company with Over 3 Years of Experience. Our Services Are Graphics Design, Web Design, Web Development, Digital Marketing.
Doing foreach loop with custom taxonomy in WordPress in so simple. There is given an example bellow just follow the code and modify as your needs.
<?php global $post; $args = array( 'posts_per_page' => -1, 'post_type'=> 'project', 'orderby' => 'menu_order', 'order' => 'ASC' ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); $terms= get_the_terms($post->ID, 'project_categories' ); ?> <!-- Gallery Block --> <div class="gallery-block all mix optimization <?php foreach ($terms as $t) { echo $t->slug, ' ';} ?> media col-lg-4 col-md-6 col-sm-12"> <div class="inner-box"> <figure class="image-box"> <img src="<?php the_post_thumbnail_url();?>" alt=""> <!-- Overlay Box --> <div class="overlay-box"> <div class="overlay-inner"> <div class="content"> <a href="<?php the_post_thumbnail_url();?>" data-fancybox="gallery" data-caption="" class="icon flaticon-plus"></a> </div> </div> </div> </figure> <div class="lower-content"> <div class="title"><?php foreach ($terms as $t) { echo $t->name, ' ';} ?></div> <h5><a href="<?php the_permalink();?>"><?php the_title();?></a></h5> </div> </div> </div> <?php endforeach; wp_reset_query(); ?>
If you are not Expert in WordPress Development then don’t apply this code yourself. Hire someone who is expert in WordPress Development or Contact with Us
Submit Now