Skip to content

Instantly share code, notes, and snippets.

@bearded-avenger
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bearded-avenger/0fac01e0b0095ceaa7ed to your computer and use it in GitHub Desktop.
Save bearded-avenger/0fac01e0b0095ceaa7ed to your computer and use it in GitHub Desktop.
Takeover Layout Methods in WordPress

I have a WordPress plugin that runs as a custom post type. It creates a special layout that's used together with Aesop Story Engine to allow quick and unique story creation. The alpha version of this is done with template_include to override a single post type story template.

Because of the unique and particular layout of the story, I need to ensure that no other assets are being loaded on these specific story pags, and preferrably no markup as well. The alpha version does this by building up it's own template, consequently removing wp_head and wp_footer all together.

This plus side of this, is that special layout and design are guarnateed to work with any theme or plugin. The page only loads 2 files, the files necessary to work. The header http://cl.ly/image/2D1o0l071z2a and footer http://cl.ly/image/2D1o0l071z2a are clean.

The downside of this, is that other plugins won't work on the specially designed story pages without hooking into the specific hooks available in teh story page.

  1. Is the fact that other plugins not working on a story page such a bad thing because it's unique and specific?
  2. Without manually dequeueing style sheets and using JS to remove markup from the page that's not our own, any other thoughts on how this can be achieved without NOT loading wp_head ?
@norcross
Copy link

a couple of issues I see: loss of any / all tracking and analytics scripts, and the wp_admin_bar wouldn't work anymore.

@bearded-avenger
Copy link
Author

thanks Andrew. Yeah the first is what i'm mainly worried about, that type of thing, unless there was an option for it or the user hooked into the available hooks in the template. the adminbar I've kinda solved. http://cl.ly/image/0b1W0r3K1M0j

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment