Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mhasan3/f0658aa3455c9a3756316ee340f16dea to your computer and use it in GitHub Desktop.
Save mhasan3/f0658aa3455c9a3756316ee340f16dea to your computer and use it in GitHub Desktop.
Theme testing process (from Wordpress Codex)

Theme Testing Process

from Theme Development (Wordpress Codex)

  • Fix PHP and WordPress errors. Add the following debug setting to your wp-config.php file to see deprecated function calls and other WordPress-related errors: define('WP_DEBUG', true);. See Deprecated Functions Hook for more information.
  • Check template files against Template File Checklist.
  • Do a run-through using the Theme Unit Test.
  • Validate HTML and CSS. See Validating a Website.
  • Check for JavaScript errors.
  • Test in all your target browsers. For example, IE7, IE8, IE9, Safari, Chrome, Opera, and Firefox.
  • Clean up any extraneous comments, debug settings, or TODO items.
  • See Theme Review if you are publicly releasing the Theme by submitting it to the Themes Directory.

Template File Checklist

from Theme Development (Wordpress Codex)

When developing a Theme, check your template files against the following template file standards.

Document Head (header.php)

  • Use the proper DOCTYPE.
  • The opening <html> tag should include language_attributes().
  • The "content-type" meta element should be placed before everything else, including the title element.
  • Use bloginfo() to fetch the title and description.
  • Use automatic feed links to add feed links.
  • Add a call to wp_head(). Plugins use this action hook to add their own scripts, stylesheets, and other functionality.

Here's an example of a correctly-formatted HTML5 compliant head area:

<!DOCTYPE html>
<html <?php language_attributes(); ?>>
    <head>
        <meta charset="<?php bloginfo( 'charset' ); ?>" />
        <title><?php wp_title(); ?></title>
        <link rel="profile" href="http://gmpg.org/xfn/11" />
        <link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>" type="text/css" media="screen" />
        <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
        <?php if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); ?>
        <?php wp_head(); ?>
    </head>

Navigation Menus (header.php)

  • The Theme's main navigation should support a custom menu with wp_nav_menu().
  • SubItem - Menus should support long link titles and a large amount of list items. These items should not break the design or layout.
  • SubItem - Submenu items should display correctly. If possible, support drop-down menu styles for submenu items. Drop-downs allowing showing menu depth instead of just showing the top level.

Widgets (sidebar.php)

  • The Theme should be widgetized as fully as possible. Any area in the layout that works like a widget (tag cloud, blogroll, list of categories) or could accept widgets (sidebar) should allow widgets.
  • Content that appears in widgetized areas by default (hard-coded into the sidebar, for example) should disappear when widgets are enabled from Appearance > Widgets.

Footer (footer.php)

  • Use a wp_footer() call, to appear just before closing body tag.
<?php wp_footer(); ?>
</body>
</html>

Index (index.php)

  • Display a list of posts in excerpt or full-length form. Choose one or the other as appropriate.
  • Include wp_link_pages() to support navigation links within posts.

Archive (archive.php)

  • Display archive title (tag, category, date-based, or author archives).
  • Display a list of posts in excerpt or full-length form. Choose one or the other as appropriate.
  • Include wp_link_pages() to support navigation links within posts.

Pages (page.php)

  • Display page title and page content.
  • Display comment list and comment form (unless comments are off).
  • Include wp_link_pages() to support navigation links within a page.
  • Metadata such as tags, categories, date and author should not be displayed.
  • Display an "Edit" link for logged-in users with edit permissions.

Single Post (single.php)

  • Include wp_link_pages() to support navigation links within a post.
  • Display post title and post content.
  • SubItem - The title should be plain text instead of a link pointing to itself.
  • Display the post date.
  • SubItem - Respect date and time format settings unless it's important to the design. (User settings for date and time format are in Settings > General.)
  • SubItem - For output based on the user setting, use the_time( get_option( 'date_format' ) ).
  • Display the author name (if appropriate).
  • Display post categories and post tags.
  • Display an "Edit" link for logged-in users with edit permissions.
  • Display comment list and comment form.
  • Show navigation links to next and previous post using previous_post_link() and next_post_link().

Comments (comments.php)

  • Author comment should be highlighted differently.
  • Display gravatars (user avatars) if appropriate.
  • Support threaded comments.
  • Display trackbacks/pingbacks.
  • This file shouldn’t contain function defines unless in a function_exist() check to avoid redeclaration errors. Ideally all functions should be in functions.php.

Search Results (search.php)

  • Display a list of posts in excerpt or full-length form. Choose one or the other as appropriate.
  • The search results page show the previous search term. It's a simple but useful way to remind someone what they just searched for -- especially in the case of zero results. Use the_search_query or get_search_query (echo or return the value). For example:
<h2><?php printf( __( 'Search Results for: %s' ), '<span>' . get_search_query() . '</span>'); ?></h2>
  • It's a good practice to include the search form again on the results page. Include it with: get_search_form().

Template Hierarchy Index Pages

from Theme Unit Test (Wordpress Codex):

When viewing any Template Hierarchy Index page, including the default index page (index.php), and (if applicable) Blog Posts Index (home.php), Date Archives (archive.php), Category Archives (category.php), Tag Archives (tag.php), or Author Archives (author.php):

  • Posts display correctly, with no apparent visual problems or errors.
  • Posts display in correct order.
  • Correct number of posts display (as per setting in Settings > Reading).
  • Page navigation displays and works correctly.
  • Debugger returns no PHP errors, warnings, or notices
  • The browser reports no JavaScript errors
  • {Checked all for index.php}
  • {Checked all for home.php}
  • {Checked all for archive.php}
  • {Checked all for category.php}
  • {Checked all for tag.php}
  • {Checked all for author.php}

Static Front Page

If the Theme includes either a front-page.php or a home.php template file, go to Dashboard -> Settings -> Reading, and set the Front Page to display a Static Page (use any existing Page), and set the Blog Posts index to another Static Page (e.g. "Lorem Ipsum").

  • The Front Page displays properly, and as intended
  • The Blog Posts index page displays properly
  • Debugger returns no PHP errors, warnings, or notices
  • The browser reports no JavaScript errors

404 Page

  • The 404 page displays properly
  • Some content is displayed, more than merely the basic "Error 404 - Page Not Found" message - such as some helpful text, a search form, a list of Post or Pages, etc.
  • Debugger returns no PHP errors, warnings, or notices
  • The browser reports no JavaScript errors

Search Results Page

  • The Search Results page displays properly, with search query results displayed.
  • Debugger returns no PHP errors, warnings, or notices
  • The browser reports no JavaScript errors

Blog Posts Index Page

Test the following posts when viewing the Blog Posts Index page. Post Titles in the test data correlate with section titles below.

Scheduled Post

  • Should not be displayed by the Theme (status "scheduled", rather than "published").

Draft Post

  • Should not be displayed by the Theme (status "draft", rather than "published").

Layout Test

  • Displays properly as a "Sticky Post."
  • Page navigation links display and work properly.

Readability Test

  • Displays "Read More" link properly.
  • "Read More" link works properly (links to single post at "More" tag location).

Post Format Tests (All)

  • If Theme supports Post Format Type, Post displays as intended in the index view

Post Format Test: Gallery

  • Gallery images display as intended in the index view

Post Format Test: Image (Linked)

  • Image displays as intended in the index view
  • Image does not overflow the content area

Post Format Test: Image (Attached)

  • Image displays as intended in the index view
  • Image does not overflow the content area

Post Format Test: Video

  • Video displays as intended in the index view
  • Video does not overflow the content area

This Post Has No Body

  • Lack of body text should not adversely impact the layout.

(no title)

  • Lack of post title should not adversely impact layout.
  • Post permalink should be displayed. Making the post date a permalink is a great solution. See Twenty Ten for an example.

Many Categories & Many Tags

  • Theme must incorporate both the "Tag" and the "Category" taxonomies in some manner.
  • Large number of categories/tags should not adversely impact layout.

Protected Test With Secret Password

  • Password form should be displayed.
  • Post content should not be displayed.
  • Comments should not be displayed.
  • Once password is entered, post or excerpt displays properly.

Single Post

Test the following posts when viewing a single post (single.php). Each section title matches a post title in the test data.

Layout Test

  • Displays page navigation links properly.
  • Page navigation links work properly (link to correct page).
  • Post permalink links to Page 1.

Page 2

  • Paragraphs are styled correctly.
  • Left, Center, Right, Justify aligned paragraphs align properly.

Page 3

  • h1-h6 elements are styled (as appropriate).
  • blockquote, cite styled (as appropriate).
  • SubItem - Block quotes should be indented or otherwise distinct from paragraph text.
  • SubItem - If the Theme uses a background image or quote symbol, make sure displays correctly on both short and long quotes.
  • span with style and ASCII characters should display properly.
  • table, tr, th, td are styled (as appropriate).
  • dl (dt, dd), ul, ol, li styled (as appropriate).
  • SubItem - Nested lists should be indented correctly.
  • The following HTML tags should be styled appropriately to ensure semantic meaning of each tag is preserved: address, a, big, cite, code, del, em, ins, kbd, pre, q, s, strong, sub, sup, tt, var.
  • SubItem - Note: abbr and acronym require no special styling. Also, s may be address but was deprected with HTML 4 and can be left with no special styling as well.
  • div, span maintain proper block or inline display, and styled (as appropriate).

Readability Test

  • The content should be generally readable.
  • Styling should not negatively impact readability: foreground/background contrast, font family, font size, line height, paragraph width, paragraph spacing.

Images Test

Page 1

  • Un-Captioned Image Alignment Tests
  • SubItem - Images are aligned properly: Center, Left, Right, None.
  • SubItem - Check caption styles on first image.
  • SubItem - Images should not have a border unless it's part of design.

Page 2

  • Captioned Image Alignment Tests
  • SubItem - Images are aligned properly: Center, Left, Right, None.
  • SubItem - Check caption styles on first image.
  • SubItem - Images should not have a border unless it's part of design.

Page 3

  • Other Image Tests
  • SubItem - Wide Image (Resized) Test
  • SubItem - (SubItem) Image should display properly, and should be resized as specified.
  • SubItem - (SubItem) Sidebar must not be pushed to the bottom of the page.
  • SubItem - Wide Image (Not Resized) Test
  • SubItem - (SubItem) Wide image overflows properly (such as using max-width CSS rule or overflow CSS rule).
  • SubItem - (SubItem) Sidebar must not be pushed below content due to image overlap.
  • SubItem - Thumbnails
  • SubItem - (SubItem) Thumbnails display properly.

Page 4

  • Floats are cleared properly for floated element (thumbnail image) at the end of the Post Content

Post Format Tests (All)

  • If Theme supports Post Format type, Post displays as intended in the single-post view.

Post Format Test: Gallery

  • Gallery displays correctly (check for spacing after gallery).
  • Gallery image thumbnails link to image post.

Post Format Test: Image (Linked)

  • Image displays as intended in single-post view
  • Image does not overflow the content area

Post Format Test: Image (Attached)

  • Image displays as intended in single-post view
  • Image does not overflow the content area

Post Format Test: Video

  • Video embeds work.
  • Embedded video does not push sidebar(s) below content due to overlap.
  • $content_width should have an appropriate value defined.

Post Format Test: Audio

  • Enclosure links work properly.

Post With Long Title

Long Post Title with long non-breaking string: If you say it loud enough, you’ll always sound precocious; Supercalifragilisticexpialidocious!

  • Test title line height
  • Look for potential overflow issues if the theme has a small title area

This Post Has No Body

  • Post displays properly and should not impact the layout.

(no title)

  • Post displays properly.
  • A link to the singular view of the post is recommended to be displayed. Making the post date a permalink (see Twenty Ten for an example) is a great solution.

Many Categories / Many Tags

  • Theme incorporates both the "Tag" and "Category" taxonomies in some manner
  • Category links work correctly.
  • Categories display properly without adversely impacting design.
  • Tag links work correctly.
  • Tags display properly without adversely impacting design.

Protected Test With Secret Password

  • Password input form displays properly.
  • When correct password (secret) is entered, the post and comments are displayed.

Comment Test

  • Comments are displayed correctly.
  • Threaded comments display correctly.
  • Comment pagination displays correctly.
  • Author comment is styled (as appropriate).
  • User avatars are displayed properly.
  • Comment form displays properly for both logged in/logged out users.
  • When logged in as admin, edit links are displayed and work correctly.
  • HTML is displayed properly in comments, especially lists and block quotes

Comments Disabled

  • Comment form does not display.
  • "Comments are disabled" notice is displayed.

Many Trackbacks

  • All trackbacks are displayed properly, with no overlap.

Pages

Test the following pages (page.php) by viewing the page that matches the section titles below.

Page With Comments

  • Tags, Categories, and Post date/time stamp should not be displayed.
  • Comment list and comment reply form are displayed.

Page With Comments Disabled

  • Comment list and comment reply form are not displayed.
  • No "Comments Disabled" message should be displayed.
  • Layout not adversely impacted by minimal page content.

Parent Page / Child Page 1 / Child Page 2

  • Extra credit for displaying parent and/or child when viewing pages within hierarchy.

Clearing Floats

  • The last item in this page's content is a floated image. Make sure any elements after it are clearing properly.

Misc Pages

Tests for search.php and 404.php.

Search Results

  • Search results page is helpful.
  • Search query is displayed.

Not Found

  • 404 page is present, and has helpful information.

General

Menus

  • Test with a large number of categories or pages in the menu, and test with multiple levels deep in the menus.
  • If custom menus are enabled, test the layout both with custom menus enabled and with the fallback navigation menus (no custom menu enabled).

Widgets

  • All widgets display correctly.
  • The default WordPress widgets should work correctly in all widgetized areas.
  • If the Theme uses custom widgets, they should work correctly. (Custom widgets are programmatically added by the Theme to the list of available widgets in Appearance > Widgets.)
  • Test all available widgets in all available widgetized areas in the Theme layout.
  • Content that appears in widgetized areas by default (hard-coded into the sidebar, for example) should disappear when widgets are enabled from Appearance > Widgets.

Screenshot

  • The screenshot should accurately show the Theme design.
  • Make sure it doesn't show customized header colors or an uploaded logo that wouldn't appear by default.

Anchor Text and Credit Links

Theme authors should only be using links that point directly to a website specifically for the theme; an appropriate website page for the theme; or a reasonably related URL giving more information about the theme. Using anchor text for search engine gains will not be accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment