Your IP : 216.73.216.1


Current Path : /home/fotouserdopd8j/agenciacrabli.com/wp-contentn/themes/pally/inc/classes/
Upload File :
Current File : /home/fotouserdopd8j/agenciacrabli.com/wp-contentn/themes/pally/inc/classes/Theme_Support.php

<?php
/**
 * pally Theme support
 *
 * @package pally
 * @since 1.0.0
 */

namespace Pally;

/**
 * Add theme support
 *
 * @since 1.0.0
 */
class Theme_Support {

	/**
	 * Constructor.
	 *
	 * @since 1.0.0
	 * @access public
	 */
	public function __construct() {
		add_action( 'after_setup_theme', [ $this, 'action_setup' ] );
		add_action( 'after_setup_theme', [ $this, 'action_content_width' ], 0 );
	}

	/**
	 * Adds theme-supports.
	 *
	 * @access public
	 * @since 1.0.0
	 * @return void
	 */
	public function action_setup() {

		load_theme_textdomain( 'pally', get_template_directory() . '/languages' );

		// Add default posts and comments RSS feed links to head.
		add_theme_support( 'automatic-feed-links' );

		
		/*
		* Let WordPress manage the document title.
		* By adding theme support, we declare that this theme does not use a
		* hard-coded <title> tag in the document head, and expect WordPress to
		* provide it for us.
		*/
		add_theme_support( 'title-tag' );

		/*
		 * Enable support for Post Thumbnails on posts and pages.
		 *
		 * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
		 */
		add_theme_support( 'post-thumbnails' );

		// Declare support for navigation widgets markup.
		add_theme_support( 'html5', array( 'navigation-widgets' ) );

		// This can be combined with other HTML5 types if supported.
		add_theme_support(
			'html5',
			array(
				'navigation-widgets',
				'comment-list',
				'comment-form',
				'search-form',
				'gallery',
				'caption',
				'style',
				'script'
			)
		);
		/*
		* Add theme support for custom header
		*/
		add_theme_support(
			'custom-header',
			apply_filters(
				'custom_header_args',
				[
					'default-text-color' => '000',
					'width'              => 1944,
					'height'             => 500,
					'flex-height'        => true,
					'flex-width'         => true,
					'video'              => false,
					'wp-head-callback'   => [ $this, 'header_style' ],
				]
			)
		);

		/*
		* Add theme support for custom logo
		*/
		add_theme_support(
			'custom-logo',
			apply_filters(
				'custom_logo_args',
				[
					'height'      => 240,
					'width'       => 180,
					'flex-width'  => false,
					'flex-height' => false,
				]
			)
		);

		// This theme uses wp_nav_menu() in one location.
		register_nav_menus(
			array(
				'menu-1' => esc_html__( 'Primary', 'pally' ),
			)
		);
		// Add theme support for selective refresh for widgets.
		add_theme_support( 'customize-selective-refresh-widgets' );

		// Add support for Block Styles.
		add_theme_support( 'wp-block-styles' );

		/**
		 * Register block styles
		 */
		register_block_style(
			'core/paragraph',
			array(
				'name'  => 'highlighted',
				'label' => __('Highlighted', 'pally'),
				'inline_style' => 'p.is-style-highlighted { background: yellow; padding: 5px; }',
			)
		);

		add_theme_support( 'editor-styles' );

		// Add support for full and wide align images.
		add_theme_support( 'align-wide' );

		// Add support for responsive embedded content.
		add_theme_support( 'responsive-embeds' );

		/*
		* Add theme support for editor colors
		*/
		add_theme_support(
			'editor-color-palette',
			array(
				array(
					'name'  => __( 'Primary Color', 'pally' ),
					'slug'  => 'primary',
					'color' => '#000000',
				),
				array(
					'name'  => __( 'Secondary Color', 'pally' ),
					'slug'  => 'secondary',
					'color' => '#ffffff',
				),
				array(
					'name'  => __( 'Tertiary Color', 'pally' ),
					'slug'  => 'tertiary',
					'color' => '#E90716',
				),

			)
		);

		/*
		* Add theme support for editor font sizes
		*/
		add_theme_support(
			'editor-font-sizes',
			array(
				array(
					'name'      => __( 'Small', 'pally' ),
					'shortName' => __( 'S', 'pally' ),
					'size'      => 14,
					'slug'      => 'small',
				),
				array(
					'name'      => __( 'Normal', 'pally' ),
					'shortName' => __( 'N', 'pally' ),
					'size'      => 20,
					'slug'      => 'normal',
				),
				array(
					'name'      => __( 'Medium', 'pally' ),
					'shortName' => __( 'M', 'pally' ),
					'size'      => 26,
					'slug'      => 'medium',
				),
				array(
					'name'      => __( 'Large', 'pally' ),
					'shortName' => __( 'L', 'pally' ),
					'size'      => 32,
					'slug'      => 'large',
				),
				array(
					'name'      => __( 'Larger', 'pally' ),
					'shortName' => __( 'XL', 'pally' ),
					'size'      => 36,
					'slug'      => 'larger',
				),
			)
		);
	}

	/**
	 * Set the content width based on the theme's design and stylesheet.
	 *
	 * Priority 0 to make it available to lower priority callbacks.
	 *
	 * @global int $content_width Content width.
	 * @since 1.0.0
	 * @access public
	 */
	public function action_content_width() {
		// This variable is intended to be overruled from themes.
		// Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
		// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
		$GLOBALS['content_width'] = apply_filters( 'pally_content_width', 720 );
	}

	/**
	 * Styles the header image and text displayed on the blog.
	 *
	 * @since 1.0.0
	 * @access public
	 */
	public function header_style() {
		$header_text_color = get_header_textcolor();
		/*
		 * If no custom options for text are set, let's bail.
		 * get_header_textcolor() options: Any hex value, 'blank' to hide text.
		 * Default: add_theme_support( 'custom-header' ).
		 */
		if ( get_theme_support( 'custom-header', 'default-text-color' ) === $header_text_color ) {
			return;
		}

		// If we get this far, we have custom styles. Let's do this.
		?>
		<style>
		<?php
		// Has the text been hidden?
		if ( ! display_header_text() ) {
			?>
			.site-title {
				position: absolute;
				clip: rect(1px, 1px, 1px, 1px);
			}
			<?php
			// If the user has set a custom color for the text use that.
		} else {
			?>
			.site-title,
			.site-description {
				color: var(--header_branding_color);
			}
			<?php
		}
		?>
		</style>
		<?php
	}

}