function shamrock_theme_setup() { /* Load frontend scripts and styles */ add_action('wp_enqueue_scripts', 'shamrock_load_scripts'); /* Register sidebars */ add_action('widgets_init', 'shamrock_register_sidebars'); /* Register menus */ add_action('init', 'shamrock_register_menus'); /* Register widgets */ add_action('widgets_init', 'shamrock_register_widgets'); /* Add localization support */ load_theme_textdomain('shamrock', THEME_DIR . 'languages'); /* Add default posts and comments RSS feed links to head. */ add_theme_support('automatic-feed-links'); /* Add support for title tag */ add_theme_support('title-tag'); /* Add support for post thumbnails */ add_theme_support('post-thumbnails'); /* Add image sizes */ $image_sizes = shamrock_get_image_sizes(); if (!empty($image_sizes)) { foreach ($image_sizes as $id => $size) { add_image_size($id, $size['args']['w'], $size['args']['h'], $size['args']['crop']); } } /* Add HTML5 markup */ add_theme_support('html5', array('search-form', 'comment-form', 'comment-list', 'gallery', 'caption')); /* Post formats support */ add_theme_support('post-formats', array('image', 'video', 'gallery', 'audio')); /*Add editor style */ add_editor_style(array('css/editor-style.css', shamrock_fonts_url())); }
function shamrock_add_sizes_media_editor($sizes) { $shamrock_sizes = shamrock_get_image_sizes(); if (!empty($shamrock_sizes)) { foreach ($shamrock_sizes as $id => $size) { $sizes[$id] = $size['title']; } } return $sizes; }