/** * Returning our Helsinki-Styles * * @return Array */ function helsinki_get_styles() { $suffix = helsinki_get_script_suffix(); $dir = helsinki_get_asset_directory_url('css'); $theme_data = wp_get_theme(); $version = $theme_data->Version; // $handle => array( 'src' => $src, 'deps' => $deps, 'version' => $version, 'media' => $media ) $styles = array(); // adding the main-CSS $styles['helsinki'] = array('src' => $dir . 'style' . $suffix . '.css', 'deps' => NULL, 'version' => $version, 'media' => NULL); // adding the media-CSS $styles['helsinki-media'] = array('src' => $dir . 'media' . $suffix . '.css', 'deps' => NULL, 'version' => $version, 'media' => NULL); // adding our webfonts $open_sans_query_args = array('family' => 'Open+Sans:400,300,700'); $styles['helsinki-webfont-open-sans'] = array('src' => add_query_arg($open_sans_query_args, '//fonts.googleapis.com/css'), 'deps' => array(), 'version' => $version, 'media' => NULL); $open_sans_condensed_query_args = array('family' => 'Open+Sans+Condensed:300,700'); $styles['helsinki-webfont-open-sans-condensed'] = array('src' => add_query_arg($open_sans_condensed_query_args, '//fonts.googleapis.com/css'), 'deps' => array(), 'version' => $version, 'media' => NULL); // adding the font-CSS $styles['helsinki-fonts'] = array('src' => $dir . 'fonts' . $suffix . '.css', 'deps' => NULL, 'version' => '4.0.3', 'media' => NULL); // adding the magnific css $styles['helsinki-magnific'] = array('src' => $dir . 'magnific' . $suffix . '.css', 'deps' => NULL, 'version' => '0.9.9', 'media' => NULL); // adding the offcanvas-CSS $styles['helsinki-offcanvas'] = array('src' => $dir . 'offcanvas' . $suffix . '.css', 'deps' => NULL, 'version' => $version, 'media' => NULL); // check if we have a custom css $custom_css = helsinki_get_custom_css_file_url(); if ($custom_css !== '') { global $pagenow; $styles['helsinki-custom-css'] = array('src' => $custom_css, 'deps' => array(), 'version' => time(), 'media' => NULL); } return apply_filters('helsinki_get_styles', $styles); }
/** * Returning our scripts * * @return array */ function helsinki_get_admin_scripts() { $scripts = array(); $suffix = helsinki_get_script_suffix(); // getting the theme-data $theme_data = wp_get_theme(); $version = $theme_data->Version; // adding the offcanvas js $scripts['jquery-admin'] = array('src' => helsinki_get_asset_directory_url('js') . 'admin' . $suffix . '.js', 'deps' => array('jquery'), 'version' => $version, 'in_footer' => TRUE); return apply_filters('helsinki_get_admin_scripts', $scripts); }
/** * Returning our Admin-Styles * * @return Array */ function helsinki_get_admin_styles() { $suffix = helsinki_get_script_suffix(); $theme_data = wp_get_theme(); $version = $theme_data->Version; $dir = helsinki_get_asset_directory_url('css'); // $handle => array( 'src' => $src, 'deps' => $deps, 'version' => $version, 'media' => $media ) $styles = array(); // adding the admin-CSS $styles['helsinki-admin'] = array('src' => $dir . 'admin' . $suffix . '.css', 'deps' => NULL, 'version' => $version, 'media' => NULL); return apply_filters('helsinki_get_admin_styles', $styles); }
/** * Returning our scripts * * @return array */ function helsinki_get_scripts() { $scripts = array(); $suffix = helsinki_get_script_suffix(); // getting the theme-data $theme_data = wp_get_theme(); $version = $theme_data->Version; // adding the html5shiv $scripts['html5shiv'] = array('src' => helsinki_get_asset_directory_url('js') . 'html5shiv' . $suffix . '.js', 'deps' => array(), 'version' => '2.6.2', 'in_footer' => FALSE); // adding the magnific-js $scripts['jquery-magnific'] = array('src' => helsinki_get_asset_directory_url('js') . 'jquery.magnific' . $suffix . '.js', 'deps' => array('jquery'), 'version' => '0.9.9', 'in_footer' => TRUE); // adding the gallery js $scripts['jquery-gallery'] = array('src' => helsinki_get_asset_directory_url('js') . 'gallery' . $suffix . '.js', 'deps' => array('jquery'), 'version' => $version, 'in_footer' => TRUE); // adding the offcanvas js $scripts['jquery-offcanvas'] = array('src' => helsinki_get_asset_directory_url('js') . 'offcanvas' . $suffix . '.js', 'deps' => array('jquery'), 'version' => $version, 'in_footer' => TRUE, 'localize' => array('helsinki_offcanvas_args' => helsinki_get_offcanvas_args())); return apply_filters('helsinki_get_scripts', $scripts); }
/** * Callback on theme_init * * @wp-hook after_setup_theme * * @return Void */ function helsinki_setup() { $application_dir = dirname(__FILE__) . '/application/'; // localization load_theme_textdomain('helsinki', get_template_directory() . '/languages/'); // helper include_once $application_dir . 'helper.php'; // custom header include_once $application_dir . 'header.php'; helsinki_custom_header_setup(); // theme support add_theme_support('html5', array('comment-list', 'comment-form', 'search-form', 'gallery', 'caption')); add_theme_support('automatic-feed-links'); add_theme_support('post-thumbnails'); add_theme_support('title-tag'); // set the content width because theme // check wants to have it if (!isset($content_width)) { $content_width = 900; } // image sizes include_once $application_dir . 'attachment.php'; helsinki_register_image_sizes(); // navigation include_once $application_dir . 'navigation.php'; helsinki_register_nav_menus(); // widgets include_once $application_dir . 'widget.php'; add_action('widgets_init', 'helsinki_widgets_init'); add_filter('dynamic_sidebar_params', 'helsinki_filter_dynamic_sidebar_params'); // customizer include_once $application_dir . 'customizer.php'; add_action('helsinki_customized_css_file', 'helsinki_customized_css_file', 10, 4); add_action('customize_register', 'helsinki_register_customizer_sections'); add_action('customize_preview_init', 'helsinki_save_custom_css_file'); add_action('customize_save_after', 'helsinki_save_custom_css_file'); // Off Canvas include_once $application_dir . 'offcanvas.php'; add_filter('wp_ajax_helsinki_get_offcanvas_code', 'helsinki_get_offcanvas_code'); add_filter('wp_ajax_nopriv_helsinki_get_offcanvas_code', 'helsinki_get_offcanvas_code'); // frontend only if (!is_admin()) { // general template include_once $application_dir . 'frontend/general.php'; add_filter('wp_title', 'helsinki_filter_wp_title', 10, 3); add_filter('body_class', 'helsinki_filter_body_class', 10, 2); add_action('wp_head', 'helsinki_the_favicon'); // Standard Scripts include_once $application_dir . 'frontend/script.php'; add_action('wp_head', 'helsinki_enqueue_comment_reply_script'); add_action('wp_enqueue_scripts', 'helsinki_wp_enqueue_scripts'); // style include_once $application_dir . 'frontend/style.php'; add_action('wp_enqueue_scripts', 'helsinki_wp_enqueue_styles'); // posts include_once $application_dir . 'frontend/post.php'; add_filter('excerpt_more', 'helsinki_filter_excerpt_more'); // gallery include_once $application_dir . 'frontend/gallery.php'; add_filter('shortcode_atts_gallery', 'helsinki_shortcode_atts_gallery'); // attachment standards include_once $application_dir . 'frontend/attachment.php'; add_filter('img_caption_shortcode', 'helsinki_caption_shortcode', 10, 3); add_filter('use_default_gallery_style', '__return_false'); // ping include_once $application_dir . 'frontend/ping.php'; // comments include_once $application_dir . 'frontend/comment.php'; } // backend only if (is_admin()) { // about include_once $application_dir . 'backend/about.php'; add_action('admin_menu', 'helsinki_add_about_page', 100); // style include_once $application_dir . 'backend/style.php'; add_action('admin_enqueue_scripts', 'helsinki_admin_enqueue_styles'); add_editor_style(helsinki_get_asset_directory_url('css') . 'editor-style.css'); // Admin Scripts include_once $application_dir . 'backend/script.php'; add_action('admin_enqueue_scripts', 'helsinki_admin_enqueue_scripts'); } }