Search code examples
orchardcms

Target a specific Widget with Placement.info in Orchard


I use Orchard CMS 1.10.1. In a Page I have lets say four Html widget, I want to place one of these Html Widgets in a local zone.

I used Shape Tracing Tool to get the name of the shape of this specific Html widget But all of these four Widgets have Same the name in Shape Tracing Tool.

So how can I target only one of them?


Solution

  • Firstly, you should add new zone to Theme.txt:

    Zones: MyCustomZone, .., .., ..
    

    then after adding your widget to this zone through Orchard dashboard, you can display this zone MyCustomZone, anywhere you want in your system, just using the following line:

    @Display(WorkContext.Layout.MyCustomZone)
    

    Note: you don't need to render it in your layout if this is not necessary.