WPTT / theme-sniffer

Theme Sniffer plugin using sniffs.
MIT License
270 stars 3 forks source link

Additional tests for tags used #118

Open timelsass opened 5 years ago

timelsass commented 5 years ago

The sniff of tags is a good start, but I think the next step to increase usefulness of these checks would be to ensure that the tags used are applied correctly within the theme.

Examples:

custom-header

Check Check that add_theme_support( 'custom-header' ); is being used in the theme php files Result Error when not found

custom-logo

Check Check that  add_theme_support( 'custom-logo' ); is being used in the theme php files Result Error when not found

custom-menu

Check Check that register_nav_menu() or register_nav_menus(), is being used in the theme php files Result Error when not found Check Check that wp_nav_menu() is being used in the theme php files Result Error when not found

wide-block

Check Check that .alignwide and .alignfull as CSS classes are used in theme's css files and/or php files. Result Error if not found

translation-ready

Check check that theme has any translatable strings. Result Error if theme has no translatable strings. Check Check that all sniffs pass for textdomain issues. Result Error theme can't be translation ready if these fail. Check Check that load_theme_textdomain() is used in theme's php files. Result Error if the strings aren't ever loaded.

threaded-comments

Check check that a script with the handle comment-reply exists in theme's php file. Result Warning - a theme could implement it's own way of handling threaded comments, but this should be brought to author's attention with reference to how to add via wp_enqueue_script the normal way in case they just forgot.

sticky-post

Check check that .sticky is being used in theme's css and/or php files. Result Error - theme should style sticky post if using tag.

rtl-language-support

This one could get more in depth, but generally something like this: Check check that rtl.css stylesheet exist in theme's css files. Result

There are others that could be done as well, but they might be best served as their own tickets instead of creating a giant one like this as it could get pretty long. I think maybe some of this belongs in the WPTRT/WPThemeReview repo as I think the way to best handle this efficiently would be first process the style.css/readme.txt to set flags, which could then include additional sniffs when the runner is created. I'm not really sure where the line would be drawn though as I'm not horribly familiar with the relationship between the two repos. I just wanted to be sure to write down some of these thoughts for reference as this project grows.

dingo-d commented 5 years ago

This sounds like it could be covered by this: https://github.com/WPTRT/WPThemeReview/issues/174

Love the initiative and the explanation for this issue :+1: