Advertisement
vnintoz

cODE php TINYmCE juiz

May 11th, 2015
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.06 KB | None | 0 0
  1. <?php
  2. // le hook que nous avons vu en tout début d'article…
  3. add_filter( 'tiny_mce_before_init', 'juiz_mce_before_init' );
  4.  
  5. if ( !function_exists('juiz_mce_before_init')) {
  6.     function juiz_mce_before_init( $styles ) {
  7.         // on créé un tableau contenant nos styles
  8.         $style_formats = array (
  9.             // chaque style est un nouveau tableau
  10.  
  11.             // Style "Page en construction"
  12.             array(
  13.                 'title' => __('page en construction'),
  14.                 'block' => 'div',
  15.                 'classes' => 'construction'
  16.             ),
  17.  
  18.             // Style "bouton"
  19.             array(
  20.                 'title' => __('lien externe'),
  21.                 'selector' => 'a',
  22.                 'classes' => 'external'
  23.             ),
  24.  
  25.             // Style "Encart bleu"
  26.             array(
  27.                 'title' => __('encart bleu'),
  28.                 'block' => 'div',
  29.                 'classes' => 'encartbleu',
  30.                 'wrapper' => true
  31.             ), 
  32.             // Style "Encart vert"
  33.             array(
  34.                 'title' => __('encart vert'),
  35.                 'block' => 'div',
  36.                 'classes' => 'encartvert'
  37.             )
  38.         );
  39.  
  40.         // on remplace les styles existants par les nôtres
  41.         $styles['style_formats'] = json_encode( $style_formats );
  42.  
  43.         return $styles;
  44.     }
  45. }
  46. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement