Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Add custom code to homepage only
purjo
New
Hello,
I cant seem to get my head around the templating system and how the views work in vanilla. I have a site with categories&discussions as homepage and I want to add some custom content after the header, but don't want it to show on other pages.
I have tried editing the master template, discussions view files and installing custom pages plugin. With custom pages plugin i couldn't get the categories and discussions and the sidebar to show.
Just don't get it.. I find the views very confusing. How do I add custom content to the homepage?
Tagged:
0
Best Answer
-
422 MVP
So like:
< body id="vanilla_discussions_index" class="Vanilla Discussions index ">
and you wish to add a specific class, then chain it to the above class. like so
< body id="vanilla_discussions_index" class="Vanilla Discussions index purjo">
There was an error rendering this rich post.
5
Answers
look at body id,
so lets say the body id of index is id="vanilla_index" then you can target a css rule just for that id occurence.
There was an error rendering this rich post.
So like:
and you wish to add a specific class, then chain it to the above class. like so
There was an error rendering this rich post.
Thanks for the fast reply.
But I can't actually use a css hack like that. The code I'm about to include is some heavyweight php that the server cannot afford to run on every page load in vain.
Probably you need to use themehooks, see http://vanillaforums.org/discussion/comment/177523/#Comment_177523
There was an error rendering this rich post.
So test for the url of the page and only include your php if it is the url you want. see
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.