Advertisement
rAthus

WP créer custom shortcode (module plugin template)

Jul 13th, 2018
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. // à ajouter dans le "functions.php" du thème, pas celui qui est dans "/wp-includes"
  2.  
  3. function jamall_function($atts,$content='')
  4. {
  5.     $a = shortcode_atts(array(
  6.         'color' => 'red',
  7.         'float' => false,
  8.         'pd' => 10,
  9.     ),$atts);
  10.     return '<div style="margin-bottom:27px;background-color:'.$a['color'].';'.($a['float']?'float:'.$a['float'].';':'').'padding:'.$a['pd'].'px;">'.do_shortcode($content).'</div><div style="clear:both;"></div>';
  11. }
  12. add_shortcode('jamall','jamall_function'); // exemple : [jamall color="lightgreen" float="left" pd="20"]Trop choquer et déçu[/jamall]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement