Created
June 14, 2012 10:33
-
-
Save mattboon/2929500 to your computer and use it in GitHub Desktop.
WordPress - Remove inline CSS from .wp-caption (plugin)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: FixWpCaption | |
Plugin URI: # | |
Description: Removes inline CSS from .wp-caption | |
*/ | |
class FixWpCaption{ | |
public function __construct(){ | |
add_filter('img_caption_shortcode', array($this, 'fixcaption'), 10, 3); | |
} | |
public function fixcaption($x=null, $attr, $content){ | |
extract(shortcode_atts(array( | |
'id' => '', | |
'align' => 'alignnone', | |
'width' => '', | |
'caption' => '' | |
), $attr)); | |
if ( 1 > (int) $width || empty($caption) ) { | |
return $content; | |
} | |
return '<aside class="wp-caption ' . $align . '">' | |
. $content . '<p class="wp-caption-text">' . $caption . '</p></aside>'; | |
} | |
} | |
$FixWpCaption = new FixWpCaption(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment