Although I don’t see an option or parameter to turn sticky posts on or off, I see that’s sticking.
Sticky posts is not working with ALM and I don’t have any plans to sort this out at the moment.
Sorry:(
Weird because I was able to get posts to stick. Any way, it’s not a big deal right now. If that becomes an issue, I could have another query with sticky posts only.
Hope I’m not hi-jacking this thread… Is there a way to exclude all sticky posts the ALM loop?
You would need to do a separate query for all sticky posts.
Build and array then pass it to the exclude paramaters.
Make sense?
$sticky = get_option(‘sticky_posts’); // returns an array with all sticky posts ids
Then pass this as a parameter to ajaxloadmore post__not_in=$sticky
Needed this too, but while looking at the source code I found out that Dan’s solution is not working cause post__not_in expects a string of post ids seperated by comma.
So use this instead:
// Get ids of sticky posts (array)
$sticky = get_option('sticky_posts');
// Implode array to string, it's important to have no spaces around the comma
$sticky = implode(',', $sticky);
// Use your variable in the shortcode, don't forget your other attributes
echo do_shortcode('[ajax_load_more post__not_in=' . $sticky . ']');
Hope this post helps someone struggling with this.
Just to add to tobiasmalikowski’s code:
You could also do it with exclude=”‘.$sticky.'”
post__not_in=’ . $sticky . ‘] didn’t work for me so I used exclude 🙂