X

Comment forcer la zone d’administration à utiliser le schéma de couleurs classique de l’administration

Snippets by IsItWP

Vous cherchez un moyen d’utiliser le schéma de couleurs classique de l’administration ? Ce snippet forcera la zone d’administration à utiliser la palette de couleurs classique.

Instructions:

Tout ce que vous avez à faire est d’ajouter ce code au fichier functions.php de votre thème ou dans un plugin spécifique à votre site:

add_filter('get_user_option_admin_color','change_admin_color');
function change_admin_color() {
    return 'classic';
}

Note : Si c’est la première fois que vous ajoutez des extraits de code dans WordPress, veuillez vous référer à notre guide sur comment copier/coller correctement des extraits de code dans WordPress, afin de ne pas casser accidentellement votre site.

Si vous avez aimé cet extrait de code, n’hésitez pas à consulter nos autres articles sur le site comme : CSS Hero Review.

Commentaires   laisser une réponse

  1. Terence Milbourn juin 7, 2014 à 8:07 am

    Admin Color Schemes ~ they should be switchable NOT by user but by site. Think how much swearing and shouting that would save!

    Seriously though, what donut thought that making it switchable by user profile was a good idea? I guess there’s some things about WordPress and WP developers I will never understand.

    By the way, if you ever come across a code snippet that I can add to my functions.php and give me a choice of selecting admin color scheme by site, rather than user, I will be forever in your debt.

      1. Terence Milbourn juin 7, 2014 à 10:13 am

        Hi Kevin,

        Thanks for the comeback. But I don’t want to stop a color being selected, I want to make it specific to a site, so that I can have one site in one color set and another in something different, rather than it is at the moment, linked to the user profile.

        1. Hi Terence,
          If you want to define things by site but not let users change their own color settings. Use the above snippet to define the theme to use and one of the others I provided to remove the controls for users. This should work great,

          1. Terence Milbourn juin 9, 2014 à 6:57 pm

            Thanks, I can see how that would work. I’ll go try it.

          2. Hi Terence,
            Does this mean that you will forever be in my debt? At some point in the future I will ask you for a favor. 😉 just kidding! glad I could help, enjoy the snippets!

          3. Terence Milbourn juin 10, 2014 à 10:39 pm

            Absolutely. Whatever you want. You just have to name it.

      2. Terence Milbourn novembre 21, 2015 à 8:01 am

        Never did get to the bottom of this.

        My goal is to be able to switch the color scheme for the super-admin dependent upon which blog he visits in a multisite setup.

        In other words, if he is the dashboard on the primary blog (#1), its “flat”, and if in blog #2 its “blue”.

        And what would be ideal is if that the color scheme went to “red” in any option in the Network Admin dashboard was selected.

        To me that’s clean, clear and logical. Unlike the single color scheme, at the moment, which follows the admin around the site.

        Do you see what I mean?

  2. Brand Dedication mars 7, 2014 à 1:41 am

    @wpsnipp:disqus Hey, still loving your site! This snippet still work and this was the first place I came to find this handy snippet! ~Thanks

    1. Glad to hear it, still lots more snippets 🙂

  3. Tried this method on WP3.2, but it doesn’t seem to work. Any idea?

    1. Somehow it takes time to go in effect, not sure why, but it works. Thank you.

      1. I Juts tested it out and had no issues could have been cache, but should work fine.

  4. Hi, thanks for this, It’s been a big help. I was just wondering, what is the purpose of the $results variable, when it doesn’t seem to be used?

    It’s been confusing me for a while.

    Cheers

    1. Hi David it’s not required, as you may already know. Ill make and update to remove this it was a mistake.

  5. Tweets that mention Wordpress Force admin color scheme – wpsnipp.com Wordpress code snippets for your blog -- Topsy.com décembre 23, 2010 à 12:16 pm

    […] This post was mentioned on Twitter by Marcel Bootsman. Marcel Bootsman said: RT @wpsnipp: #wordpress Force admin color scheme http://bit.ly/i98TsF #blog please RT 🙂 […]

Ajouter un commentaire

Nous sommes heureux que vous ayez choisi de laisser un commentaire. N'oubliez pas que tous les commentaires sont modérés conformément à notre privacy policy, et que tous les liens sont en nofollow. N'utilisez PAS de mots-clés dans le champ du nom. Engageons une conversation personnelle et constructive.

WordPress Launch Checklist

L'ultime liste de contrôle pour le lancement de WordPress

Nous avons rassemblé tous les éléments essentiels de la liste de contrôle pour le lancement de votre prochain site Web WordPress dans un ebook pratique.
Oui, envoyez-moi le gratuit !