Advertisement
YellowShark

Untitled

Feb 13th, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. <?php
  2.  
  3. // [h1]
  4. function h1($atts, $content = null) {
  5.     $defaults = array('align' => '', 'color' => '');
  6.     extract( shortcode_atts( $defaults, $atts ) );
  7.     $tag_class = '';
  8.     $tag_class .= !empty($align) ? " {$align}" : '';
  9.     $tag_class .= !empty($color) ? " {$color}" : '';
  10.  
  11.     ob_start(); ?> 
  12.         <h1 class="<?php echo $tag_class;?>"><?php echo do_shortcode($content); ?></h1>
  13.     <?php $output = ob_get_clean();
  14.     return $output;
  15. }
  16. add_shortcode('h1', 'h1');
  17.  
  18. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement