Support » Plugin: WordPress Ajax Load More and Infinite Scroll » [NSFW] Loading all categories, I need it to load only the category it’s on

  • Resolved katarinakety

    (@katarinakety)


    Loading all categories, I need it to load only the category it’s on.

    The post page shows all categories and infinity scroll, and that is cool.

    I have a problem when I click on a category. It shows all categories instead of just post of that category.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter katarinakety

    (@katarinakety)

    [cpt_ajax_load_more post_type=”post” template=”template-2″ grid=”2″ scroll=”true”]

    Plugin Author tushargohel

    (@tushargohel)

    Hi @katarinakety,

    The plugin provides a parameter to filter by a category, so you can try this shortcode and I hope it will work for you

    [cpt_ajax_load_more post_type=”post” template=”template-2″ grid=”2″ scroll=”true” category=”slug-of-categroy”]

    Best Regards,
    Tushar

    Thread Starter katarinakety

    (@katarinakety)

    @tushargohel Hello, thanks but no luck with that shortcode.

    You can see… https://vipvorobjev.com/blog/

    Plugin Author tushargohel

    (@tushargohel)

    Hi @katarinakety,

    It looks like you need an infinite scroll in the category(Archive) page.

    Using the below code you can load current category posts only with infinite scroll, and you can change the structure of the code as per the theme.

    archive.php

    <?php 
    // archive.php
    get_header();
    ?>
    <div class="container">
    
    	<?php
    
    	$cat = get_query_var('cat');
    	$category = get_category ($cat);
    	$slug = $category->slug;
    	echo do_shortcode('[cpt_ajax_load_more post_type="post" template="template-2" grid="2" scroll="true" category="'.$slug.'"]');
    
    	?>	
    
    </div>
    <?php get_footer(); ?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[NSFW] Loading all categories, I need it to load only the category it’s on’ is closed to new replies.