Opened 5 years ago
Closed 11 months ago
#49539 closed defect (bug) (wontfix)
Twenty Twenty: fix theme issues
Reported by: | fahimmurshed | Owned by: | poena |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.3 |
Component: | Bundled Theme | Keywords: | needs-patch |
Focuses: | coding-standards | Cc: |
Description
Before updating/releasing this theme, please check this theme with Theme Sniffer (TRT) https://wordpress.org/plugins/theme-sniffer/ plugin.
Here is the full report of this theme and should fix that. I can't upload the patch file because of lots of issues and it's difficult to upload the patches one by one with the tickets. The core/default theme should follow the Theme submit standard/theme guide.
Please check and fix:
FILE: /wp-content/themes/twentytwenty/classes/class-twentytwenty-walker-page.php -------------------------------------------------------------------------------------------------------------- FOUND 3 ERRORS AFFECTING 3 LINES -------------------------------------------------------------------------------------------------------------- 65 | ERROR | Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: | | "page_css_class". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedHooknameFound) 81 | ERROR | Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: | | "page_menu_link_attributes". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedHooknameFound) 129 | ERROR | Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: | | "the_title". (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedHooknameFound) --------------------------------------------------------------------------------------------------------------
FILE: /wp-content/themes/twentytwenty/functions.php -------------------------------------------------------------------------------------------------------------- FOUND 3 ERRORS AFFECTING 3 LINES -------------------------------------------------------------------------------------------------------------- 50 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$content_width". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 332 | ERROR | Functions declared in the global namespace by a theme/plugin should start with the | | theme/plugin prefix. Found: "wp_body_open". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedFunctionFound) 333 | ERROR | Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: | | "wp_body_open". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedHooknameFound) --------------------------------------------------------------------------------------------------------------
FILE: /wp-content/themes/twentytwenty/template-parts/entry-header.php -------------------------------------------------------------------------------------------------------------- FOUND 6 ERRORS AFFECTING 6 LINES -------------------------------------------------------------------------------------------------------------- 10 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$entry_header_classes". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 13 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$entry_header_classes". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 30 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$show_categories". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 51 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$intro_text_width". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 54 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$intro_text_width". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 56 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$intro_text_width". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) --------------------------------------------------------------------------------------------------------------
FILE: /wp-content/themes/twentytwenty/template-parts/featured-image.php -------------------------------------------------------------------------------------------------------------- FOUND 3 ERRORS AFFECTING 3 LINES -------------------------------------------------------------------------------------------------------------- 12 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$featured_media_inner_classes". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 16 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$featured_media_inner_classes". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 27 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$caption". (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) --------------------------------------------------------------------------------------------------------------
FILE: /wp-content/themes/twentytwenty/template-parts/footer-menus-widgets.php -------------------------------------------------------------------------------------------------------------- FOUND 7 ERRORS AFFECTING 7 LINES -------------------------------------------------------------------------------------------------------------- 11 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$has_footer_menu". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 12 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$has_social_menu". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 14 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$has_sidebar_1". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 15 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$has_sidebar_2". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 27 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$footer_top_classes". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 29 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$footer_top_classes". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 30 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$footer_top_classes". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) --------------------------------------------------------------------------------------------------------------
FILE: /wp-content/themes/twentytwenty/template-parts/modal-menu.php -------------------------------------------------------------------------------------------------------------- FOUND 6 ERRORS AFFECTING 6 LINES -------------------------------------------------------------------------------------------------------------- 27 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$mobile_menu_location". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 31 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$mobile_menu_location". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 33 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$mobile_menu_location". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 35 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$mobile_menu_location". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 40 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$expanded_nav_classes". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 43 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$expanded_nav_classes". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) --------------------------------------------------------------------------------------------------------------
FILE: /wp-content/themes/twentytwenty/template-parts/navigation.php -------------------------------------------------------------------------------------------------------------- FOUND 5 ERRORS AFFECTING 5 LINES -------------------------------------------------------------------------------------------------------------- 10 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$next_post". (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 11 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$prev_post". (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 15 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$pagination_classes". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 18 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$pagination_classes". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 20 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$pagination_classes". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) --------------------------------------------------------------------------------------------------------------
FILE: /wp-content/themes/twentytwenty/template-parts/pagination.php -------------------------------------------------------------------------------------------------------------- FOUND 5 ERRORS AFFECTING 5 LINES -------------------------------------------------------------------------------------------------------------- 18 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$prev_text". (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 23 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$next_text". (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 29 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$posts_pagination". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 39 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$posts_pagination". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) 44 | ERROR | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: | | "$posts_pagination". | | (WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound) --------------------------------------------------------------------------------------------------------------
I am very happy to contribute :)
Thanks so much.
Change History (4)
#1
@
5 years ago
- Keywords needs-patch added; needs-testing removed
- Milestone changed from Awaiting Review to Future Release
- Version changed from 5.3.2 to 5.3
#2
@
5 years ago
- Owner set to williampatton
- Status changed from new to assigned
Hey @fahimmurshed, thanks for hilighti g these in a ticket.
All of these items (except maybe the $content_width
one) are actually false positives.
The content width could likely be set via filter instead although I can't remember the exact filter for it off the top of my head.
wp_body_open()
is a back compat shim for core and old versions of WP. It needs to be unprefixed.
The hook names in the walker remain as-is to stay compatible with the core class it extends from.
The global vars inside templates are actually scoped when used. PHPCS just cannot see that they get invoked inside functions of the core template loader because it analyses statically (IE without running them or WP at all).
I'll pick up this ticket for now till I double confirm these items are not problems. Likely only change needed will be the one for content_width :)
#4
@
11 months ago
- Milestone Future Release deleted
- Resolution set to wontfix
- Status changed from assigned to closed
The content_width is not as relevant when the theme's CSS controls the max-width.
Block content like embeds and other media can also be set to both wide or full width.
Because of this I am closing this ticket as wontfix.
Updating it to use a filter like in this code example from twenty nineteen is an easy fix if someone feels that the ticket needs to be reopened:
/** * Set the content width in pixels, based on the theme's design and stylesheet. * * Priority 0 to make it available to lower priority callbacks. * * @global int $content_width Content width. */ function twentynineteen_content_width() { $GLOBALS['content_width'] = apply_filters( 'twentynineteen_content_width', 640 ); } add_action( 'after_setup_theme', 'twentynineteen_content_width', 0 );
Version is used for when the issue was introduced. Since Twenty Twenty was introduced in the
5.3
release, the version should be set to5.3
. I will review the errors and see what needs to be fixed. Thanks for you ticket.