Skip to content

Commit

Permalink
added local fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
Netzberufler committed Apr 13, 2018
1 parent de0c113 commit 45a2dda
Show file tree
Hide file tree
Showing 16 changed files with 86 additions and 32 deletions.
78 changes: 78 additions & 0 deletions css/custom-fonts.css
@@ -0,0 +1,78 @@
/*
* Embed Theme Fonts
*
* Font Face code generated with the great Google Webfonts Helper by Mario Ranftl
* https://github.com/majodev/google-webfonts-helper/
*
* @package Smartline
*/

/* raleway-regular - latin-ext_latin */
@font-face {
font-family: 'Raleway';
font-style: normal;
font-weight: 400;
src: local('Raleway'), local('Raleway-Regular'),
url('../fonts/raleway-v12-latin-ext_latin-regular.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url('../fonts/raleway-v12-latin-ext_latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}

/* raleway-italic - latin-ext_latin */
@font-face {
font-family: 'Raleway';
font-style: italic;
font-weight: 400;
src: local('Raleway Italic'), local('Raleway-Italic'),
url('../fonts/raleway-v12-latin-ext_latin-italic.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url('../fonts/raleway-v12-latin-ext_latin-italic.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}

/* raleway-700 - latin-ext_latin */
@font-face {
font-family: 'Raleway';
font-style: normal;
font-weight: 700;
src: local('Raleway Bold'), local('Raleway-Bold'),
url('../fonts/raleway-v12-latin-ext_latin-700.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url('../fonts/raleway-v12-latin-ext_latin-700.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}

/* raleway-700italic - latin-ext_latin */
@font-face {
font-family: 'Raleway';
font-style: italic;
font-weight: 700;
src: local('Raleway Bold Italic'), local('Raleway-BoldItalic'),
url('../fonts/raleway-v12-latin-ext_latin-700italic.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url('../fonts/raleway-v12-latin-ext_latin-700italic.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}

/* bitter-regular - latin-ext_latin */
@font-face {
font-family: 'Bitter';
font-style: normal;
font-weight: 400;
src: local('Bitter Regular'), local('Bitter-Regular'),
url('../fonts/bitter-v12-latin-ext_latin-regular.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url('../fonts/bitter-v12-latin-ext_latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}

/* bitter-italic - latin-ext_latin */
@font-face {
font-family: 'Bitter';
font-style: italic;
font-weight: 400;
src: local('Bitter Italic'), local('Bitter-Italic'),
url('../fonts/bitter-v12-latin-ext_latin-italic.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url('../fonts/bitter-v12-latin-ext_latin-italic.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}

/* bitter-700 - latin-ext_latin */
@font-face {
font-family: 'Bitter';
font-style: normal;
font-weight: 700;
src: local('Bitter Bold'), local('Bitter-Bold'),
url('../fonts/bitter-v12-latin-ext_latin-700.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url('../fonts/bitter-v12-latin-ext_latin-700.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
Binary file added fonts/bitter-v12-latin-ext_latin-700.woff
Binary file not shown.
Binary file added fonts/bitter-v12-latin-ext_latin-700.woff2
Binary file not shown.
Binary file added fonts/bitter-v12-latin-ext_latin-italic.woff
Binary file not shown.
Binary file added fonts/bitter-v12-latin-ext_latin-italic.woff2
Binary file not shown.
Binary file added fonts/bitter-v12-latin-ext_latin-regular.woff
Binary file not shown.
Binary file added fonts/bitter-v12-latin-ext_latin-regular.woff2
Binary file not shown.
Binary file added fonts/raleway-v12-latin-ext_latin-700.woff
Binary file not shown.
Binary file added fonts/raleway-v12-latin-ext_latin-700.woff2
Binary file not shown.
Binary file added fonts/raleway-v12-latin-ext_latin-700italic.woff
Binary file not shown.
Binary file added fonts/raleway-v12-latin-ext_latin-700italic.woff2
Binary file not shown.
Binary file added fonts/raleway-v12-latin-ext_latin-italic.woff
Binary file not shown.
Binary file added fonts/raleway-v12-latin-ext_latin-italic.woff2
Binary file not shown.
Binary file added fonts/raleway-v12-latin-ext_latin-regular.woff
Binary file not shown.
Binary file added fonts/raleway-v12-latin-ext_latin-regular.woff2
Binary file not shown.
40 changes: 8 additions & 32 deletions functions.php
Expand Up @@ -48,43 +48,19 @@ function smartline_enqueue_scripts() {
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}

// Register and Enqueue Font
wp_enqueue_style( 'smartline-lite-default-fonts', smartline_fonts_url(), array(), null );

}


/*
* Retrieve Font URL to register default Google Fonts
* Source: http://themeshaper.com/2014/08/13/how-to-add-google-fonts-to-wordpress-themes/
*/
function smartline_fonts_url() {
$fonts_url = '';

// Get Theme Options from Database
$theme_options = smartline_theme_options();

// Only embed Google Fonts if not deactivated
if ( ! ( isset($theme_options['deactivate_google_fonts']) and $theme_options['deactivate_google_fonts'] == true ) ) :

// Set Default Fonts
$font_families = array('Raleway:400,700', 'Bitter');

// Set Google Font Query Args
$query_args = array(
'family' => urlencode( implode( '|', $font_families ) ),
'subset' => urlencode( 'latin,latin-ext' ),
);

// Create Fonts URL
$fonts_url = add_query_arg( $query_args, '//fonts.googleapis.com/css' );

endif;
/**
* Enqueue custom fonts.
*/
function smartline_custom_fonts() {

return apply_filters( 'smartline_google_fonts_url', $fonts_url );
// Register and Enqueue Theme Fonts.
wp_enqueue_style( 'smartline-custom-fonts', get_template_directory_uri() . '/css/custom-fonts.css', array(), '20180413' );

}
add_action( 'wp_enqueue_scripts', 'smartline_custom_fonts', 1 );


// Setup Function: Registers support for various WordPress features
Expand Down Expand Up @@ -227,4 +203,4 @@ function smartline_register_sidebars() {
require( get_template_directory() . '/inc/widgets/widget-category-posts-single.php' );

// Include Featured Content class
require( get_template_directory() . '/inc/featured-content.php' );
require( get_template_directory() . '/inc/featured-content.php' );

0 comments on commit 45a2dda

Please sign in to comment.