Below is a code snippet for setting available page layouts for your site:
List<String> strPageLayoutsToPersist =
new List<string> { "Home Page",
"General Detail Page",
"Email Me Page",
"Category Page"
};
using (SPWeb spWeb = spSite.RootWeb)
{
PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(spWeb);
// Get avaialble page layouts for our content types
PageLayout[] myPageLayouts = pubWeb.GetAvailablePageLayouts().Cast<PageLayout>()
.Where(p => strPageLayoutsToPersist.Contains(p.AssociatedContentType.Name))
.ToArray();
// Set the available page layouts to our content type
pubWeb.SetAvailablePageLayouts(myPageLayouts, false);
// Update the web
pubWeb.Update();
}
This will hide every page layouts except those you specify in the strPageLayoutsToPersist