Skip to content

Instantly share code, notes, and snippets.

@danielwrobert
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielwrobert/1d0c6b28b366d9a7a18c to your computer and use it in GitHub Desktop.
Save danielwrobert/1d0c6b28b366d9a7a18c to your computer and use it in GitHub Desktop.
Theme checklist grep script.
#!/bin/bash
echo "## No removing or modifying non-presentational hooks (ROW 59):"
echo "------------------------------------------------"
git grep -n "remove_action"
git grep -n "remove_filter"
echo " "
echo " "
echo "## No shortcodes are allowed (ROW 60):"
echo "------------------------------------------------"
git grep -n "shortcode"
git grep -n "add_shortcode"
echo " "
echo " "
echo "## Support WordPress-generated CSS classes (ROW 61):"
echo "------------------------------------------------"
echo "//-- .alignleft: --//"
git grep -n ".alignleft"
echo " "
echo "//-- .alignright: --//"
git grep -n ".alignright"
echo " "
echo "//-- .wp-caption: --//"
git grep -n ".wp-caption"
echo " "
echo "//-- .wp-caption-text: --//"
git grep -n ".wp-caption-text"
echo " "
echo "//-- .gallery-caption: --//"
git grep -n ".gallery-caption"
echo " "
echo "//-- .sticky: --//"
git grep -n ".sticky"
echo " "
echo "//-- .bypostauthor: --//"
git grep -n ".bypostauthor"
echo " "
echo " "
echo "## Shouldn’t include admin/feature pointers (ROW 73)"
echo "------------------------------------------------"
git grep -n "wp-pointer"
echo " "
echo " "
echo "## No custom post types and no custom taxonomies (ROW 74)"
echo "------------------------------------------------"
git grep -n "register_post_type"
git grep -n "register_taxonomy"
echo " "
echo " "
echo "## No disabling of the admin tool bar (ROW 77)"
echo "------------------------------------------------"
git grep -n "show_admin_bar"
echo " "
echo " "
echo "## Use get_template_directory() rather than TEMPLATEPATH to return the template path (ROW 78)"
echo "------------------------------------------------"
git grep -n "TEMPLATEPATH"
echo " "
echo " "
echo "## Use get_stylesheet_directory() rather than STYLESHEETPATH to return the template path (ROW 78)"
echo "------------------------------------------------"
git grep -n "STYLESHEETPATH"
echo " "
echo " "
echo "## Must spell “WordPress” correctly in all public facing text: all one word, with both an uppercase W and P (ROW 107)"
echo "------------------------------------------------"
git grep -n "wordpress"
git grep -n "Wordpress"
echo " "
echo " "
echo "## Use esc_attr() for text inputs and esc_html() for textareas. (ROW 133)"
echo "------------------------------------------------"
echo "//-- esc_attr(): --//"
git grep -n "esc_attr("
echo " "
echo "//-- esc_html(): --//"
git grep -n "esc_html("
echo " "
echo " "
echo "## You should use *_url() template tags, rather than bloginfo() equivalents (ROW 153)"
echo "------------------------------------------------"
git grep -n "bloginfo("
echo " "
echo " "
echo "## Themes may optionally unregister core Widgets (ROW 165)"
echo "------------------------------------------------"
git grep -n "unregister_widget"
echo " "
echo " "
echo "## It is recommended to use core markup for the following forms (ROW 169):"
echo "------------------------------------------------"
echo "//-- Search Form: --//"
git grep -n "search_form"
echo " "
echo "//-- Login Form: --//"
git grep -n "login_form"
echo " "
echo " "
echo "## If incorporated, features must support the core WordPress implementation (ROW 172):"
echo "------------------------------------------------"
echo "//-- Automatic Feed Links: --//"
git grep -n "add_theme_support( 'automatic-feed-links' )"
echo " "
echo "//-- Sidebars: --//"
git grep -n "register_sidebar()"
git grep -n "dynamic_sidebar()"
git grep -n "register_widget()"
git grep -n "widgets_init"
echo " "
echo "//-- Nav Menus: --//"
git grep -n "wp_nav_menu()"
git grep -n "register_nav_menu()"
git grep -n "register_nav_menus()"
echo " "
echo "//-- Post Thumbnails: --//"
git grep -n "the_post_thumbnail()"
git grep -n "add_theme_support( 'post-thumbnails' )"
git grep -n "post-thumbnails"
echo " "
echo "//-- Custom Headers: --//"
git grep -n "add_theme_support( 'custom-header' )"
echo " "
echo "//-- Custom Backgrounds: --//"
git grep -n "add_theme_support( 'custom-background' )"
echo " "
echo "//-- Editor Styles: --//"
git grep -n "add_editor_style()"
echo " "
echo " "
echo "## If used in theme, standard template files are required to be called using the correct template tag (ROW 245):"
echo "------------------------------------------------"
echo "//-- get_header: --//"
git grep -n "get_header()"
echo " "
echo "//-- get_footer: --//"
git grep -n "get_footer()"
echo " "
echo "//-- get_sidebar: --//"
git grep -n "get_sidebar()"
echo " "
echo "//-- comments_template: --//"
git grep -n "comments_template()"
echo " "
echo "//-- get_search_form: --//"
git grep -n "get_search_form()"
echo " "
echo " "
echo "## If you use the relevant templates your theme should include (ROW 255):"
echo "------------------------------------------------"
echo "//-- wp_title: --//"
git grep -n "wp_title()"
echo " "
echo "//-- wp_head: --//"
git grep -n "wp_head()"
echo " "
echo "//-- body_class: --//"
git grep -n "body_class()"
echo " "
echo "//-- content_width: --//"
git grep -n "content_width"
echo " "
echo "//-- post_class: --//"
git grep -n "post_class()"
echo " "
echo "//-- wp_link_pages: --//"
git grep -n "wp_link_pages()"
echo " "
echo "//-- paginate_comments_links: --//"
git grep -n "paginate_comments_links()"
echo " "
echo "//-- previous_comments_link: --//"
git grep -n "previous_comments_link()"
echo " "
echo "//-- next_comments_link: --//"
git grep -n "next_comments_link()"
echo " "
echo "//-- posts_nav_link: --//"
git grep -n "posts_nav_link()"
echo " "
echo "//-- previous_posts_link: --//"
git grep -n "previous_posts_link()"
echo " "
echo "//-- next_posts_link: --//"
git grep -n "next_posts_link()"
echo " "
echo "//-- paginate_links: --//"
git grep -n "paginate_links()"
echo " "
echo "//-- wp_footer: --//"
git grep -n "wp_footer()"
echo " "
echo " "
echo "## Do not include code that won’t run on WP.com. This includes any code for compatibility and the use of IS_WPCOM (ROW 283)"
echo "------------------------------------------------"
git grep -n "IS_WPCOM"
echo " "
echo " "
echo "## Themes must not directly access PHP super globals (ROW 286)"
echo "------------------------------------------------"
git grep -n "GLOBALS"
git grep -n "_SERVER"
git grep -n "_GET"
git grep -n "_POST"
git grep -n "_FILES"
git grep -n "_COOKIE"
git grep -n "_SESSION"
git grep -n "_REQUEST"
git grep -n "_ENV"
echo " "
echo " "
echo "## No output buffering (ROW 287)"
echo "------------------------------------------------"
git grep -n "ob_start()"
git grep -n "ob_get_contents()"
git grep -n "ob_end_clean()"
echo " "
echo " "
echo "## No custom fields or post meta boxes (ROW 288)"
echo "------------------------------------------------"
git grep -n "get_post_meta"
git grep -n "add_meta_box"
echo " "
echo " "
echo "## Provide language context where appropriate (ROW 310)"
echo "------------------------------------------------"
git grep -n "__("
git grep -n "_x("
git grep -n "_n("
echo " "
echo " "
echo "## Themes need to support Jetpack Infinite Scroll (ROW 320)"
echo "------------------------------------------------"
git grep -n "infinite-scroll"
echo " "
echo " "
echo "## Themes should support new Title Tag functionality"
echo "------------------------------------------------"
git grep -n "title-tag"
echo " "
echo " "
echo "## Themes should consider support for Site Logo (optional)"
echo "------------------------------------------------"
git grep -n "site-logo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment