Konark

Untitled

May 30th, 2017
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.25 KB | None | 0 0
  1. function row_shortcode($atts, $content = null) {
  2.     $atts = shortcode_atts( array(
  3.         'class' => null,
  4.         'style' => null,
  5.         'style_1024' = null,
  6.         'style_768' = null,
  7.         'style_540' = null
  8.     ), $atts );
  9.  
  10.     $uniq_id = uniqid();
  11.  
  12.     $out = '';
  13.  
  14.     if (
  15.         (isset($atts['style_1024']) && $atts['style_1024'] != '') ||
  16.         (isset($atts['style_768']) && $atts['style_768'] != '') ||
  17.         (isset($atts['style_540']) && $atts['style_540'] != '')
  18.     ) {
  19.         $out .= '<style type="text/css">';
  20.  
  21.         if (isset($atts['style_1024']) && $atts['style_1024'] != '') {
  22.             $out .= 'media only screen and (max-width:1024px) {' .
  23.                 '#vlad_row_' . $uniq_id . ' {' .
  24.                     $atts['style_1024'] .
  25.                 '}' .
  26.             '}';
  27.         }
  28.  
  29.         if (isset($atts['style_768']) && $atts['style_768'] != '') {
  30.             $out .= 'media only screen and (max-width:768px) {' .
  31.                 $atts['style_768'] .
  32.             '}';
  33.         }
  34.  
  35.         if (isset($atts['style_540']) && $atts['style_540'] != '') {
  36.             $out .= 'media only screen and (max-width:540px) {' .
  37.                 $atts['style_540'] .
  38.             '}';
  39.         }
  40.  
  41.         $out .= '</style>';
  42.     }
  43.  
  44.  
  45.  
  46.     return "<div id='vlad_row_{$uniq_id}' class='row ".$atts['class']."' style='".$atts['style']."'><div class='row_width'><div class='row_margin clearfix'>".do_shortcode($content)."</div></div></div>";
  47. }
Advertisement
Add Comment
Please, Sign In to add comment