Your IP : 216.73.216.1
<?php
/**
* pally Default Styles
* Some custom styles are found in Colors.php
*
* @package pally
* @since 1.0.0
*/
namespace Pally;
/**
* Add scripts
*
* @since 1.0.0
*/
class Styles {
/**
* An array of enqueued files.
*
* Prevents duplicate styles.
*
* @static
* @access protected
* @since 1.0.0
* @var array
*/
protected static $enqueued_files = [];
/**
* The styles.
*
* @static
* @access protected
* @since 1.0.0
* @var string
*/
protected static $css = '';
/**
* Constructor.
*
* @since 1.0.0
* @access public
*/
public function __construct() {
add_action( 'wp_enqueue_scripts', [ $this, 'action_global_styles' ] );
}
/**
* Global styles.
*
* @access public
* @since 1.0.0
* @return void
*/
public function action_global_styles() {
// Enqueue Google Fonts.
if ( get_theme_mod( 'font_pairing', 'Source Serif Pro+Open Sans' ) !== 'system' ) {
$font_option = explode( '+', get_theme_mod( 'font_pairing', 'Source Serif Pro+Open Sans' ) );
$google_fonts = '//fonts.googleapis.com/css2?family=' . $font_option[0] . ':ital,wght@0,300;0,400;0,600;0,700;1,300;1,400;1,600&display=swap%7c' . $font_option[1] . ':300,400,600,700&display=swap';
}
if ( ! empty( $google_fonts ) ) {
wp_enqueue_style(
'pally-fonts',
$google_fonts,
[],
null
);
}
}
/**
* Prints inline CSS for template parts.
*
* @since 1.0.0
* @access public
*/
public static function get_template_part( $slug, $name = null, $stylesheet = null ) {
// Print stylesheet.
if ( $stylesheet ) {
$stylename = ( $name ) ? "-$name" : '';
echo "<style id='pally-{$slug}{$stylename}'>";
include get_theme_file_path( $stylesheet );
echo '</style>';
}
// Get the template-part.
get_template_part( 'template-parts/' . $slug . '/' . $name );
}
}