• Resolved burquidi

    (@burquidi)


    Hi,

    There was a thread about the hiding the Load More button, but it’s been marked as resolved so I decided not to post there. I’m basically running into the same problem. I’ve set the posts per page to 4 and only have 3 posts on the page. The button should be disabled or not visible, but it’s not. I’m also not seeing a “done” class on the button.

    Here’s the shortcode I am using on my template:

    [ajax_load_more post_type=”jobs” posts_per_page=”4″ scroll=”false” button_label=”Load More Positions”]

    Thanks!

    https://www.ads-software.com/plugins/ajax-load-more/

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

    (@dcooney)

    Hi,
    Yes your right, the issues seems to have re-appeared.
    I’ll try to fix this for the next release.

    Plugin Author Darren Cooney

    (@dcooney)

    So, After further research it appears as though the issue only presents itself if the total posts is equal to the posts_per_page parameter.

    In this instance, ALM doesn’t know that there are zero posts remaining so the button is active.

    If posts_per_page is greater than total posts the button will disable itself.

    At this point, there is nothing I can do to fix this because ALM just doesn’t know zero remain.

    If posts_per_page is greater than total posts the button will disable itself.

    With

    total posts

    you mean TOTAL posts of the site, not total posts as per the category we are querying right? As what I noticed is that if my query looks out for a category and this has 5 posts total and my posts_per_page says 6, the button won’t disable itself. Which means it counts TOTAL POSTS of the actual site not total posts of the query. Is there any solution?

    If my category has 5 posts and my posts_per_page has 6. The button won’t disabled itself. Therefore it doesn’t seem to be just the case that if the total posts is equal to the posts_per_page parameter and If posts_per_page is greater than total posts the button won’t disable itself if we are using a category. Literally, it looks like the query check it is only for the whole site and not specific to a query. e.g. for a category

    Plugin Author Darren Cooney

    (@dcooney)

    It does in all my examples. Must be an issue with your repeater or something

    This is my shortcode

    <?php echo do_shortcode(‘[ajax_load_more post_type=”page” category=”Content” posts_per_page=”6″ pause=”false” scroll=”false” button_label=”+ MORE CONTENT +” ]’); ?>

    The category content has only 5 posts attached to it.

    So the shortcode has more than the total posts in the category and the button should disabled itself. And it doesn’t.

    What has the repeater to do with that?

    Thanks man

    Any category I try I get the same result with the button not adding the .done.

    Maybe I need to add to better specify that when I click.. the button queries..doesn’t finds any..and it does add the .done class. But what If in my case, the plugins auto loads the posts on page load, and once the posts are loaded, the button should know if there anymore or not without the need to click to have 0 new results and finally have the .done class.

    Plugin Author Darren Cooney

    (@dcooney)

    If there is an html element it might cause the the issue because the JavaScript doesn’t actually know the amount of results returned. It counts the Dom elements.

    It counts the Dom elements vs The total elements of the category posts?

    Plugin Author Darren Cooney

    (@dcooney)

    I’m saying an error in your repeater template may cause the issue you are describing. The reason being the JavaScript does not know many posts are returned in the query, it only know the amount of times the repeater template was loaded.

    Can you not post your repeater?

    Ok my repeater has html, and it is what you see below. Unless you find an error which i miss and we can solve it, I was going to do another test. Count the total number of post in a category and do a check with js in the dom and see if these numbers matches or not in order to test what you said before.

    <?php
    global $post;
    ?>
    
    <div class="item needsclick  <?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; }?> col-xs-12
        <?php if( get_field('big') ) { ?>
            col-sm-8 col-md-8 col-lg-6
        <?php } else { ?>
            col-sm-4 col-md-4 col-lg-3
    	<?php } ?>"
    		data-client="<?php
    		foreach((get_the_category()) as $childcat) {
    			if (cat_is_ancestor_of(37, $childcat)) {
    				echo $childcat->cat_name;
    			}
    		}?>" data-agency="<?php
    		foreach((get_the_category()) as $childcat) {
    			if (cat_is_ancestor_of(36, $childcat)) {
    			 	echo $childcat->cat_name;
    			}
    		}?>" data-year="<?php
    		foreach((get_the_category()) as $childcat) {
    			if (cat_is_ancestor_of(38, $childcat)) {
    			    $Value= $childcat->cat_name;
    			    $str= ltrim ($Value, 'y');
    			    echo $str;
    			}
    		} ?>" data-skills="<?php
    		foreach((get_the_category()) as $childcat) {
    			if (cat_is_ancestor_of(45, $childcat)) {
    			    echo $childcat->cat_name;
    			}
    		}
    ?>">
    	<div class="cover hidden-xs"><p>Loading..</p></div>
    	<div class="thumbnail">
    	 <?php the_post_thumbnail('big', array( 'class'	=> "img-responsive")); ?>
    
    	<div class="caption hidden-xs">
    
    	    <p>
            <?php the_title(); ?>
    	    <br><?php
    	        foreach((get_the_category()) as $childcat) {
    	            if (cat_is_ancestor_of(37, $childcat)) {
    	                echo $childcat->cat_name;
    	            }
    	        }
            ?>
    	    </p>
    
    	</div>
    
    	<div class="wrapVideo">
                <div class="embed-responsive embed-responsive-16by9">
                    <span class="video" data-vimeoid='<?php
    					the_field("video"); ?>'>
    				</span>
                </div>
    			<div class="infoBox">
                        <ul class="hidden-xs options clearfix combo-filters">
    
    			            <li class="option-combo client">
    			            	 <span class="filter option-set" data-filter-group="client">
    
    			               <a id="filter-client-<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(37, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" href="#filter-client-<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(37, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" data-client="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(37, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>"
                                   data-agency="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(36, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>"
    			                    data-skills="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(45, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>"
    			                    data-year="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                        if (cat_is_ancestor_of(38, $childcat)) {
    			                            $Value= $childcat->cat_name;
    			                            $str= ltrim ($Value, 'y');
    			                            echo $str;
    			                        }
    			                    }
    			                    ?>" data-filter-value=".<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(37, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" class="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(37, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>"><span class="label label-info"><?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(37, $childcat)) {
    			                     echo $childcat->cat_name; }} ?></span></a> 
    
    			                </span>
    			            </li>
    
    			            <li class="option-combo skills">
    			            	<span class="filter option-set" data-filter-group="skills">
    
    			                <a id="filter-skills-<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(45, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" href="#filter-skills-<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(45, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" data-client="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(37, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>"
                                   data-agency="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(36, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" data-skills="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(45, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" data-year="<?php
    			                                foreach((get_the_category()) as $childcat) {
    			                                    if (cat_is_ancestor_of(38, $childcat)) {
    			                                        $Value= $childcat->cat_name;
    			                                        $str= ltrim ($Value, 'y');
    			                                        echo $str;
    			                                    }
    			                                }
    			                    ?>" data-filter-value=".<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(45, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" class="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(45, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>"><span class="label label-info"><?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(45, $childcat)) {
    			                     echo $childcat->cat_name; }} ?></span></a> 
    
    			                </span>
    			            </li>
    
    	            		<li class="option-combo agency">
    	            			<span class="filter option-set" data-filter-group="agency">
    
    			                <a id="filter-agency-<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(36, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" href="#filter-agency-<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(36, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" data-client="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(37, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" data-agency="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(36, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" data-year="<?php
    			                                foreach((get_the_category()) as $childcat) {
    			                                    if (cat_is_ancestor_of(38, $childcat)) {
    			                                        $Value= $childcat->cat_name;
    			                                        $str= ltrim ($Value, 'y');
    			                                        echo $str;
    			                                    }
    			                                }
    			                    ?>" data-filter-value=".<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(36, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" class="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(36, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>"><span class="label label-info"><?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(36, $childcat)) {
    			                     echo $childcat->cat_name; }} ?></span></a>
    			                </span>
    	            		</li>
    			            <li class="option-combo year">
    			            	<span class="filter option-set" data-filter-group="year">
    
    			                	<a id="filter-year-<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(38, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" href="#filter-year-<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(38, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" data-client="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(37, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" data-agency="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(36, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" data-year="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                        if (cat_is_ancestor_of(38, $childcat)) {
    			                            $Value= $childcat->cat_name;
    			                            $str= ltrim ($Value, 'y');
    			                            echo $str;
    			                        }
    			                    }
    			                    ?>" data-filter-value=".<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(38, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" class="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(38, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>"><span class="label label-info"><?php
    			                    foreach((get_the_category()) as $childcat) { if (cat_is_ancestor_of(38, $childcat)) {
    			                    $Value= $childcat->cat_name;
    			                    $str= ltrim ($Value, 'y');
    			                    echo $str; }} ?></span></a>
    			                </span>
    			            </li>
                		</ul>
    
               <hr>
                <p><?php echo the_field("riassunto"); ?></p>
                             </div>
            </div>
    	</div>
    </div>

    Plugin Author Darren Cooney

    (@dcooney)

    Ok wow! I likely won’t be able to debug this ??

    I would bet there is some sort of return issue in the html.

    If you want to share a link you can email me directly.

    hehe ??

    Alright man, what’s your email? Do you need wp account details too?

    p.s. today i bought multi repeater plugin and preload plugin too, i’m a bit confused with the preload as i didn’t get what it really does but will take e this in another discussion.

    OK sent an email via your connekthq site

    Plugin Author Darren Cooney

    (@dcooney)

    Awesome, thanks so much!
    The preloaded add-on is pretty cool but Im afraid I’ve done a terrible job of explaining it’s benefits on my website ??

    I’ll look for you email and get back to you tomorrow.

    Cheers!

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Hide Load More Button’ is closed to new replies.