The MU forums have moved to WordPress.org

Custom CSS files (5 posts)

  1. realsol
    Member
    Posted 15 years ago #

    I am thinking about hosting other blogs on my WordpressMU other than my family and friends. Security is an issue, but I want to allow some customization of themes.

    I thought I would start by looking at wordpress.com and see how they supported custom CSS in their blogs. They have an area where customers can create a custom css file (for a extra fee). It only allows them to edit CSS. Sounds perfect for what I need. I really don't want someone to have access to php.

    Does anyone know of such a plug-in that is available in WordPress MU?

    This would allow a user to select a base them they wanted, and customize it. I am guessing that Wordpress.com then puts it in the header after the main theme's style file so users can alter the css elements. Like a 'child css file' or alternate stylesheet.

    Thanks.

  2. tdjcbe
    Member
    Posted 15 years ago #

    Does anyone know of such a plug-in that is available in WordPress MU?

    I would suggest searching the forums for 'custom css plugin' as this has been discussed at much length.

    With wp.com, you have two options. The first one, the css that the user adds in is the only css that shows (the software loads a blank css file in place of the original one). The second option, the user css file loads after the already existing one.

  3. realsol
    Member
    Posted 15 years ago #

    OK. I'll try searching again. I like the second option. Basically, I want to add a plug-in (hopefully not edit the them) that would add an additional css after the main one if a 'custom.css' file is found the the blogs upload directory.

    I have tried my own plug-in using 'add_action('wp_head', 'myfunction'), but it always shows up before the themes stylesheet in the header.

    I tried add_action('wp_head','myfunction',10) thinking that would make a difference, but still showed in the same place in the head.

  4. realsol
    Member
    Posted 15 years ago #

    I searched but really couldn't find anything that would do what I want.

    1. Allow me to customize the theme with a additional css file and put in the header after the regular theme is called, so the last line in the header.

    2. Also allow a user to upload their own custom css file.

    I have edited my own theme which calls a php file. It is only one line of code, I just include it.

    It looks at the blogs upload directory, just below the /files directory since that is unique to each blog and a user, even if they have ftp access to the /files directory won't see it.

    The php file then looks to see if there is a ccss.css file in the ../files directory. If it is there, it adds this to the end of the head. If it doesn't find it, it then looks for the ccss.css in the actuall /files directory. If there it includes it.

    This way, if I customize a theme and don't want the user to see or change it, I put it in their ../files directory. If they are paying for css access, I drop a file in their /files directory where they can access it.

    My only problem is I would rather have a plug-in take care of it for me so if my son adds themes to our MU Themes directory, this option will automatically be included in the theme.

    My problem is I can't seem to control where in the head the ccss.css file with be put, since wp_head doesn't let you control the position of your additional stylesheet.

    Is there anyway to make sure it gets added to the end of the head without having to edit each theme. This way I can upgrade themes easily as themes are changed.

    Thanks again.

  5. realsol
    Member
    Posted 15 years ago #

    OK. I looked around and really couldn't find what I was looking for:

    • I wanted a custom stylesheet I could put in the blogs upload directory and only have used if it existed, otherwise no customizations would be shown.
    • I wanted the option to also put a custom stylesheet in a different directory to keep users of the blog for accidentally messing it up or deleting it.
    • I needed this plugin to insert the custom stylesheet into the head below where my theme stylesheet was inserted, thus making it an alternate or child stylesheet, allowing me to change only the elements I wanted to rather than creating a whole stylesheet from scratch. This takes away the hassle of having to make sure my custom theme worked in all versions of WordPress. I leave it up to the theme developers.
    • I didn't want to have to edit the theme itself, if possible. This way, as theme developers came up with new versions, I wouldn't have a hard time updating the individual themes.
    • I also wanted to be able to use the custom stylesheet to change the default graphic and other elements of the login.php file (user login screen).

    So I wrote a plugin to do all of the above. If you could use it, there is more info on my site, http://rdgriffin.com/wordpress. In fact, my theme on my site is Tarski that is using a custom stylesheet. Didn't have to edit the theme!

About this Topic