css-related bug found in media.php
|Reported by:||LHLDevAdmin||Owned by:||anonymous|
I'm writing to report a non-critical, css-related bug found in WordPress. The bug does not prevent pages from loading, but does cause w3c validation errors under certain circumstances.
I have thoroughly documented this bug online, which includes links to verifiable data. To access this blog post, please visit on the web site: http://www.lhl.uab.edu/lhldev/?p=5 .
In the following lines, I will provide a summary and highlights from the aforementioned blog post:
When a contributor adds an image gallery to his/her post, the "gallery_shortcode($attr)" function of the "media.php" file (/wp-includes/media.php) inserts internal style sheet code into the body of the page. Since internal style sheet references are called from the head tag, this action results in a w3c validation error.
The solution is simple, but completed in a few steps.
Step 1: Remove the style sheet code from the "$output = apply_filters()" [SEE: lines 427-442] -- keeping only the comment and div tag.
Step 2: Create a theme-independent style sheet, which can reside in "/wp-includes/."
Step 3: Add the gallery's style selectors, properties and values, which were removed in the Step1 (SEE: ABOVE) to this file.
Step 4: Add a reference to this newly created style sheet in "header.php" (/wp-content/themes/default/header.php) and any other file, which includes header information. To preserve the functionality of all theme-based style sheets, this css reference should be positioned above the following code: <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
You folks create great code, so I will not make further recommendations on how to implement this correction. Personally, I like the theme-independent style sheet concept because it allows WordPress designers to define some global styles for the site. Theme developers have the option of preserving the original style parameters or overwriting them within their own theme-based style sheets respectively.
Please feel free to contact me directly if you have any questions.
Change History (9)
- Keywords needs-patch 2nd-opinion added
- Milestone set to 2.8
- Milestone Future Release deleted
- Resolution set to duplicate
- Status changed from new to closed