Wordpress Discussion
Out of context: Reply #113
- Started
- Last post
- 164 Responses
- dee-dubs0
HELP ME QBN, you're my only hope !!!
Can someone assist me with what I hope is simple problem.
I am using the great misha post more ajax load:
https://rudrastyh.com/wordpress/…click a button and more posts load via ajax magic.
I have tried to alter the code a little as I dont want all posts to show, just ones that belong to certain categories (only ever one at a time). Did it to one page (fed in cat 2) and works just fine.
I just cant work out how to dynamically set the cat so that depending on what page you are on determines what cat is requested for more posts
I have tried the below:
and added the function page_post_var() which works when called by misha_my_load_more_scripts but not when called by misha_loadmore_ajax_handler which I am assuming is because maybe this is called before it actually knows what page it is on?
Im not amazing at code, is there a simple way i can alter this to get it working how I need?
- php controller has no idea about that pageid, you need to pass the pageid variable to the ajax controllersted
- add in js 'cat_id' =>
or get the page catid in php.sted - actually this shit should know what category that page belongs to: $_POST['query']
or you can inject the catid into this.sted - Thank you so much for trying to assist...however Im starting to think this is above my thick comprehension, I'm struggling to get my head rounddee-dubs
- Am i right in thinking i can do away with the extra function i wrote and just pass the cat in better way?dee-dubs