How do you show different content DIVs in different Home Center Categories?
回答済みI want to show different CFAs / custom content in a DIV in different categories, how do I accomplish this please?
I want to have a horizontal feature box across the page with calls for action to areas of my home center, but I want it to feature different CFAs depending on which category your viewing.
Example :
- category 1 will have CFAs 1, 2 & 3
- category 2 will have CFAs 4, 5 & 6
I'm not experienced in Javascript, so if this requires Javascript please explain in layman's terms.
-
Hey Noah,
It's possible with category IDs. You can check the category IDs and add different content divs.
Example:
Homepage - I did for category blocks on homepage. I checked the category's IDs and added the content in div.
<ul class="blocks-list">
{{#each categories}}
{{#if ../has_multiple_categories}}
<li class="blocks-item">
<a href='{{url}}' class="blocks-item-link">
<span class="blocks-item-title">{{name}}</span>
<span class="blocks-item-description">{{excerpt description}}</span>
</a>
{{#is id 360007935212}}
<div>
section 1 will have CFAs 1, 2 & 3
</div>
{{/is}}
{{#is id 360007935192}}
<div>
section 2 will have CFAs 4, 5 & 6
</div>
{{/is}}
</li>
{{else}}You can pick this code and replace IDs with your Help center's category IDs.
Result:
Category block one - FAQ
Category block two - Announcement
If any query let me know :)
Thank You
-
Many thanks for your assistance
-
:)
-
Hi,
I have been able to add category specific content to different categories by checking if the page has the section IDBut do you know if it's possible to have category specific content within section pages & article pages, for example, could I have the following :
In section 1 page
<div>
<p>Category 1 specific content</p>
</div>In section 2 page
<div>
<p>Category 2 specific content</p>
</div>In category 1 article page
<div>
<p>Category 1 specific content</p>
</div>In category 2 article page
<div>
<p>Category 2 specific content</p>
</div>I ask as I have tried swapping the 'section' reference in your code for the section pages to 'section' and 'article' in article template without success.
サインインしてコメントを残してください。
5 コメント