Advertisement
firoze

SMOF background changing Shortcode

Jan 15th, 2015
408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.98 KB | None | 0 0
  1. SMOF(syamilmj/Options-Framework) কে shortcode আকারে ব্যবহার করে background change করা | এবং shortcode এ default data দেখান |
  2. // we have to show into admin>functions>functions.options.php
  3.  
  4.  
  5. /*background image changing by SMOF single shortcode*/
  6.  
  7. function using_bg_shortcode($atts , $content=null){
  8.             extract(shortcode_atts(array(
  9.             ),$atts));
  10.                
  11.             global $data;
  12.             if($data['click_share_bg']):
  13.             return '<style type="text/css">
  14.     .click_share{background-image:url('.$data['click_share_bg'].'); background-repeat:no-repeat scroll center center;background-size:100% 100%;}
  15.     </style>';
  16.    
  17.     else:
  18.     return '<style type="text/css">.click_share{background-image:url('.get_stylesheet_directory_uri().'/images/clickbg.jpg); background-repeat:no-repeat scroll center center;background-size:100% 100%;}</style>';
  19.     endif;
  20. }
  21. add_shortcode('bg', 'using_bg_shortcode');
  22.  
  23.  
  24.  
  25.  
  26. // here is my shortcode
  27. <?php echo do_shortcode('[bg]');?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement