Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 12:03 pm EDT

Geeklog Forums

Override plugin css?


Status: offline

syco

Forum User
Junior
Registered: 04/24/04
Posts: 15
Location:Liège, Belgium
Hello!

I hope this is the right place for my question. I was wondering if there was an easy way to handle a plugin's CSS with my own theme.

eg: I'd like to customise the forum and calendar plugins but without breaking other themes by fiddling directly with the plugin's original style (and have to re-fix it each time the plugin is updated for example).
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
You can create your own custom theme based on a default theme. See here

In your yourtheme/functions.php file add

Text Formatted Code
/**
 * Return an array of CSS files to be loaded
 */
function theme_css_yourtheme()
{
    global $_CONF;

    return array(
               
                array(
            'name'       => 'custom',
            'file'       => '/layout/' . $_CONF['theme'] . '/css/custom.css',
            'attributes' => array('media' => 'all'),
            'priority'   => 200
        )      
    );
}


and make any custom css in the yourtheme/css/custom.css
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1468
Location:Canada
Actually with the release of Geeklog 2.1.1 plugins can support multiple themes and a set of plugin templates can be based on other templates. The core plugins and the forum support this. The forum is the only plugin at the moment that actively uses this. We added this so plugins can be upgraded with out wiping out any custom template and css changes.

Take a look at the plugins/forum/template directory. You will see a default and denim directory. If the denim theme is active the forum plugin will use the templates found in the denim directory. If the template is not found it will use the one found in the default directory. The default directory must contain all required template files and is used if a template directory is not found. For plugins css and javascript works in a similar way under:

public_html/forum/css
public_html/forum/javascript

The plugin template theme directory can also have a functions.php file now. Take a look at:

plugins/forum/template/denim

for an example.

If you are developing a Geeklog theme if you want you could also include the template files for the plugin right in the root of the theme directory under a directory named after the plugin (like forum). You can only include the template files you want changed as if any are missing it will fall back to the default template files for the plugin.

More information can be found on the wiki http://wiki.geeklog.net/index.php/Theme_Developers_Guide#Theme_Specific_Plugin_Templates.
One of the Geeklog Core Developers.
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1468
Location:Canada
I also forgot to mention. The plugin template system is smart enough to also check if the Geeklog theme you are using has theme default. If it does the plugin will check first if templates/css/javascript exists for the theme, then the theme default, and if those directories do not exist it will then grab it from the plugin default directory (the terminology can be a little confusing at first Wink
One of the Geeklog Core Developers.
 Quote

Status: offline

syco

Forum User
Junior
Registered: 04/24/04
Posts: 15
Location:Liège, Belgium
Thanks to both of you Smile

The second solution was what i thought of back then, but it would have implied to rewrite each plugin to act like the new forum plugin Rolling Eyes
If all future plugins could work the same way it would be perfect Smile
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1468
Location:Canada
It actually wouldn't take long for most developers to convert their plugins as all you need to do is change a few lines of code where ever the plugin specifies a location of the template, css and javascript files.
One of the Geeklog Core Developers.
 Quote

All times are EDT. The time is now 12:03 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content