Support » Plugin: WordPress Infinite Scroll - Ajax Load More » Best way to exclude password protected posts via ALM shortcode?

  • Resolved vulpixie

    (@vulpixie)



    Tried using the custom_args parameter but it doesn’t seem to be working.

          <?php 
            echo do_shortcode('[ajax_load_more button_label="Load More Posts" images_loaded="true" post_type="post" posts_per_page="8" max_pages="0" repeater="default" scroll="false" transition="fade" css_classes="hide" custom_args="has_password:true" ]');
          ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author dcooney

    (@dcooney)

    Good question and you are right, it doesn’t work on custom_args. Likely because has_password requires a boolean and custom_args are passed as string vars.

    I was able to solve this by using the alm_modify_query_args filter.

    function my_custom_alm_modify_query_args( $args, $page ) {
       // $args = current ajax load more $args
       // $page = current page slug
       
       if($page === 'my-page-slug'){
          $args['has_password'] = false;
       }
       
       return $args;
    }
    add_filter( 'alm_modify_query_args', 'my_custom_alm_modify_query_args', 10, 2);

    Let me know if this is possible for you.

    CHeers,

    Works perfectly!! Thanks @dcooney!

    Plugin Author dcooney

    (@dcooney)

    Woohoo! Good to hear!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Best way to exclude password protected posts via ALM shortcode?’ is closed to new replies.