categories – How to get specific number of category post on a page or category page?

Question

  <div class="ftcat-filtered">
        <h2 class="filtered-title"> All Product Reviews</h2>
                <div class="cat-paged">
        <div class="dl-grid">
                                                    <div class="dl-grid-row">
                <?php while (have_posts()) {
                    the_post();
                    $imagepath = wp_get_attachment_image_src(get_post_thumbnail_id());

                ?>
                        <div class="dl-grid-col-3">
        <div class="dl-card dl-card-style-33 cat-filtered-post">
            <div class="dl-card-content">
                <div class="dl-card-title">
                    <a href="<?php the_permalink(); ?>" class="dl-card-title-link"><?php the_title(); ?></a>
                </div>
            </div>
                                <div data-bg="<?php echo $imagepath[0]; ?> " class="dl-card-bg rocket-lazyload" style="background-image: url('<?php echo $imagepath[0]; ?>'); "></div>
                            <div class="dl-card-footer">
                <div class="dl-card-categories">
                    <a href="cafe/index.html"
                            class="dl-category dl-category-55">cafe</a>                    </div>
                <div class="dl-date-wrap">
                    <img width="20" height="19" src="<?php echo content_url('plugins/dl-grid-addons/public/images/icon-time.svg'); ?>" alt="date" class="dl-date-icon" data-lazy-src="<?php echo content_url('plugins/dl-grid-addons/public/images/icon-time.svg'); ?>"><noscript>img width="20" height="19" src="?php echo content_url('plugins/dl-grid-addons/public/images/icon-time.svg');?? " alt="date" class="dl-date-icon"></noscript>
                    <span class="dl-date"><?php echo get_the_date(); ?></span>
                </div>
            </div>
        </div>
    </div>   
<?php } ?>                   
                        

                                                        
                    
                       
                                                        
                                
                        
                                    </div>
                                                   
                                    
                                               
                                        
                                                </div>
                        </div>
                        
        <div class="cat-pagination-wrap">
        <?php wp_pagenavi(); ?>
        </div>
    </div>
                        </div>
                </div>
    </div>
    <?php get_footer(); ?>


1: When I click on “Home,” I want all posts in that category to appear on that page, as well as the categories below that in the sub-menu. My Header


2: When the post appears on the page, the post category (café is a category) should appear on the post block. If I am clicking on “Home,” then all posts related to “Home” and the sub-menu category should come, but if the post is coming from a sub-menu category, then the sub-menu category should print on the post block. In the second image, all posts are in different categories, but I am unable to print the categories. Post through while loop


Take a look at how I categorize the posts so that they can appear on the category page.Categories linked on posts

0
fuxia 1 month 2022-12-24T11:12:21-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse