Do you have a static page set for your homepage and a blog posts section set as well? I bet you’ve tried the built in WordPress function is_home() that will return true for both the homepage and the blog section and have gotten frustrated.
Have no fear! I have created a function that I use on a continuous basis to check if the current page is the homepage.
Add this to your functions.php file in your theme folder: