The provided code is developed to work only for slider.
Do you want to make the images full width displayed on the pages and posts on your site?
If you want to make the images full width then also the page/post content will become full width removing the sidebars so could you please tell me a bit more in detail what you want to achieve and also share the sample page URL having image which you want to full width so that i can help you to achieve it.
Yes, you are correct. My goal is to have a full width image across the top of certain pages/posts. I am okay with having the content become full width as well for these specific pages/posts.
I have already made this content page full width but I can’t get the image to spread across the whole page even though the image is 1018x460 and I have tested on my slider and it does spread across my entire slider.