• Hello everyone. I am pretty new to WP and have learnt WP through Lynda.com tutorials, but that just teach he basics and not advance techniques.

    I am developing a WP website for an Electronic Safe manufacturer. I have managed to create a custom post-type called “safes” and a hierarchical taxonomy called “safe-type”. Under the “safe-type” I have created multiple categories, here are their slugs:
    – fire-resistant-series
    – laptop-series
    – large-series

    1. I need to create a template with a loop which displays all the top5 products categories created under the custom taxonomy “safe-type” which is linked with Custom Post Type ‘safes’

    2. I need to create a template with a loop which will display all products of a category created under custom taxonomy “safe-“type” which as mentioned linked to Custom Post Type ‘safes’.

    Please help I have been hunting for an answer under forum all day, but I still haven’t got an answer.

    I did however get a loop for displaying custom post type ‘safes’ if anyone wants they can use it.

    <?php
    /* Template Name: Safes */
    ?>
    <?php get_header(); the_post(); ?>
    
    <div id="content">
        <h1><?php the_title(); ?></h1>
    
        <?php $loop = new WP_Query( array( 'post_type' => 'safes', 'posts_per_page' => 10 ) ); ?>
    
        <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    
            <div class="pcontainer">
    		  <?php the_title( '<h4><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></h4>' ); ?>
              <?php the_post_thumbnail('full');?>
              <p class="price">Rs. <?php the_field('price');?></p>
            </div>
        <?php endwhile; ?>
    </div>
    
    <div id="sidebar"><?php get_sidebar(); ?></div>
    <?php get_footer();?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to add Loop under a template for custom taxonomy under a custom post type’ is closed to new replies.