In my template file i fetch the custom post data like this ,
Initially I fetch 7 post, I need to make a read more button bellow the post, which will fetch more 7 posts from the wp database table, when someone click on it.
But I don't know how to do it, I want to know about,
- In jquery get method, which php file i call for the data,
- How or what exact script i will write in that php file.
Here i have added a rough idea how you can write your code :
Create a ajax function in function.php , and pass offset value to it through ajax call and just append the received data in your disply section.
here is an example of creating ajax function :
//Frontend code , on button click it will cal the ajax function and pass the offset value, on each click you need to increase the value by 7 (in case you want to load 7 post only ) and check how many post are left and if offset value exceedded the no of total counted data to be display by wp query then simply hide the button