Forums

change bloginfo and customizing a stylesheet (5 posts)

  1. majed.online@hotmail.com
    Member
    Posted 3 years ago #

    HI all, how can I change bloginfo variables especially bloginfo('stylesheet_url')in HEADER.PHP in the theme folder.?

    in fact I want a way to use the rtl.css with style.css to make the alignment from right to left.

    thank you

  2. Michael Fields
    Theme Wrangler
    Posted 3 years ago #

    <?php bloginfo('template_url') ?>/rtl.css

  3. majed.online@hotmail.com
    Member
    Posted 3 years ago #

    thank you.. I added your line in the header.php in the theme. and many elements became right. in the other hand there is not any effect of dir="rtl" in the html tag !!

    also I noted there are many css files with rtl suffix in the wp-admin. But I don't know how to use them or how to let the design of the control panel take care of them .. any idea ??

  4. Andy Potanin
    Member
    Posted 3 years ago #

    If you want to actually change it:

    Add the following code to your functions.php file.

    add_filter('stylesheet_uri', 'change_css');

    function change_css() {
    return "http://website.com/yourcssfile.css";
    }

    WordPress loads the functions.php file prior to loading the template files. The add_filter we use here modifies stylesheet_uri, so when it gets called within your template, it will be the path you specified.

    You can do this with most bloginfo variables.

    View wp-includes/theme.php if you are curious what else can be modified, anything with "apply_filters("whatever")....." can be modified, just replace whatever with what you're modifying in your add_filter.

    Good luck

  5. Andy Potanin
    Member
    Posted 3 years ago #

    Perhaps this is a better example:

    add_filter('stylesheet_uri', 'change_css');

    function change_css() {
    return get_bloginfo('template_url') . '/my_custom_stylesheet_name.css';

    }

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.