• Resolved siddheshsj

    (@siddheshsj)


    Hi,

    I have been using your plugin for most of my sites. It works really great. However, recently client requested that if parent category is set for posts than only those posts should appear on frontend and not the once which have its child category.
    Is it possible to pass parameter in shortcode ( eg. include_children=”false” ) ??
    This way or any other way since i tried it and its not working.

    Any help much appreciated,
    Thanks,
    Siddhesh

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    Hi @siddheshsj,
    Yes, you could use the alm_query_args filter to add custom query params.
    https://connekthq.com/plugins/ajax-load-more/docs/filter-hooks/#alm_query_args

    I’m not sure whether include_children is possible with a standard category query though.

    Thread Starter siddheshsj

    (@siddheshsj)

    Hi dcooney,

    Thanks for reply!! As you said include_children not working. Is there some other way to prevent child posts ??

    Plugin Author Darren Cooney

    (@dcooney)

    You could try to use the alm_query_args filter and use a category__in query.

    <?php
    function my_category_listing($args, $id){  
      $args['category__in'] = array(12, 13, 20);
      return $args; 
    }
    add_filter( 'alm_query_args_category_listing', 'my_category_listing', 10, 2);

    I read on Stack Overflow that category__in will not display posts that have child cats.

    Thread Starter siddheshsj

    (@siddheshsj)

    Hi decooney,

    Thanks it works like charm. Really appreciate!!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Prevent Child category posts to appear’ is closed to new replies.