Skip to content

Instantly share code, notes, and snippets.

View raewrites's full-sized avatar

Raelene Morey raewrites

View GitHub Profile
function enable_more_buttons($buttons) {
$buttons[] = 'fontselect';
$buttons[] = 'fontsizeselect';
$buttons[] = 'styleselect';
$buttons[] = 'backcolor';
$buttons[] = 'newdocument';
$buttons[] = 'cut';
$buttons[] = 'copy';
$buttons[] = 'charmap';
@raewrites
raewrites / enable-styleselect
Created January 13, 2015 03:36
enable-styleselect
// Callback function to insert 'styleselect' into the $buttons array
function my_mce_buttons_2( $buttons ) {
array_unshift( $buttons, 'styleselect' );
return $buttons;
}
// Register our callback to the appropriate filter
add_filter('mce_buttons_2', 'my_mce_buttons_2');
@raewrites
raewrites / registering-custom-styles
Created January 13, 2015 03:39
Registering Custom Styles
// Callback function to filter the MCE settings
function my_mce_before_init_insert_formats( $init_array ) {
// Define the style_formats array
$style_formats = array(
// Each array child is a format with it's own settings
array(
'title' => '.translation',
'block' => 'blockquote',
'classes' => 'translation',
'wrapper' => true,
@raewrites
raewrites / add-editor-style
Created January 13, 2015 03:53
Add Editor Style
<?php add_editor_style( $stylesheet ); ?>
@raewrites
raewrites / add-editor-style-function
Created January 13, 2015 03:53
Add Editor Style Function
<?php
function my_theme_add_editor_styles() {
add_editor_style( 'custom-editor-style.css' );
}
add_action( 'after_setup_theme', 'my_theme_add_editor_styles' );
?>
@raewrites
raewrites / custom-editor-style
Created January 13, 2015 03:54
Custom Editor Style
body#tinymce.wp-editor {
font-family: Arial, Helvetica, sans-serif;
margin: 10px;
}
body#tinymce.wp-editor a {
color: #4CA6CF;
}
@raewrites
raewrites / my-theme-add-editor-styles
Created January 13, 2015 03:56
My Theme Add Editor Styles
<?php
function my_theme_add_editor_styles() {
$font_url = str_replace( ',', '%2C', '//fonts.googleapis.com/css?family=Lato:300,400,700' );
add_editor_style( $font_url );
}
add_action( 'after_setup_theme', 'my_theme_add_editor_styles' );
?>
@raewrites
raewrites / reusing-theme-styles
Created January 13, 2015 03:57
Reusing Theme Styles
@import url( 'style.css' );
/* Add overwrites as needed so that the content of the editor field is attractive and not broken */
body { padding: 0; background: #fff; }
@raewrites
raewrites / add-my-quicktags
Created January 13, 2015 04:00
Add My Quicktags
if( !function_exists('_add_my_quicktags') ){
function _add_my_quicktags()
{ ?>
<script type="text/javascript">
QTags.addButton( 'p', 'p', '<p>', '</p>' );
QTags.addButton( 'br', 'br', '<br>', '<br>' );
QTags.addButton( 'h3', 'H3', '<h3>', '</h3>' );
QTags.addButton( 'h4', 'H4', '<h4>', '</h4>' );
</script>
<?php }
@raewrites
raewrites / quick-tag-button
Created January 13, 2015 04:01
Quick Tag Button
QTags.addButton( 'p', 'p', '<p>', '</p>' );