Closed (fixed)
Project:
Drupal Commons
Version:
7.x-3.x-dev
Component:
Theme
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
22 Dec 2011 at 23:38 UTC
Updated:
12 Feb 2015 at 23:13 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jsibley commentedIn case anyone else is looking, the themes are under:
profiles/drupal_commons/themes
and it is possible to use a local.css file.
Comment #2
ezra-g commentedThanks for posting your answer!
Comment #4
summit commentedHi, I set this to active if thats ok.
I do not see a local.css.sample as stated on: http://fusiondrupalthemes.com/support/documentation/customizing-your-the... within latest Commons 7.dev.
How can I get a local.css to work please?
Greetings,
Martijn
Comment #5
autolyst commentedlook in the commons_origins folder subdirectory css folder most changes I had to make were to the global css file
Comment #6
summit commentedHi, I do not see a local.css also not the code documented how to get a local.css to work. Am I looking in the wrong place?
Greetings, Martijn
Comment #7
Zarabadoo commentedCommons Origin 3.x does not currently support this feature.
The 2.x version of Commons used Fusion as the base for its default theme, and local.css was a function of that. The 3.x branch uses Adaptive Theme as a base and it is not a native feature. This is likely where the confusion is as this issue was opened initially for 2.x.
Currently this is not a feature on the roadmap, so I cannot suggest waiting for it. I also cannot recommend editing any of the source CSS files directly. It is best to try making a subtheme of commons_origins in your sites/all/themes directory and adding your css overrides there. This has a very important advantage of being separate from the core code of Commons, but still inherits the function of it. This will allow for easier updates and minimizes the chance your changes will get overridden in an update.
Comment #8
Zarabadoo commentedOne other thing you can do is add a local.css to the theme directory and then adding a stylesheets entry to the commons_origins.info. It is better than editing one of the other stylesheets directly as it keeps your changes and overrides isolated a bit. I can't say it is fully recommended as you are still editing a file in a contributed theme, but at least it makes the editing of files limited to one line. The above subtheming approach is still going to be the best long term solution.
Comment #9
ezra-g commentedMarking as fixed per #8.
Comment #10
Antonio01 commentedHi,
As it is commented in the #7 answer the best way to customize commons_origins css is to create a new subtheme.
I tried to create one subtheme following the link making subtheme but it's not clear for me as commons subtheme is AT.
I did it in that way without result:
1) In /profiles/commons/themes/contrib I create a new folder "subtheme"
2) I copy commons_origins.info to my folder "subtheme"
3) I rename the file to subtheme.info and edit it:
a) I changed theme information in that way:
name = subtheme
description = Subtheme of Commons origins
core = 7.x
base theme = Commons Origins
engine = phptemplate
screenshot = screenshot.png
b) i deleted Stylesheets references of AT and add stylesheets[all][] = css/subtheme.css
Note: If i leave stylesheets[screen][] = css/global.base.css stylesheets[screen][] = css/global.styles.css
c) I deleted Scripts references
d) I leave the rest
I join my info file "subtheme.info" And a screen shot of my folder templates.
4) i go in my commons installation /admin/appearance and enable my new subtheme
5) I click on the settings subtheme and I have this message:
Notice: Undefined property: stdClass::$prefix in system_theme_settings() (line 547 of /var/www/ifr73dev/modules/system/system.admin.inc).
Notice: Undefined index: Commons Origins in system_theme_settings() (line 575 of /var/www/ifr73dev/modules/system/system.admin.inc).
Notice: Trying to get property of non-object in system_theme_settings() (line 575 of /var/www/ifr73dev/modules/system/system.admin.inc).
6) If i set as default my subtheme the result is catastrophic :)
Notice: Undefined index: Commons Origins in drupal_theme_initialize() (line 98 of /var/www/ifr73dev/includes/theme.inc).
Notice: Trying to get property of non-object in phptemplate_init() (line 12 of /var/www/ifr73dev/themes/engines/phptemplate/phptemplate.engine).
....
I know I'm doing a lot of things wrong but i would like to know in which way to go.
Is it really possible to make a subtheme of commons without making a copy of AT folders ? (commons/themes/contrib/adaptivetheme/at_subtheme)
In the info file instead of "base theme = Commons Origins" do we need to put "base theme = adaptivetheme" ?
if there is an a step by step doc i will be happy to follow it.
Thanks,
Antonio
Comment #11
rosemeria commentedHello Antonio,
Here is an AT minimal subtheme for commons_origins to get you started - it's been working for me. Place your css overrides in css/custom.css. Use custom.css to provide overrides to the main styles. This file always loads last so you can override anything in the other style-sheets.
More info for AT themes - http://adaptivethemes.com/documentation
--Rose
Comment #12
Antonio01 commentedHello Rose,
I've just tested you're AT minimal subtheme but I've noticed some css are not loaded.
From /commons/themes/contrib/commons_origins/css this files are not loaded:
responsive.custom.css
responsive.desktop.css
responsive.smartphone.landscape.css
responsive.smartphone.portrait.css
responsive.tablet.landscape.css
responsive.tablet.portrait.css
Could you check if this file are loaded when you configure your sub-theme in your site?
From /sites/default/files/adaptivetheme/commons_origins_files this file is not loaded:
commons_origins.responsive.layout.css.
I think because this file is missing all the original design break.
do you have any idea of the problem?
note: I have copied your subtheme in /profiles/commons/themes/contrib/
Thank you very much for your help
Antonio
Comment #13
rosemeria commentedAntonio,
Missing a file - oops! Copy this file from Commons Origins theme to your sub-subtheme.
css/responsive.custom.css
From AT readme file..
Overlapping/Custom Media queries:
By default the media queries in Adaptivetheme are "stacked", meaning they do not overlap. This makes it very easy to target one set of device width and not have those styles "leak" over into others. However it can also mean you may need to duplicate CSS that you would rather have cascade.
To use custom media queries the sub-theme includes a special file called:
responsive.custom.css
To enable the use of this file in your theme see your theme settings:
Layout & General Settings > CSS > Custom Media Queries
This file has embedded media queries which means you MUST set them yourself. Defaults are provided.
Comment #14
Antonio01 commentedHi!
I think I'm near of the solution but there's something wrong as you can see in the attached file. The menu don't get the right css, some textbox are larger ...
Others css need to be copied in the css subtheme directory?
I have read this section of the readme file but it's not clear how to set the files as in Layout & General Settings > CSS > Custom Media Queries i can't select any files because the textbox is read only. i attached the second screenshot.
Do you think i need to add the Saas directory too?
Thank you for your help i'm not very far to start with my own subtheme !!
Antonio
Comment #15
Antonio01 commentedHi,
I find the problem but i don't have any idea how to resolve it.
Templates pages in //profiles/commons/themes/contrib/commons_origins/templates are not applied to the page when the new sub-theme of commons is on.
As an example with my the new subtheme the main menu of commons have this code:
With Original Commons theme
All the tags with ID are not applied : id="menu-bar", id="block-system-main-menu"
I try to copy the templates folder in the sub theme but without result. If anybody know how to configure properly sub theme and templates i will be happy to hear some response of this headache puzzle :)
Thank you!
Antonio
Comment #16
Anonymous (not verified) commentedrosemeria,
I see this has not been addressed since March 16 so I wanted to try to verify a few things, as I too want to setup a subtheme so I don't lose my changes whenever Commons is updated.
To setup a subtheme, I just need to follow your steps in #11 and #13? There is nothing else? I have looked at the docs on the ATTheme site you referenced, but it seems to be more geared to creating the first subtheme, not a subtheme of a subtheme. ;-)
Thanks!
Comment #17
Anonymous (not verified) commentedFYI - I followed your instructions by extracting the subtheme into \sites\all\themes, updating the .info file and adding the responsive.custom.css file. I enabled the subtheme and set it as the default. In Commons, it totally changed the What's Going On page and made it a single column. Obviously, this will not work
I simply want to apply some changes that load last, not to radically change the theme. Am i missing something?
Comment #18
summit commentedCan someone maybe post the commons_origins theme including a subtheme in a zip file?
We can work from there then?
greetings, Martijn
Comment #19
Anonymous (not verified) commentedI figured it out. I copied the template.php and theme-settings.php from \profiles\commons\themes\contrib\commons_origins into the subtheme folder. This made sure the commons_origins templates were loaded. YAY!Now, I assume I just need to make my changes in the custom.css file and it will be golden. I'll post what happens...I guess I jumped the gun. As soon as I tried to flush the cache, I received numerous errors and the look went back to NOT loading the Origins templates.
Comment #20
Zarabadoo commentedIt will likely be better not to use the entirety of an Adaptive subtheme. It will be too heavy for simple css changes. You will end up with a very large chunk of css and php overrides that you will not want or need.
To make things simpler, create a directory for your theme, and in the .info for it, add a line of
base theme = commons_origins. From there, use the standardstylesheet[all][]entries for your overrides. Your theme will inherit all of the styles of Commons Origins without a lot of extra weight. I have not tried this personally, but it should work as it is just using standard Drupal functionality.If you want more information, the Drupal 7 theming documentation should be more than enough to get you up and running. The at_subtheme is really only intended for a singular instance and not to be stacked one after another. After the first one, it is best to use the lighter core approach.
A quick freehand theme.info for you to start with:
Comment #21
Anonymous (not verified) commentedZarabadoo,
Thank you for your assistance and advice. I will try your approach.
Comment #22
Anonymous (not verified) commentedIn case anyone else is following this, I also had to add the core = 7.x so it would allow the theme to be used.
name = Theme name
description = A short summary
base theme = commons_origins
core = 7.x
stylesheets[all][] = styles.css
Comment #23
Anonymous (not verified) commentedReading through http://drupal.org/node/225125, as suggested. Finding some info re: the regions and etc. Will post again when I have something.
Comment #24
Anonymous (not verified) commentedI read through the subthemeing instructions. It states, "As the sections below indicate, the sub-theme inherits most properties of the base theme. The important exceptions are regions, core version, and color info." I copied the regions sections. Still does not display the correct blocks and etc.
PUNT!
Comment #25
Anonymous (not verified) commentedI tried the steps in #8 and it worked. I will just make sure I have a copy of my custom overrides in there. So, marking as fixed.
Comment #26
summit commentedHi @gr8britton, Are you willing to winzip your theme including subtheme so that others can move from there?
Comment #27
Antonio01 commentedHello,
The #8 is not the solution as you don't create a new subtheme. This solution only add a reference in the .info file with a custom css.
What i was trying to do is a subtheme of commons_origins and i didn't find how to solve the #15. I think i'm close but only if an expert try to do it we will have a response :=P.
thank you to reactivate this post :=) i m still waiting how to solve this!
Antonio
Comment #28
Anonymous (not verified) commentedSummit,
I did not create a subtheme. I simply referenced the css file and added the css file in the css directory. I gave up trying to get the subtheme to work.
Comment #29
summit commentedHi,
Please someone post his/her subtheme as winzip and maybe also the changes in commons_origins.
greetings, Martijn
Comment #30
Zarabadoo commentedI hve taken some time to dig into this thing a bit more, and I personally want people to be able to subtheme this system. The .info solution works to some extent, but it is not optimal. It will require placement of the main menu in the menu_bar region. This will get all the blocks that are using the core blocks configuration in place. Since everything else in the distribution is using Panels, they are already in the appropriate region.
The layout css is where things start falling apart. Part of the Adaptive core functionality is configuration of Panel layouts from the admin. To do this, it takes all of the theme's settings and generates a css file and loads it from the site's files directory. I am seeing if there is something I can do to make this work. This is important, personally, as it is best to not touch files in the contributed theme or add files to it.
So to summarize, a subtheme works, it is just missing styles for panel layouts.
Comment #31
Zarabadoo commentedAfter some more experimentation, a subtheme of Commons Origins is possible. The basic structure for the .info file is as follows:
This will allow Drupal to validate the theme and have all the regions defined. If this is how your .info is structured before activation, all of your blocks will fall into place. If you previously did not have the regions defined before activating, you will need to jump into the blocks admin and shuffle some things around. The biggest seems to be that main menu will need placed in the menu_bar region.
When you look at the theme, the content will be in a single column. This is because at_core has not generated the css based on the configuration. To do that, visit your theme's settings page (in my case, admin/appearance/settings/test_theme) and simply save it. This will kickstart Adaptive Theme's css generation functionality build the appropriate files.
I have tested this on a fresh install, and it worked fine. The further along your individual projects are, the less I am going to be able to predict your success. I can't see there being many issues unless you have altered the Commons Origins code.
Comment #32
Antonio01 commentedWorked for me too. My problem was main menu was not placed in the menu_bar region!
Thank you Zarabadoo!
Comment #33
summit commentedHi, anyone can post his subtheme please? Or is making this info file enough?
greetings, Martijn
Comment #34
Zarabadoo commented@Summit Making an empty theme directory with this info is enough.
Comment #35
markbannister commentedJust a summary to start doing basic CSS customization using this thread:
Create Folders
Location
From http://drupal.org/node/225125">sub-theming
create folder in: sites/example.com/themes/ ("example.com" stands for your site name)
or,
if you want to use your sub-theme for several sites, inside: sites/all/themes/
Folder Name
Name your theme and create a folder with that name: myNewSubThemeName
create sub folder of myNewSubThemeName, named "css"
Create files
create myNewThemeName.info file in your myNewSubThemeName folder
Basic info for this file:
create "custom.css" in the sub folder myNewSubThemeName/css
basic information
Ownership and Permissions
change owner, group and permissions of folder and file you created
chown to appropriate owner and group (look at other themes and use that)
chomd 775 (or like other theme files and directories)
Enable Theme
Navigate to mysiteurl/admin/appearance
Scroll to your new theme.
Enable your theme (You may have to refresh the page for you new theme to show up.).
Wait for page refresh and then click settings for you new theme.
If you want to make changes do so. Even if you don't make changes, click Save for your default theme settings to take effect.
Customize CSS
Modify your custom.css file to add your fancy new css which will override the theme's.
To test, add something like p { color: red; } into the file and see if it turns paragraphs red. You may need to clear Drupal Cache and your browser's cache.
If you look at the page source of your webpage you should find your sub-theme path in the style settings of the page.
Edit:
Hints if you have issues:
Make sure to turn off caching admin/config/development/performance
Comment #37
behoppe333 commentedThanks all!
@markbannister the consolidated instructions in #35 are fantastic.
I had to add one small step for my sub-theme to work: copy logo.png from profiles/commons/themes/contrib/commons_origins into the folder that contains the subtheme
Comment #38
tradenet commentedYou'll also have to upload your new logo as well if you're not using the stock one.