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.

Can I make my own custom css for an already custom (non-default) theme?

edited January 2012 in Vanilla 2.0 - 2.8

Hi there.

I'm using the EmbedFriendly theme. I've made some of my own changes to it (in its custom.css folder). When a new version of EmbedFriendly comes out in the future, I'd like to retain these changes. I've taken note of the changes in notepad, but I'm worried when a new version comes out and I have to re-integrate them I might run into trouble (I'm not good with computers) and this would not be good for my forum users. I'm wondering if there's a more efficient way to do it?

I was thinking of switching the EmbedFriendly theme to the default theme folder and then making my own cusom theme for it, except there's no css files in the default folder. I read the readme in the default folder but I'd like clarifications, because I don't understand.

Thanks so much in advance for any assistance, it's greatly appreciated!

Best Answers

  • sahotataransahotataran Developer, Bay Area - CA ✭✭✭
    edited January 2012 Answer ✓

    save your file as say : custom2.css in your theme/yourtheme/design/ folder
    and then open your embedfriendlythemehooks.php

    find Base_Render_before hook and

    add

    $Sender->AddCSSFile('custom2.css'); 

    your css will be added in the end and will apply your changes to your theme styling

    422
  • sahotataransahotataran Developer, Bay Area - CA ✭✭✭
    edited January 2012 Answer ✓

    Also that "1." confused me, but it seems it only occurred because you put a quote thingy around your text in this forum.

    thats the styling for code and pre tags - your dont put it in your themehooks - put the line without 1.

    you add the line $Sender->AddCSSFile('custom2.css'); in your themehooks which can be found in yourtheme folder and if there is none then you can create one - refer to documentation for more details on theme hooks.

    $Sender is already associated with singlecolumn (allows EmbedFriendly theme to display without right column),

    You can add as many CSS files using AddCSSFile function to your $Sender

    associating it with something else also won't interfere.

    this will not interfere until and unless your CSS you wrote in custom2.css interferes with the CSS already written in your singlecolumn.css or custom.css. so basically your custom2.css definations will override those in singlecolumn.css or custom.css

    Also I don't understand how it will know that 'custom2.css' refers to the file in my custom theme folder

    the AddCSSFile method looks for your custom2.css in yourtheme/design/ folder and if it doesnot find any then it will not add the custom2.css into the html - so its mandatory to put all your css files in /design/ folder

Answers

  • sahotataransahotataran Developer, Bay Area - CA ✭✭✭
    edited January 2012 Answer ✓

    save your file as say : custom2.css in your theme/yourtheme/design/ folder
    and then open your embedfriendlythemehooks.php

    find Base_Render_before hook and

    add

    $Sender->AddCSSFile('custom2.css'); 

    your css will be added in the end and will apply your changes to your theme styling

    422
  • Thanks so much, that's exactly what I needed! :)

  • sahotataransahotataran Developer, Bay Area - CA ✭✭✭
  • Question: Where in the php document should I add that line defining the value of 'sender'? I don't speak PHP, thanks a ton for the help.

  • edited January 2012

    Actually looking at it carefully, it appears to be a css page, not a php script. I think I can figure out how to add $Sender->AddCSSFile('custom2.css');

    Also that "1." confused me, but it seems it only occurred because you put a quote thingy around your text in this forum.

    $Sender is already associated with singlecolumn (allows EmbedFriendly theme to display without right column), so hopefully associating it with something else also won't interfere.

    EDIT: The results are successful. The only thing I had to do differently (or maybe I just misunderstood your instructions) was that I put my custom2.css file inside EmbedFriendly's design folder, I did not create a separate theme and design folder.

    Thanks again sahotataran for your help.

  • sahotataransahotataran Developer, Bay Area - CA ✭✭✭
    edited January 2012 Answer ✓

    Also that "1." confused me, but it seems it only occurred because you put a quote thingy around your text in this forum.

    thats the styling for code and pre tags - your dont put it in your themehooks - put the line without 1.

    you add the line $Sender->AddCSSFile('custom2.css'); in your themehooks which can be found in yourtheme folder and if there is none then you can create one - refer to documentation for more details on theme hooks.

    $Sender is already associated with singlecolumn (allows EmbedFriendly theme to display without right column),

    You can add as many CSS files using AddCSSFile function to your $Sender

    associating it with something else also won't interfere.

    this will not interfere until and unless your CSS you wrote in custom2.css interferes with the CSS already written in your singlecolumn.css or custom.css. so basically your custom2.css definations will override those in singlecolumn.css or custom.css

    Also I don't understand how it will know that 'custom2.css' refers to the file in my custom theme folder

    the AddCSSFile method looks for your custom2.css in yourtheme/design/ folder and if it doesnot find any then it will not add the custom2.css into the html - so its mandatory to put all your css files in /design/ folder

Sign In or Register to comment.