Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. function helloFunction($atts, $content) {
  2.      extract(shortcode_atts(array(
  3.         "id" => "",
  4.     ), $atts));
  5.    
  6.     //if $id isnt empty
  7.     if($id != "") {
  8.         //i created a new variable called $theid which = id="whatever you put in"
  9.         $theid = ' id="'.$id.'"';
  10.     }
  11.             //$theid wont equal anything unless you write [writehello id="something"]
  12.     return '<div'.$theid.'>'.$content.'</div>';
  13. }
  14.  
  15. add_shortcode("writehello", "helloFunction");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement