We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Default templates on new install won't show category name or description

How Do I?

NeilC's avatar
NeilC
28 posts
6 months ago
NeilC's avatar NeilC

I installed a clean copy of EE v7.5.12 with the default themes included. The blog code is not working as I expected. To try it out, I started by going to the Blog channel in the CP and turning on the blog category group. Then I went to the categories and added descriptions to some of them. Finally, I edited several of the blog entries to add them to a category.

What’s Working When I go to the the front end of the site and click on the blog link, I see the channel title (actually the p_title set in the template) and the channel description (also set in the template) followed by the full list of entries. When I select a category from the list of categories, the list of entries is reduced down to only those entries assigned that category.

What’s Not Working Although the channel title and description vanish as they should, they are not replaced by the category name and channel. Here is the code from the blog/index template that I think should be doing that.

{!-- Heading output is different in the case of category listings. --}
{if segment_2 == 'category'}
 {layout:set name='cat_ch' value='{ch}'}
 {exp:channel:category_heading channel='{ch}'}
  <h1>{category_name}</h1>
  {if category_description}
   {category_description}
  {/if}
 {/exp:channel:category_heading}
{if:else}
 <h1>{p_title}</h1>
 {p_description}
{/if}

From what I’ve read in the documentation an in the forums, that should work the way I expected and display the category name in the headline and the description in the paragraph, but it doesn’t. I’ve done quite a bit of experimentation and determined that anything I put between the opening and closing exp:channel:category_heading tags will not be displayed, and I don’t know why.

Can anyone explain why this code (which came with the EE install) isn’t working?

Can anyone tell me how to make it work?

Thank you.

       
laurayoung's avatar
laurayoung
4 posts
6 months ago
laurayoung's avatar laurayoung

I think the channel:category_heading tag only works when:

You’re on a category archive page.

EE recognizes the correct segment format: /template_group/template/category/cat_url_title/

In your case, make sure the URL is like this:

/blog/index/category/news/
  • segment_2 == ‘category’ (true)

  • segment_3 == ‘news’ (category URL title)

If you’re missing the third segment, category_heading has no data to pull from.

       
rgadoll's avatar
rgadoll
3 posts
about 4 weeks ago
rgadoll's avatar rgadoll

Foodle is a word-guessing game with a gastronomic theme. Instead of providing hints to your partner, you are required to describe the cuisine in a manner that enables them to identify it.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.