Removing full title and breadcrumb header container for a specific post type

The thing is, there’s no concept of “the” header container in WordPress. What elements are on a page, where they are, and how they got there, is all determined entirely by the theme. So, the answer to this:

Can anyone recommend the best way to hide or remove the full container
that holds the title and breadcrumbs for a specific post type via the
functions.php file?

Is no. Not really. Not without access to the specific theme in question (keeping in mind that 3rd-party themes and plugins are off-topic here). However, I will walk through some basic steps to go through to find the answer for any given theme.

But first, the simplest option would be to hide it with CSS. This container likely has a class on it, and you could combine that with the single-event or single-portfilio class to visually hide the header (it will still be in the HTML, just hidden):

.single-event .header-container-class {
    display: none;
}

Removing it entirely from the code via a template or functions is much more complicated, but here’s the steps I’d go through:

You need to find where this container is being added.

The first thing to do is look a the Template Hierarchy. Using the Visual Overview, move from the left to the right until you find a file that is in your child theme or parent theme (child theme first). If your post type is named event, then you’d be looking for these templates in this order single-event.php, single.php, singular.php, then index.php.

The first file you find is the template file WordPress loads for your post type. If single-event.php does’t exist, then you’ll need to move backwards from whichever file you have found to see what other content would also be using that template. Make note of this.

Once you’ve found the template. Look inside. Compare the HTML to the front-end to see if you can find the container that you want to hide. If you can find this content in the template, then removing it will be fairly straightforward.

If the file was single-{post type}.php: Copy the template file to your child theme with the same name. Then in the copy, simply delete the HTML that you don’t want. WordPress will load this version of the template from your child theme, and the element won’t appear

If the file was not single-{post type}.php: If the file was not single-event.php or single-portfolio.php then this means that any changes will also affect regular posts, and possibly pages. In this case, copy the file to the child theme but rename it to single-{post type}.php where post type is event or portfolio or whatever the post type is. Then in the copy, delete the HTML that you don’t want. Now for this post type WordPress will load the template from your child theme, but the unmodified parent theme’s templates for the other post types.

What to do if the template file you found doesn’t have the HTML you want to remove.

If the template file does not have the HTML that you want to remove, then it is likely being added from another file. Look out for 2 functions being used: get_header() and get_template_part().

These functions load in other templates into the template file. Pretty much every template in every theme will use get_header(). This loads in the common header that appears on all pages. This might contain the relevant HTML, but first we’ll look for get_template_part().

If the template file uses get_template_part() then this might be where the header container is coming from. Each use of this function will include a path. get_template_part( 'partials/header-container' ) means that the template is loading partials/header-container.php from the theme, for example.

If your template uses this function, and the file that’s referenced contains the HTML that you want to remove, then follow the steps outlined above for copying the single- template file, but instead of removing the HTML, just remove the use of get_template_part().

If you still haven’t found the HTML, then it’s possible that it’s being added to every page using get_header(). This function simply includes the header.php theme file into the template.

So have a look inside header.php. If you find the relevant HTML in here, then you’ll need a different approach. Copying header.php to your child theme and removing the HTML will remove it from every page on the site. Instead you’ll need to copy header.php to your child theme and add some Conditional Tag checks so that the relevant HTML doesn’t appear on certain pages. To exclude a section of the header from the portfolio and event post types you’d wrap the HTML in these tags:

<?php if ( ! is_singular( 'event' ) && ! is_singular( 'portfolio' ) ) : ?>
    <!-- HTML that you don't want to display on Events and Portfolios here. -->
<?php endif; ?>

That’s about as far as I’ll go. If that hasn’t helped, then your theme might be doing something unusual, like running everything through hooks. If you’ve got this far without a solution, I’d suggest contacting the theme author or checking their documentation.