Update formatting and add shortcode, TinyMCE and WPML stuff.

This commit is contained in:
Mike Francis 2015-02-09 14:44:12 +00:00
parent 56c204685d
commit 7be3b09bb6
1 changed files with 50 additions and 6 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
/* /**
* Add support for useful stuff * Add support for useful stuff
*/ */
@ -11,9 +11,12 @@ add_theme_support( 'custom-background' );
add_post_type_support( 'page', 'excerpt' ); add_post_type_support( 'page', 'excerpt' );
/* /**
* Remove junk * Remove junk
*/ */
define( 'ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS', true );
define( 'ICL_DONT_LOAD_LANGUAGES_JS', true );
add_filter('show_admin_bar', '__return_false'); add_filter('show_admin_bar', '__return_false');
@ -32,7 +35,7 @@ function barebones_remove_comments_rss( $for_comments ) {
add_filter( 'post_comments_feed_link', 'barebones_remove_comments_rss' ); add_filter( 'post_comments_feed_link', 'barebones_remove_comments_rss' );
/* /**
* jQuery the right way * jQuery the right way
*/ */
@ -41,7 +44,7 @@ function barebones_scripts() {
* For IE8 to play nice, you'll need to include your CSS here, for example: * For IE8 to play nice, you'll need to include your CSS here, for example:
* *
* wp_enqueue_style( 'fonts', '//fonts.googleapis.com/css?family=Font+Family' ); * wp_enqueue_style( 'fonts', '//fonts.googleapis.com/css?family=Font+Family' );
* wp_enqueue_style( 'icons', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css' ); * wp_enqueue_style( 'icons', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', null, '4.3.0' );
*/ */
wp_deregister_script( 'jquery' ); wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js', false, '1.11.2', true ); wp_register_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js', false, '1.11.2', true );
@ -52,7 +55,7 @@ function barebones_scripts() {
add_action( 'wp_enqueue_scripts', 'barebones_scripts' ); add_action( 'wp_enqueue_scripts', 'barebones_scripts' );
/* /**
* Nav menus * Nav menus
*/ */
@ -74,13 +77,14 @@ function barebones_nav_menu_args( $args = '' ) {
add_filter( 'wp_nav_menu_args', 'barebones_nav_menu_args' ); add_filter( 'wp_nav_menu_args', 'barebones_nav_menu_args' );
/* /**
* Email * Email
*/ */
function barebones_mail_from( $email ) { function barebones_mail_from( $email ) {
return get_option( 'admin_email' ); return get_option( 'admin_email' );
} }
add_filter( 'wp_mail_from', 'barebones_mail_from' ); add_filter( 'wp_mail_from', 'barebones_mail_from' );
function barebones_mail_from_name( $name ) { function barebones_mail_from_name( $name ) {
@ -88,3 +92,43 @@ function barebones_mail_from_name( $name ) {
} }
add_filter( 'wp_mail_from_name', 'barebones_mail_from_name' ); add_filter( 'wp_mail_from_name', 'barebones_mail_from_name' );
/**
* Shortcodes ([button] shortcode included)
*/
function button_shortcode( $atts, $content = null ) {
return '<a class="btn" href="' . $atts['link'] . '">' . $content . '</a>';
}
add_shortcode( 'button', 'button_shortcode' );
/**
* TinyMCE
*/
function my_mce_buttons_2( $buttons ) {
array_unshift( $buttons, 'styleselect' );
$buttons[] = 'hr';
return $buttons;
}
add_filter( 'mce_buttons_2', 'my_mce_buttons_2' );
function my_mce_before_init( $settings ) {
$style_formats = array(
/*
* Example
*
array(
'title' => '',
'selector' => '',
'classes' => ''
) */
);
$settings['style_formats'] = json_encode( $style_formats );
return $settings;
}
add_filter( 'tiny_mce_before_init', 'my_mce_before_init' );