Skip Navigation

[Resolved] custom post type using header footer layout is loaded inside theme content block

This support ticket is created 5 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 5 years, 4 months ago.

Assisted by: Nigel.

Author
Posts
#1273377

Jim

I am trying to: load my custom post type in it's own header and footer layout

but the header/footer layout is itself loaded inside the theme content block and so the header/footer and the sidebar of the theme are also still loaded.

Example:
hidden link

How can this be turned of?

Thanks,
Jim

#1273435

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Jim

I'm not sure what you are doing here, but let me describe how Toolset templates work and see if that helps.

Your theme provides PHP templates that are used to display different kinds of content, and in the case of single custom posts the file in question is likely to be single.php (see the template hierarchy for details: https://developer.wordpress.org/themes/basics/template-hierarchy/).

That file manages the whole page, likely pulling in header.php, footer.php, and perhaps sidebar.php, as well as outputting the post content itself.

That post content is likely to include the title, may include some meta data such as publication date and author, and then the actual content, rendered using the_content().

This is where Toolset templates come in.

The use the_content filter to replace what the theme would normally output with what you include in the templates you make with Toolset, either Views Content Templates or Layouts templates if you are using those.

Everything outside of the post content is rendered by the theme, and so is outside of Toolset's control.

Some themes—the recommended themes we list—have a level of integration where theme options can be set for templates. So if your theme has an option to disable the sidebar on posts, then you would be able to set that option for a template so that custom posts rendered using that template would not show the sidebar, for example.

If you are using a recommended theme (you're not, on this project) which is missing the options you need, or if your theme doesn't have support for theme options with Toolset (that's you), then you need to customise the theme PHP templates (in a child theme).

Specifically, if you have a custom post type 'avatar' then you can make a copy of single.php and name it single-avatar.php and that file will be used to render all avatar single posts.

You can then edit that PHP file and remove what you don't want from the output, e.g. a call to sidebar.

Depending on the theme, the visual header may be included in the header.php file or it may be included in single.php.

Note that header.php sets up the page head and so is required. It it also adds the visual header (which you don't want) then you may need to also create a custom header template that removes the visual header content, see https://developer.wordpress.org/reference/functions/get_header/

Likewise footer.php.