Disabling Themes on Custom Master Pages

Thursday, August 7, 2008

Ran into an interesting problem where I wanted my custom master page to NOT show my theme. I only wanted the theme to show on the _layouts pages and anywhere else not styled by my custom master page. You would think this would be as easy as simple removing this line from the master page:

<sharepoint:theme runat="server">


The problem I ran into was even with this line removed, SharePoint would still show my theme on the custom master page after I applied it. Turns out SharePoint adds this line to your code:

<meta name="Microsoft Theme" content="Breeze2 1011,
default">


This ends up telling SharePoint to just go ahead and load the theme. The next maddening thing I found was that some master pages weren't having the theme applied. Turns out, the key to having SharePoint NOT apply the theme automagically is to have a master page that is NOT customized (or one that is ghosted if you prefer that lingo). If you apply your custom master page from a Feature instead of customizing it with SharePoint designer, SharePoint will no longer add the meta tag and thus will not load the theme. So, there you have it, one more reason not to customize master pages in production.

7 comments:

jesperated said...

I thought unghosted page means customized page (which is saved to the content db), ghosted page is an uncustomized page (which are the ones on the file system).

The Mossman said...

You are correct, I confused myself with the double negative NOT customized would be ghosted. Changing the post.

Ivan Sanders said...

The simple way to remove access to Themes is to remove them from SPTHEMES.XML file. However, please follow standard operating procedure and make as copy of the original file. You can find the SPTHEMES.XML in the C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\1033 folder assuming you have a default installation. I have included an example below of the reduced SPTHEMES.XML file, after making these changes you will need to perform an IISReset to read the SPTHEMES.XML file back into memory with the changes you made.

SPTHEMES.XML (i WASNT ABLE TO PASTE THE CoDE IN THE blog... sO PLEASE HOLLOW THE LINK NELOW.

http://dimension-si.com/blog/Lists/Posts/Post.aspx?ID=95

Themes are a good starting point on the flexibility of customizing your SharePoint Portal for a more definitive look at branding be sure to check out Heather Solomon's Blog @ http://www.heathersolomon.com/blog

The Mossman said...

Ivan, I'm not sure you got the point of the post. I do not want to remove the Theme from the SharePoint site. What I want is: sites with custom master pages to NOT show a Theme that is actually applied to the application (admin) pages of SharePoint.

Ivan Sanders said...
This post has been removed by the author.
Ivan Sanders said...

My apologies, you are correct I read the post too quickly...

I always Brand the Admin pages with the same look and feel as the portal. This gives the users with admin rights a consistent look and feel for the application...

Also, I completely agree you on the use of features for eveything (Master Pages, CSS, lists, WorkFlow etc.) and packaging the features into a solution for deployment.


Cheers,

-Ivan

September

Anonymous said...

Do you know the significance of the number 1011?