I've had a look through the old questions and tried many of the different methods that there seems to be to do this. The closest I've got to working is this one here: How to implement pagination on a custom WP_Query Ajax
I've tried everything and it just doesnt work. Absolutely nothing changes on the page. If you inspect the Load More Button and click it, the jquery is making the Load More Button action as it changes from
<a>Load More</a> to <a disables='disabled'>Load More</a> which even that doesnt seem right to me anyway. It's not adding the posts, I think I'm missing something simple but for the life of me I can't work it out.
The Code in My template file is:
The Code in my functions file is:
And My JQuery in the footer is:
Can anybody see something I'm missing or able to help?
Maxime
5,73522 gold badges4040 silver badges4848 bronze badges
AddzyAddzy
38411 gold badge44 silver badges1616 bronze badges
1 Answer
Comsol 5.3. I've created tutorial on my page https://madebydenis.com/ajax-load-posts-on-wordpress/ about implementing this on Twenty Sixteen theme, so feel free to check it out :)
EDIT
I've tested this on Twenty Fifteen and it's working, so it should be working for you.
In index.php (assuming that you want to show the posts on the main page, but this should work even if you put it in a page template) I put:
The Metal Slug Anthology was then released on in 2009 under the name Metal Slug Collection PC. Metal slug anthology europe cwcheat.
This will output 3 posts from category 8 (I had posts in that category, so I used it, you can use whatever you want to). You can even query the category you're in with
This will give you the category id to use in your query. You could put this in your loader (load more div), and pull with jQuery like
And pull the category with
But for now, you can leave this out.
Next in functions.php I added
Right after the existing
wp_localize_script . This will load WordPress own admin-ajax.php so that we can use it when we call it in our ajax call.
At the end of the functions.php file I added the function that will load your posts:
Here I've added paged key in the array, so that the loop can keep track on what page you are when you load your posts.
If you've added your category in the loader, you'd add:
And instead of 8, you'd put
$cat . This will be in the $_POST array, and you'll be able to use it in ajax.
Last part is the ajax itself. In functions.js I put inside the
$(document).ready(); enviroment
Saved it, tested it, and it works :)
Images as proof (don't mind the shoddy styling, it was done quickly). Also post content is gibberish xD
UPDATE
For 'infinite load' instead on click event on the button (just make it invisible, with
visibility: hidden; ) you can try with
This should run the
load_posts() function when you're 100px from the bottom of the page. In the case of the tutorial on my site you can add a check to see if the posts are loading (to prevent firing of the ajax twice), and you can fire it when the scroll reaches the top of the footer
Now the only drawback in these cases is that you could never scroll to the value of
$(document).height() - 100 or $('footer').offset().top for some reason. If that should happen, just increase the number where the scroll goes to.
You can easily check it by putting
console.log s in your code and see in the inspector what they throw out
And just adjust accordingly ;)
Hope this helps :) If you have any questions just ask.
Maxime
5,73522 gold badges4040 silver badges4848 bronze badges
dingo_ddingo_d
6,3671010 gold badges4949 silver badges8686 bronze badges
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
protected by Community♦Dec 20 '16 at 12:38
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead? Not the answer you're looking for? Browse other questions tagged javascriptphpjqueryajaxwordpress or ask your own question.
Ajax Load More is the ultimate solution for infinite scrolling and lazy loading posts, custom post types and pages with Ajax powered queries.
Build complex WordPress queries using the Ajax Load More custom shortcode builder then add the shortcode to your pages via the content editor or directly into your template files.
Download Instructions
Ajax Load More is available as an installed plugin on wordpress.org.Please download the latest stable version from your WordPress plugins dashboard by searching for Ajax Load More or visiting https://wordpress.org/plugins/ajax-load-more/.
Features
Check out the demo site for more information!
Shortcode Parameters
Ajax Load More accepts a number of parameters that are passed to the WordPress query. These parameters are transferred via shortcode - don't worry, creating your shortcode is simple with our intuitive Shortcode Builder.
Example ShortcodeDemos
The Custom Repeater Add-On has been installed for use on each of our product demos
The following Add-ons are available to increase the functionality of Ajax Load More.
Custom Repeaters
The Custom Repeaters add-on will allow for unlimited repeater templates and provide the ability to create unique templates for different content types throughout your theme.
Get More Information Cache
The Cache add-oncreates static HTML files of Ajax Load More requests then serves those static pages to your visitors without querying the database.
Get More Information Wordpress Ajax Load More Custom Post Type Without PluginPaging
The Paging add-on will transform Ajax Load More’s lazy load/infinite scroll functionality into a robust ajax powered navigation system.
Get More Information Preloaded
The Preloaded add-on will allow you to quickly and easily preload an initial set of posts before completing any Ajax requests to the server.
Get More Information Previous Post
The Previous Post add-on will allow you to navigate single posts with Ajax Load More.
Get More Information Search Engine Optimization
The SEO add-on will optimize your ajax loaded content for search engines and site visitors by generating standard WordPress paging URLs with each Ajax Load More query.
Get More Information Theme Repeaters
The Theme Repeaters add-on will allow you load, edit and maintain templates from your current theme directory.
Get More Information Tested Browsers
Website =
'Ajax Load More' Plugin has installed on my website, i want to change Ordering
Wordpress Load More Custom Post Type
there is
spacial field in wp_posts Table On DB
Load More Pagination In Wordpress
But I can't how to set in on my posts
changed on :
So it is :
But Nothing has changed and posts don't sort as i want
Shortcode Output on
Admin Panel > Ajax Load More > Shortcode Builde :
Where should i put 'shortcode-builder' Code ?
------------------- Updata -------------------
You mean Admin Panel > Apearacne > Editor > main Page (Home page)
I can found :
When i change
orderby To spacial it doesn't works
How to download msts train simulator. Oct 2, 2017 - To Download Msts (PC):- Download Msts train simulator from Download Indian Railway basic. Free train simulator download and Microsoft Train Simulator (MSTS) addons including routes, trains, mods, and other MSTS downloads. Mar 21, 2019 - Navigate to Microsoft Train Simulator, right-click on it and uninstall it. Hence, if there are no such files, make sure to download and install the.
Also I try :
AndroSco
AndroScoAndroSco
85911 gold badge1919 silver badges4949 bronze badges
1 Answer
You can only order by custom field value not a field in the wp.posts table (I believe). https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
If spacial was a custom field.
Darren CooneyDarren Cooney
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Not the answer you're looking for? Browse other questions tagged ajaxwordpresspluginswordpress-plugin or ask your own question.
For my current Wordpress project I'm using the 'ajax load more' plugin:http://connekthq.com/plugins/ajax-load-more/
I bought the add on for using more then one repeater template. But I'am having some issues.
First let me explain the situation.
On page one I'm using this plugin using the 'default' repeater template. Everything works fine in here.
On the second page I'm using this plugin using the 'template_2' repeater template. This works fine for the first record that is loaded but not for the rest.
For the first one it uses the 'template_2' repeater for all the other records is is using the 'default' repeater template and I can't figure out wy.
I noticed the issue because my block sizes where not correct. So I made the titles of my articles static for both templates. I load 5 records at a time extra. The first one get's the title of the expected repeater template but all the rest of my records the one one the default one and I can't figure out why.
The short code I use on the second page:
I hope somebody can help me solve this problem, the deadline is pretty close and I really need to fix this problem.
For the record my Wordpress version is: 4.3.1
Joren Van HochtJoren Van Hocht
1 Answer
I came across the same issue and it turned out that I was using variable names in my repeater template that conflicted with variable names inside of the Ajax Load More plugin itself.
I had a variable called $type which I was setting to the post type inside of the repeater. This caused an override of ALM's own $type variable inside of the plugin once it was loading my repeater.
When using custom repeaters, the ALM type variable is set to 'template_', and my repeater code was setting it to the current post type.
Post your repeater code so we can check to see if you are using any variable names inside of your repeater that could interfere with ALM.
prototheprotothe
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Not the answer you're looking for? Browse other questions tagged phpajaxwordpressplugins or ask your own question.
For my current Wordpress project I'm using the 'ajax load more' plugin:http://connekthq.com/plugins/ajax-load-more/
I bought the add on for using more then one repeater template. But I'am having some issues.
First let me explain the situation.
On page one I'm using this plugin using the 'default' repeater template. Everything works fine in here.
On the second page I'm using this plugin using the 'template_2' repeater template. This works fine for the first record that is loaded but not for the rest.
For the first one it uses the 'template_2' repeater for all the other records is is using the 'default' repeater template and I can't figure out wy.
I noticed the issue because my block sizes where not correct. So I made the titles of my articles static for both templates. I load 5 records at a time extra. The first one get's the title of the expected repeater template but all the rest of my records the one one the default one and I can't figure out why.
The short code I use on the second page:
I hope somebody can help me solve this problem, the deadline is pretty close and I really need to fix this problem.
For the record my Wordpress version is: 4.3.1
Joren Van HochtJoren Van Hocht
1 Answer
I came across the same issue and it turned out that I was using variable names in my repeater template that conflicted with variable names inside of the Ajax Load More plugin itself.
I had a variable called $type which I was setting to the post type inside of the repeater. This caused an override of ALM's own $type variable inside of the plugin once it was loading my repeater.
When using custom repeaters, the ALM type variable is set to 'template_', and my repeater code was setting it to the current post type.
Post your repeater code so we can check to see if you are using any variable names inside of your repeater that could interfere with ALM.
prototheprotothe
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Not the answer you're looking for? Browse other questions tagged phpajaxwordpressplugins or ask your own question.Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |