Excluding posts used for carousel slider from the Latest Post section on blog page

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.

<h2>Recent Posts</h2>
	$args = array( 'numberposts' => '5', 'tax_query' => array(
				'taxonomy' => 'post_format',
				'field' => 'slug',
				'terms' => 'post-format-aside',
				'operator' => 'NOT IN'
				'taxonomy' => 'post_format',
				'field' => 'slug',
				'terms' => 'post-format-image',
 				'operator' => 'NOT IN'
	) );
	$recent_posts = wp_get_recent_posts( $args );
	foreach( $recent_posts as $recent ){
		echo '<li><a href="' . get_permalink($recent["ID"]) . '">' .   ( __($recent["post_title"])).'</a> </li> ';

So, if anyone with some more Wordpress ‘savvy’ can advise, it would be greatly appreciated.

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.

I’m unsure whether this should make any difference to ‘content-home.php,’ but it hasn’t. It has however added the relevant code to my ‘index.php.’

    <code> <?php
                        $cat_filter_args = array(
                            'category__not_in' => '1018'
                    <?php $cat_filter = new WP_Query( $cat_filter_args ); ?>
                    <?php if ( $cat_filter->have_posts() ) : ?>
                        <?php while ( $cat_filter->have_posts() ) : $cat_filter->the_post(); ?></code>

So, it really should be working. Again, any advice would be gratefully received.

Update: Fixed

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.