how to get the posts of a particular category from slug name when passing through url in wordpress?

I have a link with me. This is the link:

http://localhost/rajab/product-category/pvc-hose/

Read More

I have made a a category “PVC Hose” having slug name “pvc-hose” and displayed on a page. when i am clicking this category, it goes to a link as shown above.i wanted to display all the posts in this category on linked page. Can anyone say how to display it there.

Related posts

2 comments

  1. Simply create a taxonomy.php file in your root folder with the following code

    if ( have_posts() ) {
        while ( have_posts() ) {
            the_post();
    
            // Your markup and template tags like
           the_title();
           echo '</br>';
    
         }
    }
    
  2.           <li class="cbp-item houses cbp-l-grid-masonry-height1">
                                <a class="cbp-caption cbp-lightbox" data-title="PVC Air Hose" href="<?php bloginfo('template_url'); ?>/images/buiding/pvc/img1.jpg">
                                    <div class="cbp-caption-defaultWrap">
                                        <img src="<?php bloginfo('template_url'); ?>/images/buiding/pvc/img1.jpg" alt="">
                                    </div>
    
                                </a>
                                <h4><?php $data->post_title; ?></h4>
                        </li> 
    

    i wanted to repeat this code in the taxonomy file..I wanted to display not only the title and content but also featured image.

Comments are closed.