Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [shortcode]
- <img src="http://www.site.com/myimage.jpg" />
- <a href="http://www.blabla.com"><img src="http://www.site.com/myimage2.jpg" /></a>
- (...)
- [/shortcode]
- <!--- shortcode code before input -->
- <img src="files/myimagescript?http://www.site.com/myimage.jpg" />
- <a href="http://www.blabla.com"><img src="files/myimagescript?http://www.site.com/myimage2.jpg" /></a>
- (...)
- <!-- shortcode code after input -->
- function append_myimagescript($attr, $content){
- $pattern = '/src="([^"]*)"/i';
- $replacement = 'files/myimagescript?${1}';
- return preg_replace($pattern, $replacement, $content);
- }
- function bartag_func( $atts ) {
- $atts = shortcode_atts( array(
- 'foo' => 'no foo',
- 'baz' => 'default baz'
- ), $atts, 'bartag' );
- return "foo = {$atts['foo']}";
- }
- add_shortcode( 'bartag', 'bartag_func' );
Add Comment
Please, Sign In to add comment