How to create “create document” links for a document library with multiple content types

When having a document library with multiple content types sometimes it’s difficult for users to find those content types to create a new document. They have to browse to the library, click on items, click on new item dropdown and choose from the list of content types.

Instead of doing this you can put up a content editor web part on any place with a link to create a new document based on a content type like this:

<A onclick="createNewDocumentWithProgID(‘https:\u002f\u002fyour.sharepoint.site\u002fSubsite\u002fDocuments\u002fForms\u002fContentTypeName\u002ftemplate.dotx’, ‘https:\u002f\ u002fyour.sharepoint.site \u002fSubsite\u002fDocuments’, ‘SharePoint.OpenDocuments’, false);return false;" href="#">Create new ContentTypeName</A>