public function CategoriesController_AfterBreadcrumbs_Handler($Sender, $Args) {
$Description = $Sender->Data('Category.Description');
if ($Description) {
echo ''.$Description.'';
}
}
You could then put the html you want in your category's description. $Sender->Data('Category.YourField') instead of Description.Gdn::Structure()->Table('Category')->Column('YourField', 'text', FALSE)->Set();
You can put that in your theme hook's setup method and it will be called when you enable the theme.
Answers
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •I've added a file called class.mc2011themehooks.php to my theme folder location here: And this is all of the code inside that file (I'm not sure why the
<br />is displaying on line 1 here, it's not actually in my file that way):<?php if (!defined('APPLICATION')) exit();
And I have some plain text in my Category descriptions that I assume should now be visible on my Category pages, but they aren't displaying.class mc2011ThemeHooks extends Gdn_Plugin {
public function CategoriesController_AfterBreadcrumbs_Handler($Sender, $Args) {
$Description = $Sender->Data('Category.Description');
if ($Description) {
echo ''.$Description.'';
}
}
}
I wasn't sure about the first line of PHP there. I included it because I also saw it in the theme hook files from other themes. If I leave it out all of the code in my theme hooks file appears at the top of my Dashboard, like this:
http://gnomonschool.com/temp/vanilla-hook.jpg
Any idea what I may be doing wrong? Thanks a bunch!
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •If I decided I didn't want to use the category description what would my options be? Is there some way to create a custom element I could call in instead of the category description?
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •