How to stop WordPress Admin pages from inheriting my Theme styles (1 post)

  1. matstillo
    Posted 3 years ago #

    Hi there,

    I'm setting up a new site on a multisite install. I'm using Twenty Twelve as a parent Theme & am making changes in a child Theme I have created.

    In the child Theme functions.php, I am dequeueing the Twenty Twelve Google font & am enqueueing my own, as a body font.

    The problem I am having is that this new font is then being used as the main font in the admin area for the site. It just isn't suitable in this application & I want to just revert back to using the default admin font for the admin pages.

    I can't see anyone else having this same problem & can't figure out how to turn it off as a setting in admin.

    I think it would be useful to still be able to see this font being used in the visual editor, but I have no need at all for it to be used as the main admin font!

    Where I think the complication may be coming from, is that rather than replacing the Twenty Twelve Google font css file with another Google font, I am then loading the new font from fonts.com, which requires me to use a .js file link instead.

    I am using wp_enqueue_script for the new font (rather than wp_enqueue_style which was being used for the Google css file), and obviously it is all working OK, as the font is everywhere!

    It is only on the site where I am enqueueing a font via .js that I have the problem. On a similar setup where I am replacing the Twenty Twelve font with another Google font .css, it does not affect admin.

    I guess I may need to put a conditional statement around the enqueueing of the .js file, but what would that be, to exclude WordPress admin pages?

    Thanks in advance for the help!

Topic Closed

This topic has been closed to new replies.

About this Topic