So, I’ve adapted Bootstraps Carousel within Pinegrow to show full screen and to always focus on the center of the image. Using the same rules as Pinegrow has set up in the carousel/slider component I display these on my front-page.php (it’s a website with a blog.) So, to make that work you create a post, upload a featured image and select “Home-Slider” category, now these will all show in the carousel.
The issue I’m having is on my ‘Latest Posts’ page (index.php.) There’s obviously no point those posts showing up there but I don’t know how to prevent it. I’ve found a helpful article on Wordpress that pretty much gives the answer but, I’ve no idea how to implement it in my contents-page.php. Implement it properly at least. Nothing i do with it makes a difference.
Update
I found This Useful Answer from @Emmanuel on another post, which should make it work. However, after finding the post(s) ID (1018 to choose just one,) entering it into the Category section of Category Parameters and choosing ‘Not In’ from the Category Opts, the unwanted post(s) still show.
After pulling my hair out for three days or so I’ve finally fixed it. I was going about it all wrong. Perhaps by ‘speed-reading’ other peoples solutions, I don’t know but, It’s all sorted now.
What I should have been doing was excluding specific Posts by ID as opposed to excluding Categories by ID.
I eventually found this code worked:
function exclude_single_posts_home($query) {
if ($query->is_home() && $query->is_main_query()) {
$query->set('post__not_in', array(7,11));
}
}
add_action('pre_get_posts', 'exclude_single_posts_home');
It did break the site a couple of times, but I’m a happy camper now, so I’ll give myself a pat on the back.
Solution source can be found Here.