I have created a lazy loading script using AJAX and JSON for my blog. It works perfectly. However I have 4 different blogs on the same site. These are created using custom post types.
I need to get the AJAX to do lazy loading for all of these blogs. I can get it to work for each one by manually changing the name from post to boutiques for example.
So I created a variable called $postname and want to assign this a different value depending on the slug of the page you are on when you click load more posts.
How can i check what page slug is and then assign my variable a name. Here is my code but I need to know how to call the slug of the page im on and assign that to $slug.
if ( $slug == 'boutiques' ) {
$postname="boutiques";
} elseif ( $slug == 'tourist' ) {
$postname="tourist";
}
else {
$postname="post";
}