danstover
Forum Replies Created
-
Thanks dcooney,
I did not realize the preloaded was an add-on for this. I will try the latter first and resort to the add-on if that does not work.-Dan
Okay,
I changed pause to false and still have scroll set to false on my index page’s shortcode, but the posts are all loading automatically now which is not the desired functionality there.
http://kyledavidgroup.kdgtest.com/blog/I just need to get the right combination of parameters on the shortcode to hide the button if there are no more posts to load, show it if there are more posts to load, and only go ahead and show posts if the user clicks the button. Can you help me achieve that?
dcooney,
I must have misunderstood the pause=”true” part of the shortcode’s purpose. I removed that and it seems to be working fine now. If I want the user to always have to click to load more posts, am I safe to just put pause=”false” and scroll=”false” on any instance of the alm button shortcode?Dan
Sure,
this category page is a good example:
http://kyledavidgroup.kdgtest.com/blog/category/higher-education/-Dan
Hi dcooney,
That worked on my homepage when there are enough posts to load more, but on my archive pages where I only have 2 or 3 posts total the button is still visible. It doesn’t disappear until I click it, and there isn’t a warning posted that no more posts were found so I’d like to either hide this button on page load if there are no more posts or be able to spit back a message after clicking the button that there are no more posts to load.Thanks so much for your continued help,
DanYou, sir, are the man. Thanks for the help!
Ok, almost there! I found a way to put the wp_head and wp_footer functions into my header and footer appropriately. If you check that page URL again and click the button, it reloads some of the same posts. How do I prevent it from doing that? There should be 5 posts total, not 8.
Thanks!
DanThanks dcooney…I believe that is the issue. I am trying to use parent files from the root of the site for the header and the footer, so I will need to work in a way to include those. I’ll let you know if that solves the issue.
-Dan
<?php get_header(); ?> <!--Masthead--> <section id="top" class="masthead"> <div class="container"> <div class="row"> <div class="header col-md-8 col-sm-12"> <h1>The Blog</h1> <h4>Welcome to our blog; the place where thoughts and musings from KDG come to make themselves known. Whether business woman, volunteer coordinator, or university dean, there is something here for everyone.</h4> </div><!--col-xs-12--> </div><!--row--> </div><!--container--> <div class="color-overlay"></div> </section><!--masthead--> <!---Page Content--> <section class="blog-bar"> <div class="container"> <div class="row"> <div class="filter-results col-sm-3 col-xs-7"> <a class="dropdown-toggle" data-toggle="dropdown">Most Recent <span class="fa fa-angle-down"></span></a> <ul class="dropdown-menu"> <?php $args = array( 'title_li' => __(''), ); wp_list_categories($args); ?> </ul> </div><!--col--> <div class="view-all-link col-sm-3 col-xs-5"> <!--<a href="blog-archive.html" class="text-link">View All Posts</a>--> </div><!--col--> <div class="search-bar col-sm-offset-2 col-sm-4 col-xs-12"> <?php get_search_form(); ?> </div><!--col--> </div><!--row--> </div><!--container--> </section> <section class="blog-roll"> <div class="container"> <div class="row"> <div class="col-md-10 col-md-offset-1 col-sm-12"> <?php if ( have_posts() ) : ?> <?php // Start the loop. while ( have_posts() ) : the_post(); get_template_part( 'template-parts/content', get_post_format() ); // End the loop. endwhile; // Previous/next page navigation. the_posts_pagination( array( 'prev_text' => __( 'Previous page', 'kdgblog' ), 'next_text' => __( 'Next page', 'kdgblog' ), 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'kdgblog' ) . ' </span>', ) ); // If no content, include the "No posts found" template. else : get_template_part( 'template-parts/content', 'none' ); endif; ?> </div><!--col--> <div class="col-xs-12"> <!--<a class="kdg-btn centered">Load More Posts</a>--> <?php echo do_shortcode('[ajax_load_more post_type="post" post_format="standard" pause="true" scroll="false" button_label="Load More Posts" button_loading_label="Loading More Posts..."]'); ?> </div> </div><!--row--> </div><!--container--> </section> <?php get_footer(); ?>It comes after the loop
It is in the template file for that page, though. It’s just not displaying (perhaps because I set the # of wordpress posts to show to only 3).Do I need to do anything else in addition to the code above that echoes the shortcode?
Sure,
This is the test link:
http://kyledavidgroup.kdgtest.com/blog/Yes, I have this code appearing at the bottom of my index.php file in the root of my theme:
<?php echo do_shortcode(‘[ajax_load_more post_type=”post” post_format=”standard” pause=”true” scroll=”false” button_label=”Load More Posts” button_loading_label=”Loading More Posts…”]’); ?>
Is there another step that I am missing? For example, maybe a function that’s required on the page before that?