Unable to get working
-
Hi, I’m testing this on my local dev site, so I don’t have a link available yet, but this isn’t working on my single posts.
I originally did not have navigation or comments available but added those in.
I don’t see errors on the console.
When I navigate to /alnp on my single post, I only see a navigation link to a post.Let me know what information I can provide. Thanks!
-
Hi @keishabien
It sounds like your theme has placed the templates for content elsewhere besides the parent folder. Auto Load Next Post by default will only look in the themes parent folder for the content files to load.
Should the theme you are using placed them elsewhere you will have to locate them and apply a filter.
I recommend reading the General Overview in the documentation and to help you understand where to look for your theme templates, read Content and Structure.
Hope that helps.
If you have any further questions, let me know.
Thank you.
Sébastien.
So, my theme structure looks as follows: wp-content/themes/mytheme/templates
But my single post page (single.php) is located in wp-content/themes/mythemeI’m trying to implement on single.php. Do I need to change that?
I implemented the plugin on my live site as well, here’s a link: https://midwestdentaljobs.com/2019/the-road-less-traveled/
Most themes use get_template_part function to break down the structure of the theme so they don’t have to repeat code used in the template file hierarchy.
The repeater template in Auto Load Next Post does not look for
single.php
but for files such ascontent.php
.If your theme does not have any of these files to look for (as most standards themes should) then you will need to override the repeater template file to match your theme structure.
Ahhh, okay, thank you for explaining that a little further!
I will work on updating my theme.Hey again,
I added content.php to my theme, inmytheme
, updated my single.php to call that in correctly.The post data loads when I navigate to the /alnp on the post, but I’m still only seeing the navigation link for the next post.
Looking deeper, I’m not seeing the
auto-load-next-post.js
coming into my page. How is that called/what is that relying on?Hey again,
I added content.php to my theme, in mytheme, updated my single.php to call that in correctly.The post data loads when I navigate to the /alnp on the post, but I’m still only seeing the navigation link for the next post.
As I said in my first response “Should the theme you are using placed them elsewhere you will have to locate them and apply a filter.” This will then allow Auto Load Next Post to find where the theme templates for your content is located.
Looking deeper, I’m not seeing the auto-load-next-post.js coming into my page. How is that called/what is that relying on?
Auto Load Next Post script runs only on single posts. Also, should your theme need it you can set the scripts to run in the footer. Just go to the Misc section of the plugin settings and set the JavaScript to load in the footer.
Do I need to do that if my file is located at
themes/mytheme/content.php
and not inside a template folder?I have a folder called templates. When I move content.php into there and apply this filter:
function my_template_location() { return 'templates/'; } add_filter( 'alnp_template_location', 'my_template_location' );
– my content doesn’t display on single.php
– the alnp/ page shows the post, but doesn’t load the next oneI appreciate your help so far. I am not the original developer of the theme for my company, so trying to get this plugin to work with this theme structure is unique.
Do I need to do that if my file is located at themes/mytheme/content.php and not inside a template folder?
If the
content.php
file is in the parent folder that’s fine. There is no need to use the filter.my content doesn’t display on single.php
Is the
content.php
file empty?the alnp/ page shows the post, but doesn’t load the next one
This is used when Auto Load Next Post runs an Ajax request for the next post.
… this isn’t much help for what I was struggling with but I uninstalled the plugin and reinstalled it, and now it’s working.
About a week ago, before I adjusted my structure to include
content.php
as a file, I had tried this plugin with no luck. I had changed the theme selectors around at the time but ended up deactivating. I had just selected “delete all data” in the Misc area, deleted the plugin, and reinstalled and now it’s working. I’m sure this was errors on my end more than anything.I have a follow-up question: only one post is loading in instead of loading another after, and after, etc. What would I do?
Okay, I’m glad I was following the documentation enough to understand my content.php was okay lol.
No, my content.php has code in it:
<!--Blog content--> <div class="column full"> <div class="column full"> <h2 class="entry-title"> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <span class="blog_date"> <?php the_date(); ?> </span> | <span class="blog_cat"> <?php the_category(', '); ?> </span> </div> <div class="column full"> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"> <?php the_post_thumbnail(); ?> </a> </div> <div class="article column full"> <?php the_content(); ?> </div> </div>
Good to know about the /alnp path. Thank you for helping out!
I have a follow-up question: only one post is loading in instead of loading another after, and after, etc. What would I do?
See post navigation in the documentation for more information.
Excellent, that worked well. Thank you!
I have another question, of course ?? I remember seeing documentation about the URL’s not writing correctly? I think? I’m seeing that – it doesn’t align directly with the scroll location.Also, I’m having to scroll up and back down to encourage more loading. Can you direct me to a solution for that?
Thank you so much for helping me figure this out!
- The topic ‘Unable to get working’ is closed to new replies.