1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
| <?php
register_sidebar( array(
'name' => __( 'Primary Widget Area', 'twentyten' ),
'id' => 'primary-widget-area',
'description' => __( 'The primary widget area', 'twentyten' ),
'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => __( 'Menu Widget Area', 'twentyten' ),
'id' => 'menu-widget-area',
'description' => __( 'The menu widget area', 'twentyten' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
) );
if ( !is_admin() ) {
function my_init_method() {
wp_deregister_script( 'l10n' );
}
add_action('init', 'my_init_method');
}
function limit_words($string, $limit) {
$words = explode(' ', $string);
return implode(' ', array_slice($words, 0, $limit));}
function seomix_desc() {
global $post;
$contenu = strip_tags($post->post_content);
$contenu = str_replace(array("\n", "\r", "\t"), ' ', $contenu);
$contenu = strip_shortcodes($contenu);
$contenu = limit_words($contenu, '25');
echo '<p>'.$contenu.'...</p>';
}
add_filter( 'mce_buttons_2', 'juiz_mce_buttons_2' );
*
if ( !function_exists('juiz_mce_buttons_2')) {
function juiz_mce_buttons_2( $buttons ) {
array_unshift( $buttons, 'styleselect' );
*
return $buttons;
}
}
// le hook que nous avons vu en tout début d'article
add_filter( 'tiny_mce_before_init', 'juiz_mce_before_init' );
if ( !function_exists('juiz_mce_before_init')) {
function juiz_mce_before_init( $styles ) {
// on créé un tableau contenant nos styles
$style_formats = array (
// chaque style est un nouveau tableau
// Style "Italique et gras"
array(
'title' => __('Italique et gras'),
'inline' => 'span',
'styles' => array(
'fontStyle' => 'italic',
'fontWeight' => 'bold'
)
),
// Style "bouton"
array(
'title' => __('Bouton'),
'selector' => 'a',
'classes' => 'button'
),
// Style "Exergue box"
array(
'title' => __('Exergue Box'),
'block' => 'div',
'classes' => 'highlight',
'wrapper' => true
)
);
// on remplace les styles existants par les nôtres
$styles['style_formats'] = json_encode( $style_formats );
return $styles;
}
}
?> |
Partager