Skip to content

Getting started with an Orchard Core Theme

开始使用Orchard核心主题

In this article, we are going to create an Orchard Core Theme by adding it to an existing Orchard Core CMS application created previously.

在本文中,我们将通过将其添加到现有的Orchard Core CMS应用程序[之前创建](README)来创建Orchard核心主题。

Create an Orchard Core Theme

创建一个果园核心主题

  • Install the Code Generation Templates

  • 安装[代码生成模板](../../ Templates / README)

  • Create a folder with the name of your theme (Ex: MyTheme.OrchardCore) and open it

  • 创建一个包含主题名称的文件夹(例如:MyTheme.OrchardCore)并打开它

  • Execute the command dotnet new octheme

  • 执行命令dotnet new octheme

  • Add a reference to the theme from the main Orchard Core CMS Web application

  • 从主Orchard Core CMS Web应用程序添加对主题的引用

A thumbnail can also be created by adding a Theme.png in the wwwwroot folder.

也可以通过在wwwwroot文件夹中添加Theme.png来创建缩略图。

image

The properties of the theme can be changed in the Manifest.cs file:

可以在__Manifest.cs__文件中更改主题的属性:


using OrchardCore.DisplayManagement.Manifest;

 <font color=#0099ff size=4 face="黑体">使用OrchardCore.DisplayManagement.Manifest;</font> 





 <font color=#0099ff size=4 face="黑体"></font> 


[assembly: Theme(

 <font color=#0099ff size=4 face="黑体">[集会:主题(</font> 


    Name = "MyTheme",

    Author = "My name",

    Website = "https://mywebsite.net",

    Version = "0.0.1",

    Description = "My Orchard Core Theme description."

)]

 <font color=#0099ff size=4 face="黑体">)]</font> 


The theme should be available in the Active themes admin page, and can be set as the default theme.

主题应该在“活动主题”管理页面中可用,并且可以设置为默认主题。