// Hide admin bar
add_filter('show_admin_bar', '__return_false');
// Google Fonts
function wpb_add_google_fonts() {
wp_enqueue_style( 'wpb-google-fonts', 'https://fonts.googleapis.com/css?family=Merriweather:400,700', false );
wp_enqueue_style( 'wpb-google-fonts', 'https://fonts.googleapis.com/css?family=Montserrat:400,700', false );
}
add_action( 'wp_enqueue_scripts', 'wpb_add_google_fonts' );
// Add support for Featured Images
if (function_exists('add_theme_support')) {
add_theme_support('post-thumbnails');
//add_image_size( $name, $width, $height, $cropBoolean);
add_image_size('blog', 350, 250, true);
//add_image_size('blog', 760, 350, true);
//add_image_size('events-thumb', 380, 225, true);
//add_image_size('team-thumbs', 370, 228, true);
}
// ACF and YOAST
add_filter( 'wpseo_pre_analysis_post_content', 'wpseo_example_acf', 10, 2);
function wpseo_example_acf($content, $post) {
$checkField = get_sub_field('col_content', $post->ID);
return $content . $checkField;
}
// ACF Options
if( function_exists('acf_add_options_page') ) {
acf_add_options_page(array(
'page_title' => 'Company Details',
'icon_url' => 'dashicons-clipboard',
//'position' => '10',
//'page_title' => 'Home Page Sliders',
//'menu_title' => 'Sliders',
//'menu_slug' => 'home-page-sliders',
//'capability' => 'edit_posts',
));
acf_add_options_page(array(
'page_title' => 'Page CTA\'s',
'icon_url' => 'dashicons-megaphone',
//'position' => '10',
//'page_title' => 'Home Page Sliders',
//'menu_title' => 'Sliders',
//'menu_slug' => 'home-page-sliders',
//'capability' => 'edit_posts',
));
}
// Excerpt Lengths
class Excerpt {
// Default length (by WordPress)
public static $length = 55;
// So you can call: my_excerpt('short');
public static $types = array(
'short' => 25,
'regular' => 55,
'long' => 100
);
/**
* Sets the length for the excerpt,
* then it adds the WP filter
* And automatically calls the_excerpt();
*
* @param string $new_length
* @return void
* @author Baylor Rae'
*/
public static function length($new_length = 55) {
Excerpt::$length = $new_length;
add_filter('excerpt_length', 'Excerpt::new_length');
Excerpt::output();
}
// Tells WP the new length
public static function new_length() {
if( isset(Excerpt::$types[Excerpt::$length]) )
return Excerpt::$types[Excerpt::$length];
else
return Excerpt::$length;
}
// Echoes out the excerpt
public static function output() {
the_excerpt();
}
}
// An alias to the class
function my_excerpt($length = 55) {
Excerpt::length($length);
}
// Replaces the excerpt "more" text by a link
function new_excerpt_more($more) {
global $post;
return '... Read more ';
}
add_filter('excerpt_more', 'new_excerpt_more');
// Required for Google Analytics Dashboard and to Remove Dashboard Widgets
add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts() {
echo '';
}
function columns_screen_options() {
add_screen_option(
'layout_columns',
array(
'max' => 1, //Max number of columns
'default' => 1 //Default number of columns
)
);
}
add_action( 'admin_head-index.php', 'columns_screen_options' );
// Remove Dashboard Widgets
add_action('admin_init', 'rw_remove_dashboard_widgets');
function rw_remove_dashboard_widgets() {
remove_meta_box('dashboard_right_now', 'dashboard', 'normal'); // right now
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); // recent comments
remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal'); // incoming links
remove_meta_box('dashboard_quick_press', 'dashboard', 'normal'); // quick press
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'normal'); // recent drafts
remove_meta_box('dashboard_primary', 'dashboard', 'normal'); // wordpress blog
remove_meta_box('dashboard_secondary', 'dashboard', 'normal'); // other wordpress news
remove_action('welcome_panel', 'wp_welcome_panel');
remove_meta_box( 'dashboard_activity', 'dashboard', 'normal');
}
function image_quality() {
return 100;
}
add_filter( 'jpeg_quality', 'image_quality' );
?>