GithubHelp home page GithubHelp logo

Comments (5)

jrfnl avatar jrfnl commented on July 2, 2024

By the looks of it, there already is a sniff for this in WP-VIP: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/WordPress/Sniffs/VIP/AdminBarRemovalSniff.php

The check in Theme Check however is more comprehensive, so I suggest improving the VIP check upstream and then adding it to the Theme rule set.

from wpthemereview.

grappler avatar grappler commented on July 2, 2024

@jrfnl Was there something specific you saw that needed improving other then add a check for #wpadmin and .show-admin-bar?

from wpthemereview.

jrfnl avatar jrfnl commented on July 2, 2024

@grappler I believe those checks should be done on both the PHP as well as CSS files and should be quite specific. I mean, a theme changing the color of the admin bar to be in line with their front-end theme should not see this notice.

I also think that for the existing PHP function based check, the parameter values should be checked against some whitelisted values.
I don't think: add_filter( 'show_admin_bar', '__return_true' ); should trigger this error and while it will be very rare indeed to come across that code, it shouldn't be hard to check for.

I also think the sniff should be moved from Sniffs/VIP/ to Sniffs/WP/ as it's not VIP specific, though we will need to check if VIP agrees with the proposed adjustments and if not, have a second sniff just for the CSS related checks.

I have made a small start locally for the changes needed upstream - mainly creating the unit tests. Want me to share this for you to continue ?

from wpthemereview.

justintadlock avatar justintadlock commented on July 2, 2024

I believe those checks should be done on both the PHP as well as CSS files and should be quite specific. I mean, a theme changing the color of the admin bar to be in line with their front-end theme should not see this notice.

Definitely agree. I've said as much and thought that we had decided not to target CSS a while back. I think we'd all be OK with a check for something like this (or variations):

#wpadminbar { display: none; }

I also think that for the existing PHP function based check, the parameter values should be checked against some whitelisted values.
I don't think: add_filter( 'show_admin_bar', '__return_true' ); should trigger this error and while it will be very rare indeed to come across that code, it shouldn't be hard to check for.

Force-showing is as equally bad as force hiding it. Whether to show/hide the admin bar is outside the scope of themes. This is core and plugin territory.

from wpthemereview.

jrfnl avatar jrfnl commented on July 2, 2024

Whether to show/hide the admin bar is outside the scope of themes. This is core and plugin territory.

The altered sniff will need to be as re-usable as possible as it is used for plugins as well in VIP context. So in that case, we either need a property switch which allows for checking that those functions are used at all (themes) or checking that those functions don't hide the admin bar (rest of the world).

from wpthemereview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.