'Header',
'footer' => 'Footer'
]);
}
function barebones_nav_menu_args($args = '')
{
$args['container'] = false;
$args['container_class'] = false;
$args['menu_id'] = false;
$args['items_wrap'] = '
';
return $args;
}
add_filter('wp_nav_menu_args', 'barebones_nav_menu_args');
/**
* Email
*/
function barebones_mail_from($email)
{
return get_option('admin_email');
}
add_filter('wp_mail_from', 'barebones_mail_from');
function barebones_mail_from_name($name)
{
return get_bloginfo('name');
}
add_filter('wp_mail_from_name', 'barebones_mail_from_name');
/**
* Shortcodes ([button] shortcode included)
*/
function button_shortcode($atts, $content = null)
{
$atts['class'] = isset($atts['class']) ? $atts['class'] : 'btn';
return '' . $content . '';
}
add_shortcode('button', 'button_shortcode');
/**
* TinyMCE
*/
function barebones_mce_buttons_2($buttons)
{
array_unshift($buttons, 'styleselect');
$buttons[] = 'hr';
return $buttons;
}
add_filter('mce_buttons_2', 'barebones_mce_buttons_2');
function barebones_tiny_mce_before_init($settings)
{
$style_formats = [
// [
// 'title' => '',
// 'selector' => '',
// 'classes' => ''
// ]
];
$settings['style_formats'] = json_encode($style_formats);
$settings['style_formats_merge'] = true;
return $settings;
}
add_filter('tiny_mce_before_init', 'barebones_tiny_mce_before_init');
/**
* Get post thumbnail url
* @param string $size Size of the returned image
* @param int $post_id post id
* @param boolean $icon if no image found, display icon
*/
function get_post_thumbnail_url( $size = 'full', $post_id = false, $icon = false )
{
if(!$post_id) {
$post_id = get_the_ID();
}
$thumb_url_array = wp_get_attachment_image_src(get_post_thumbnail_id( $post_id ), $size, $icon);
return $thumb_url_array[0];
}