',
'before_title' => '<' . $heading . ' class="widget-title">',
'after_title' => '' . $heading . '>',
)
);
// Left Sidebar.
register_sidebar(
array(
'name' => esc_html__( 'Left Sidebar', 'oceanwp' ),
'id' => 'sidebar-2',
'description' => esc_html__( 'Widgets in this area are used in the left sidebar region if you use the Both Sidebars layout.', 'oceanwp' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '<' . $heading . ' class="widget-title">',
'after_title' => '' . $heading . '>',
)
);
// Search Results Sidebar.
if ( get_theme_mod( 'ocean_search_custom_sidebar', true ) ) {
register_sidebar(
array(
'name' => esc_html__( 'Search Results Sidebar', 'oceanwp' ),
'id' => 'search_sidebar',
'description' => esc_html__( 'Widgets in this area are used in the search result page.', 'oceanwp' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '<' . $heading . ' class="widget-title">',
'after_title' => '' . $heading . '>',
)
);
}
// Footer 1.
register_sidebar(
array(
'name' => esc_html__( 'Footer 1', 'oceanwp' ),
'id' => 'footer-one',
'description' => esc_html__( 'Widgets in this area are used in the first footer region.', 'oceanwp' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '<' . $foo_heading . ' class="widget-title">',
'after_title' => '' . $foo_heading . '>',
)
);
// Footer 2.
register_sidebar(
array(
'name' => esc_html__( 'Footer 2', 'oceanwp' ),
'id' => 'footer-two',
'description' => esc_html__( 'Widgets in this area are used in the second footer region.', 'oceanwp' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '<' . $foo_heading . ' class="widget-title">',
'after_title' => '' . $foo_heading . '>',
)
);
// Footer 3.
register_sidebar(
array(
'name' => esc_html__( 'Footer 3', 'oceanwp' ),
'id' => 'footer-three',
'description' => esc_html__( 'Widgets in this area are used in the third footer region.', 'oceanwp' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '<' . $foo_heading . ' class="widget-title">',
'after_title' => '' . $foo_heading . '>',
)
);
// Footer 4.
register_sidebar(
array(
'name' => esc_html__( 'Footer 4', 'oceanwp' ),
'id' => 'footer-four',
'description' => esc_html__( 'Widgets in this area are used in the fourth footer region.', 'oceanwp' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '<' . $foo_heading . ' class="widget-title">',
'after_title' => '' . $foo_heading . '>',
)
);
}
/**
* Registers theme_mod strings into Polylang.
*
* @since 1.1.4
*/
public static function polylang_register_string() {
if ( function_exists( 'pll_register_string' ) && $strings = oceanwp_register_tm_strings() ) {
foreach ( $strings as $string => $default ) {
pll_register_string( $string, get_theme_mod( $string, $default ), 'Theme Mod', true );
}
}
}
/**
* All theme functions hook into the oceanwp_head_css filter for this function.
*
* @param obj $output output value.
* @since 1.0.0
*/
public static function custom_css( $output = null ) {
// Add filter for adding custom css via other functions.
$output = apply_filters( 'ocean_head_css', $output );
// If Custom File is selected.
if ( 'file' === get_theme_mod( 'ocean_customzer_styling', 'head' ) ) {
global $wp_customize;
$upload_dir = wp_upload_dir();
// Render CSS in the head.
if ( isset( $wp_customize ) || ! file_exists( $upload_dir['basedir'] . '/oceanwp/custom-style.css' ) ) {
// Minify and output CSS in the wp_head.
if ( ! empty( $output ) ) {
echo "\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
} else {
// Minify and output CSS in the wp_head.
if ( ! empty( $output ) ) {
echo "\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
}
/**
* Minify the WP custom CSS because WordPress doesn't do it by default.
*
* @param obj $css minify css.
* @since 1.1.9
*/
public static function minify_custom_css( $css ) {
return oceanwp_minify_css( $css );
}
/**
* Include Custom CSS file if present.
*
* @param obj $output output value.
* @since 1.4.12
*/
public static function custom_style_css( $output = null ) {
// If Custom File is not selected.
if ( 'file' !== get_theme_mod( 'ocean_customzer_styling', 'head' ) ) {
return;
}
global $wp_customize;
$upload_dir = wp_upload_dir();
// Get all the customier css.
$output = apply_filters( 'ocean_head_css', $output );
// Get Custom Panel CSS.
$output_custom_css = wp_get_custom_css();
// Minified the Custom CSS.
$output .= oceanwp_minify_css( $output_custom_css );
// Render CSS from the custom file.
if ( ! isset( $wp_customize ) && file_exists( $upload_dir['basedir'] . '/oceanwp/custom-style.css' ) && ! empty( $output ) ) {
wp_enqueue_style( 'oceanwp-custom', trailingslashit( $upload_dir['baseurl'] ) . 'oceanwp/custom-style.css', false, false );
}
}
/**
* Remove Customizer style script from front-end
*
* @since 1.4.12
*/
public static function remove_customizer_custom_css() {
// If Custom File is not selected.
if ( 'file' !== get_theme_mod( 'ocean_customzer_styling', 'head' ) ) {
return;
}
global $wp_customize;
// Disable Custom CSS in the frontend head.
remove_action( 'wp_head', 'wp_custom_css_cb', 11 );
remove_action( 'wp_head', 'wp_custom_css_cb', 101 );
// If custom CSS file exists and NOT in customizer screen.
if ( isset( $wp_customize ) ) {
add_action( 'wp_footer', 'wp_custom_css_cb', 9999 );
}
}
/**
* Adds inline CSS for the admin
*
* @since 1.0.0
*/
public static function admin_inline_css() {
echo '';
}
/**
* Alter the search posts per page
*
* @param obj $query query.
* @since 1.3.7
*/
public static function search_posts_per_page( $query ) {
$posts_per_page = get_theme_mod( 'ocean_search_post_per_page', '8' );
$posts_per_page = $posts_per_page ? $posts_per_page : '8';
if ( $query->is_main_query() && is_search() ) {
$query->set( 'posts_per_page', $posts_per_page );
}
}
/**
* Alter wp list categories arguments.
* Adds a span around the counter for easier styling.
*
* @param obj $links link.
* @since 1.0.0
*/
public static function wp_list_categories_args( $links ) {
$links = str_replace( ' (', ' (', $links );
$links = str_replace( ')', ')', $links );
return $links;
}
/**
* Alters the default oembed output.
* Adds special classes for responsive oembeds via CSS.
*
* @param obj $cache cache.
* @param url $url url.
* @param obj $attr attributes.
* @param obj $post_ID post id.
* @since 1.0.0
*/
public static function add_responsive_wrap_to_oembeds( $cache, $url, $attr, $post_ID ) {
// Supported video embeds.
$hosts = apply_filters(
'ocean_oembed_responsive_hosts',
array(
'vimeo.com',
'youtube.com',
'youtu.be',
'blip.tv',
'money.cnn.com',
'dailymotion.com',
'flickr.com',
'hulu.com',
'kickstarter.com',
'vine.co',
'soundcloud.com',
'#http://((m|www)\.)?youtube\.com/watch.*#i',
'#https://((m|www)\.)?youtube\.com/watch.*#i',
'#http://((m|www)\.)?youtube\.com/playlist.*#i',
'#https://((m|www)\.)?youtube\.com/playlist.*#i',
'#http://youtu\.be/.*#i',
'#https://youtu\.be/.*#i',
'#https?://(.+\.)?vimeo\.com/.*#i',
'#https?://(www\.)?dailymotion\.com/.*#i',
'#https?://dai\.ly/*#i',
'#https?://(www\.)?hulu\.com/watch/.*#i',
'#https?://wordpress\.tv/.*#i',
'#https?://(www\.)?funnyordie\.com/videos/.*#i',
'#https?://vine\.co/v/.*#i',
'#https?://(www\.)?collegehumor\.com/video/.*#i',
'#https?://(www\.|embed\.)?ted\.com/talks/.*#i',
)
);
// Supports responsive.
$supports_responsive = false;
// Check if responsive wrap should be added.
foreach ( $hosts as $host ) {
if ( strpos( $url, $host ) !== false ) {
$supports_responsive = true;
break; // no need to loop further.
}
}
// Output code.
if ( $supports_responsive ) {
return '
' . $cache . '
';
} else {
return '
' . $cache . '
';
}
}
/**
* Adds extra classes to the post_class() output
*
* @param obj $classes Return classes.
* @since 1.0.0
*/
public static function post_class( $classes ) {
// Get post.
global $post;
// Add entry class.
$classes[] = 'entry';
// Add has media class.
if ( has_post_thumbnail()
|| get_post_meta( $post->ID, 'ocean_post_oembed', true )
|| get_post_meta( $post->ID, 'ocean_post_self_hosted_media', true )
|| get_post_meta( $post->ID, 'ocean_post_video_embed', true )
) {
$classes[] = 'has-media';
}
// Return classes.
return $classes;
}
/**
* Add schema markup to the authors post link
*
* @param obj $link Author link.
* @since 1.0.0
*/
public static function the_author_posts_link( $link ) {
// Add schema markup.
$schema = oceanwp_get_schema_markup( 'author_link' );
if ( $schema ) {
$link = str_replace( 'rel="author"', 'rel="author" ' . $schema, $link );
}
// Return link.
return $link;
}
/**
* Add support for Elementor Pro locations
*
* @param obj $elementor_theme_manager Elementor Instance.
* @since 1.5.6
*/
public static function register_elementor_locations( $elementor_theme_manager ) {
$elementor_theme_manager->register_all_core_location();
}
/**
* Add schema markup to the authors post link
*
* @since 1.1.5
*/
public static function remove_bb_lightbox() {
return true;
}
}
/**--------------------------------------------------------------------------------
#region Freemius - This logic will only be executed when Ocean Extra is active and has the Freemius SDK
---------------------------------------------------------------------------------*/
if ( ! function_exists( 'owp_fs' ) ) {
if ( class_exists( 'Ocean_Extra' ) &&
defined( 'OE_FILE_PATH' ) &&
file_exists( dirname( OE_FILE_PATH ) . '/includes/freemius/start.php' )
) {
/**
* Create a helper function for easy SDK access.
*/
function owp_fs() {
global $owp_fs;
if ( ! isset( $owp_fs ) ) {
// Include Freemius SDK.
require_once dirname( OE_FILE_PATH ) . '/includes/freemius/start.php';
$owp_fs = fs_dynamic_init(
array(
'id' => '3752',
'bundle_id' => '3767',
'slug' => 'oceanwp',
'type' => 'theme',
'public_key' => 'pk_043077b34f20f5e11334af3c12493',
'bundle_public_key' => 'pk_c334eb1ae413deac41e30bf00b9dc',
'is_premium' => false,
'has_addons' => true,
'has_paid_plans' => true,
'menu' => array(
'slug' => 'oceanwp',
'account' => true,
'contact' => false,
'support' => false,
),
'bundle_license_auto_activation' => true,
'navigation' => 'menu',
'is_org_compliant' => true,
)
);
}
return $owp_fs;
}
// Init Freemius.
owp_fs();
// Signal that SDK was initiated.
do_action( 'owp_fs_loaded' );
}
}
// endregion
new OCEANWP_Theme_Class();
home/eticmes/www/wp-content/themes/goya-child/functions.php 0000644 00000000645 15154671215 0020111 0 ustar 00 get('Version')
);
}
add_action( 'wp_enqueue_scripts', 'goya_child_enqueue_styles' ); home/eticmes/www/wp-content/themes/twentytwentyfour/functions.php 0000644 00000012556 15155121165 0021571 0 ustar 00 'arrow-icon-details',
'label' => __( 'Arrow icon', 'twentytwentyfour' ),
/*
* Styles for the custom Arrow icon style of the Details block
*/
'inline_style' => '
.is-style-arrow-icon-details {
padding-top: var(--wp--preset--spacing--10);
padding-bottom: var(--wp--preset--spacing--10);
}
.is-style-arrow-icon-details summary {
list-style-type: "\2193\00a0\00a0\00a0";
}
.is-style-arrow-icon-details[open]>summary {
list-style-type: "\2192\00a0\00a0\00a0";
}',
)
);
register_block_style(
'core/post-terms',
array(
'name' => 'pill',
'label' => __( 'Pill', 'twentytwentyfour' ),
/*
* Styles variation for post terms
* https://github.com/WordPress/gutenberg/issues/24956
*/
'inline_style' => '
.is-style-pill a,
.is-style-pill span:not([class], [data-rich-text-placeholder]) {
display: inline-block;
background-color: var(--wp--preset--color--base-2);
padding: 0.375rem 0.875rem;
border-radius: var(--wp--preset--spacing--20);
}
.is-style-pill a:hover {
background-color: var(--wp--preset--color--contrast-3);
}',
)
);
register_block_style(
'core/list',
array(
'name' => 'checkmark-list',
'label' => __( 'Checkmark', 'twentytwentyfour' ),
/*
* Styles for the custom checkmark list block style
* https://github.com/WordPress/gutenberg/issues/51480
*/
'inline_style' => '
ul.is-style-checkmark-list {
list-style-type: "\2713";
}
ul.is-style-checkmark-list li {
padding-inline-start: 1ch;
}',
)
);
register_block_style(
'core/navigation-link',
array(
'name' => 'arrow-link',
'label' => __( 'With arrow', 'twentytwentyfour' ),
/*
* Styles for the custom arrow nav link block style
*/
'inline_style' => '
.is-style-arrow-link .wp-block-navigation-item__label:after {
content: "\2197";
padding-inline-start: 0.25rem;
vertical-align: middle;
text-decoration: none;
display: inline-block;
}',
)
);
register_block_style(
'core/heading',
array(
'name' => 'asterisk',
'label' => __( 'With asterisk', 'twentytwentyfour' ),
'inline_style' => "
.is-style-asterisk:before {
content: '';
width: 1.5rem;
height: 3rem;
background: var(--wp--preset--color--contrast-2, currentColor);
clip-path: path('M11.93.684v8.039l5.633-5.633 1.216 1.23-5.66 5.66h8.04v1.737H13.2l5.701 5.701-1.23 1.23-5.742-5.742V21h-1.737v-8.094l-5.77 5.77-1.23-1.217 5.743-5.742H.842V9.98h8.162l-5.701-5.7 1.23-1.231 5.66 5.66V.684h1.737Z');
display: block;
}
/* Hide the asterisk if the heading has no content, to avoid using empty headings to display the asterisk only, which is an A11Y issue */
.is-style-asterisk:empty:before {
content: none;
}
.is-style-asterisk:-moz-only-whitespace:before {
content: none;
}
.is-style-asterisk.has-text-align-center:before {
margin: 0 auto;
}
.is-style-asterisk.has-text-align-right:before {
margin-left: auto;
}
.rtl .is-style-asterisk.has-text-align-left:before {
margin-right: auto;
}",
)
);
}
endif;
add_action( 'init', 'twentytwentyfour_block_styles' );
/**
* Enqueue block stylesheets.
*/
if ( ! function_exists( 'twentytwentyfour_block_stylesheets' ) ) :
/**
* Enqueue custom block stylesheets
*
* @since Twenty Twenty-Four 1.0
* @return void
*/
function twentytwentyfour_block_stylesheets() {
/**
* The wp_enqueue_block_style() function allows us to enqueue a stylesheet
* for a specific block. These will only get loaded when the block is rendered
* (both in the editor and on the front end), improving performance
* and reducing the amount of data requested by visitors.
*
* See https://make.wordpress.org/core/2021/12/15/using-multiple-stylesheets-per-block/ for more info.
*/
wp_enqueue_block_style(
'core/button',
array(
'handle' => 'twentytwentyfour-button-style-outline',
'src' => get_parent_theme_file_uri( 'assets/css/button-outline.css' ),
'ver' => wp_get_theme( get_template() )->get( 'Version' ),
'path' => get_parent_theme_file_path( 'assets/css/button-outline.css' ),
)
);
}
endif;
add_action( 'init', 'twentytwentyfour_block_stylesheets' );
/**
* Register pattern categories.
*/
if ( ! function_exists( 'twentytwentyfour_pattern_categories' ) ) :
/**
* Register pattern categories
*
* @since Twenty Twenty-Four 1.0
* @return void
*/
function twentytwentyfour_pattern_categories() {
register_block_pattern_category(
'page',
array(
'label' => _x( 'Pages', 'Block pattern category' ),
'description' => __( 'A collection of full page layouts.' ),
)
);
}
endif;
add_action( 'init', 'twentytwentyfour_pattern_categories' );
home/eticmes/www/wp-content/themes/twentytwentytwo/functions.php 0000644 00000002571 15155136363 0021431 0 ustar 00 get( 'Version' );
$version_string = is_string( $theme_version ) ? $theme_version : false;
wp_register_style(
'twentytwentytwo-style',
get_template_directory_uri() . '/style.css',
array(),
$version_string
);
// Enqueue theme stylesheet.
wp_enqueue_style( 'twentytwentytwo-style' );
}
endif;
add_action( 'wp_enqueue_scripts', 'twentytwentytwo_styles' );
// Add block patterns
require get_template_directory() . '/inc/block-patterns.php';
home/eticmes/www/wp-content/themes/goya/functions.php 0000644 00000003774 15155174615 0017041 0 ustar 00 get( 'Version' )
);
}
endif;
add_action( 'wp_enqueue_scripts', 'twentytwentyfive_enqueue_styles' );
// Registers custom block styles.
if ( ! function_exists( 'twentytwentyfive_block_styles' ) ) :
/**
* Registers custom block styles.
*
* @since Twenty Twenty-Five 1.0
*
* @return void
*/
function twentytwentyfive_block_styles() {
register_block_style(
'core/list',
array(
'name' => 'checkmark-list',
'label' => __( 'Checkmark', 'twentytwentyfive' ),
'inline_style' => '
ul.is-style-checkmark-list {
list-style-type: "\2713";
}
ul.is-style-checkmark-list li {
padding-inline-start: 1ch;
}',
)
);
}
endif;
add_action( 'init', 'twentytwentyfive_block_styles' );
// Registers pattern categories.
if ( ! function_exists( 'twentytwentyfive_pattern_categories' ) ) :
/**
* Registers pattern categories.
*
* @since Twenty Twenty-Five 1.0
*
* @return void
*/
function twentytwentyfive_pattern_categories() {
register_block_pattern_category(
'twentytwentyfive_page',
array(
'label' => __( 'Pages', 'twentytwentyfive' ),
'description' => __( 'A collection of full page layouts.', 'twentytwentyfive' ),
)
);
register_block_pattern_category(
'twentytwentyfive_post-format',
array(
'label' => __( 'Post formats', 'twentytwentyfive' ),
'description' => __( 'A collection of post format patterns.', 'twentytwentyfive' ),
)
);
}
endif;
add_action( 'init', 'twentytwentyfive_pattern_categories' );
// Registers block binding sources.
if ( ! function_exists( 'twentytwentyfive_register_block_bindings' ) ) :
/**
* Registers the post format block binding source.
*
* @since Twenty Twenty-Five 1.0
*
* @return void
*/
function twentytwentyfive_register_block_bindings() {
register_block_bindings_source(
'twentytwentyfive/format',
array(
'label' => _x( 'Post format name', 'Label for the block binding placeholder in the editor', 'twentytwentyfive' ),
'get_value_callback' => 'twentytwentyfive_format_binding',
)
);
}
endif;
add_action( 'init', 'twentytwentyfive_register_block_bindings' );
// Registers block binding callback function for the post format name.
if ( ! function_exists( 'twentytwentyfive_format_binding' ) ) :
/**
* Callback function for the post format name block binding source.
*
* @since Twenty Twenty-Five 1.0
*
* @return string|void Post format name, or nothing if the format is 'standard'.
*/
function twentytwentyfive_format_binding() {
$post_format_slug = get_post_format();
if ( $post_format_slug && 'standard' !== $post_format_slug ) {
return get_post_format_string( $post_format_slug );
}
}
endif;
home/eticmes/www/wp-content/themes/twentytwentyone/functions.php 0000644 00000045541 15155450632 0021403 0 ustar 00 tag in the document head,
* WordPress will provide it for us.
*/
add_theme_support( 'title-tag' );
/**
* Add post-formats support.
*/
add_theme_support(
'post-formats',
array(
'link',
'aside',
'gallery',
'image',
'quote',
'status',
'video',
'audio',
'chat',
)
);
/*
* 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' );
set_post_thumbnail_size( 1568, 9999 );
register_nav_menus(
array(
'primary' => esc_html__( 'Primary menu', 'twentytwentyone' ),
'footer' => esc_html__( 'Secondary menu', 'twentytwentyone' ),
)
);
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support(
'html5',
array(
'comment-form',
'comment-list',
'gallery',
'caption',
'style',
'script',
'navigation-widgets',
)
);
/*
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
$logo_width = 300;
$logo_height = 100;
add_theme_support(
'custom-logo',
array(
'height' => $logo_height,
'width' => $logo_width,
'flex-width' => true,
'flex-height' => true,
'unlink-homepage-logo' => true,
)
);
// 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' );
// Add support for full and wide align images.
add_theme_support( 'align-wide' );
// Add support for editor styles.
add_theme_support( 'editor-styles' );
$background_color = get_theme_mod( 'background_color', 'D1E4DD' );
if ( 127 > Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( $background_color ) ) {
add_theme_support( 'dark-editor-style' );
}
$editor_stylesheet_path = './assets/css/style-editor.css';
// Note, the is_IE global variable is defined by WordPress and is used
// to detect if the current browser is internet explorer.
global $is_IE;
if ( $is_IE ) {
$editor_stylesheet_path = './assets/css/ie-editor.css';
}
// Enqueue editor styles.
add_editor_style( $editor_stylesheet_path );
// Add custom editor font sizes.
add_theme_support(
'editor-font-sizes',
array(
array(
'name' => esc_html__( 'Extra small', 'twentytwentyone' ),
'shortName' => esc_html_x( 'XS', 'Font size', 'twentytwentyone' ),
'size' => 16,
'slug' => 'extra-small',
),
array(
'name' => esc_html__( 'Small', 'twentytwentyone' ),
'shortName' => esc_html_x( 'S', 'Font size', 'twentytwentyone' ),
'size' => 18,
'slug' => 'small',
),
array(
'name' => esc_html__( 'Normal', 'twentytwentyone' ),
'shortName' => esc_html_x( 'M', 'Font size', 'twentytwentyone' ),
'size' => 20,
'slug' => 'normal',
),
array(
'name' => esc_html__( 'Large', 'twentytwentyone' ),
'shortName' => esc_html_x( 'L', 'Font size', 'twentytwentyone' ),
'size' => 24,
'slug' => 'large',
),
array(
'name' => esc_html__( 'Extra large', 'twentytwentyone' ),
'shortName' => esc_html_x( 'XL', 'Font size', 'twentytwentyone' ),
'size' => 40,
'slug' => 'extra-large',
),
array(
'name' => esc_html__( 'Huge', 'twentytwentyone' ),
'shortName' => esc_html_x( 'XXL', 'Font size', 'twentytwentyone' ),
'size' => 96,
'slug' => 'huge',
),
array(
'name' => esc_html__( 'Gigantic', 'twentytwentyone' ),
'shortName' => esc_html_x( 'XXXL', 'Font size', 'twentytwentyone' ),
'size' => 144,
'slug' => 'gigantic',
),
)
);
// Custom background color.
add_theme_support(
'custom-background',
array(
'default-color' => 'd1e4dd',
)
);
// Editor color palette.
$black = '#000000';
$dark_gray = '#28303D';
$gray = '#39414D';
$green = '#D1E4DD';
$blue = '#D1DFE4';
$purple = '#D1D1E4';
$red = '#E4D1D1';
$orange = '#E4DAD1';
$yellow = '#EEEADD';
$white = '#FFFFFF';
add_theme_support(
'editor-color-palette',
array(
array(
'name' => esc_html__( 'Black', 'twentytwentyone' ),
'slug' => 'black',
'color' => $black,
),
array(
'name' => esc_html__( 'Dark gray', 'twentytwentyone' ),
'slug' => 'dark-gray',
'color' => $dark_gray,
),
array(
'name' => esc_html__( 'Gray', 'twentytwentyone' ),
'slug' => 'gray',
'color' => $gray,
),
array(
'name' => esc_html__( 'Green', 'twentytwentyone' ),
'slug' => 'green',
'color' => $green,
),
array(
'name' => esc_html__( 'Blue', 'twentytwentyone' ),
'slug' => 'blue',
'color' => $blue,
),
array(
'name' => esc_html__( 'Purple', 'twentytwentyone' ),
'slug' => 'purple',
'color' => $purple,
),
array(
'name' => esc_html__( 'Red', 'twentytwentyone' ),
'slug' => 'red',
'color' => $red,
),
array(
'name' => esc_html__( 'Orange', 'twentytwentyone' ),
'slug' => 'orange',
'color' => $orange,
),
array(
'name' => esc_html__( 'Yellow', 'twentytwentyone' ),
'slug' => 'yellow',
'color' => $yellow,
),
array(
'name' => esc_html__( 'White', 'twentytwentyone' ),
'slug' => 'white',
'color' => $white,
),
)
);
add_theme_support(
'editor-gradient-presets',
array(
array(
'name' => esc_html__( 'Purple to yellow', 'twentytwentyone' ),
'gradient' => 'linear-gradient(160deg, ' . $purple . ' 0%, ' . $yellow . ' 100%)',
'slug' => 'purple-to-yellow',
),
array(
'name' => esc_html__( 'Yellow to purple', 'twentytwentyone' ),
'gradient' => 'linear-gradient(160deg, ' . $yellow . ' 0%, ' . $purple . ' 100%)',
'slug' => 'yellow-to-purple',
),
array(
'name' => esc_html__( 'Green to yellow', 'twentytwentyone' ),
'gradient' => 'linear-gradient(160deg, ' . $green . ' 0%, ' . $yellow . ' 100%)',
'slug' => 'green-to-yellow',
),
array(
'name' => esc_html__( 'Yellow to green', 'twentytwentyone' ),
'gradient' => 'linear-gradient(160deg, ' . $yellow . ' 0%, ' . $green . ' 100%)',
'slug' => 'yellow-to-green',
),
array(
'name' => esc_html__( 'Red to yellow', 'twentytwentyone' ),
'gradient' => 'linear-gradient(160deg, ' . $red . ' 0%, ' . $yellow . ' 100%)',
'slug' => 'red-to-yellow',
),
array(
'name' => esc_html__( 'Yellow to red', 'twentytwentyone' ),
'gradient' => 'linear-gradient(160deg, ' . $yellow . ' 0%, ' . $red . ' 100%)',
'slug' => 'yellow-to-red',
),
array(
'name' => esc_html__( 'Purple to red', 'twentytwentyone' ),
'gradient' => 'linear-gradient(160deg, ' . $purple . ' 0%, ' . $red . ' 100%)',
'slug' => 'purple-to-red',
),
array(
'name' => esc_html__( 'Red to purple', 'twentytwentyone' ),
'gradient' => 'linear-gradient(160deg, ' . $red . ' 0%, ' . $purple . ' 100%)',
'slug' => 'red-to-purple',
),
)
);
/*
* Adds starter content to highlight the theme on fresh sites.
* This is done conditionally to avoid loading the starter content on every
* page load, as it is a one-off operation only needed once in the customizer.
*/
if ( is_customize_preview() ) {
require get_template_directory() . '/inc/starter-content.php';
add_theme_support( 'starter-content', twenty_twenty_one_get_starter_content() );
}
// Add support for responsive embedded content.
add_theme_support( 'responsive-embeds' );
// Add support for custom line height controls.
add_theme_support( 'custom-line-height' );
// Add support for link color control.
add_theme_support( 'link-color' );
// Add support for experimental cover block spacing.
add_theme_support( 'custom-spacing' );
// Add support for custom units.
// This was removed in WordPress 5.6 but is still required to properly support WP 5.5.
add_theme_support( 'custom-units' );
// Remove feed icon link from legacy RSS widget.
add_filter( 'rss_widget_feed_link', '__return_empty_string' );
}
}
add_action( 'after_setup_theme', 'twenty_twenty_one_setup' );
/**
* Registers widget area.
*
* @since Twenty Twenty-One 1.0
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*
* @return void
*/
function twenty_twenty_one_widgets_init() {
register_sidebar(
array(
'name' => esc_html__( 'Footer', 'twentytwentyone' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here to appear in your footer.', 'twentytwentyone' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '
',
'after_title' => '
',
)
);
}
add_action( 'widgets_init', 'twenty_twenty_one_widgets_init' );
/**
* Sets the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @since Twenty Twenty-One 1.0
*
* @global int $content_width Content width.
*
* @return void
*/
function twenty_twenty_one_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( 'twenty_twenty_one_content_width', 750 );
}
add_action( 'after_setup_theme', 'twenty_twenty_one_content_width', 0 );
/**
* Enqueues scripts and styles.
*
* @since Twenty Twenty-One 1.0
*
* @global bool $is_IE
* @global WP_Scripts $wp_scripts
*
* @return void
*/
function twenty_twenty_one_scripts() {
// Note, the is_IE global variable is defined by WordPress and is used
// to detect if the current browser is internet explorer.
global $is_IE, $wp_scripts;
if ( $is_IE ) {
// If IE 11 or below, use a flattened stylesheet with static values replacing CSS Variables.
wp_enqueue_style( 'twenty-twenty-one-style', get_template_directory_uri() . '/assets/css/ie.css', array(), wp_get_theme()->get( 'Version' ) );
} else {
// If not IE, use the standard stylesheet.
wp_enqueue_style( 'twenty-twenty-one-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );
}
// RTL styles.
wp_style_add_data( 'twenty-twenty-one-style', 'rtl', 'replace' );
// Print styles.
wp_enqueue_style( 'twenty-twenty-one-print-style', get_template_directory_uri() . '/assets/css/print.css', array(), wp_get_theme()->get( 'Version' ), 'print' );
// Threaded comment reply styles.
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
// Register the IE11 polyfill file.
wp_register_script(
'twenty-twenty-one-ie11-polyfills-asset',
get_template_directory_uri() . '/assets/js/polyfills.js',
array(),
wp_get_theme()->get( 'Version' ),
array( 'in_footer' => true )
);
// Register the IE11 polyfill loader.
wp_register_script(
'twenty-twenty-one-ie11-polyfills',
null,
array(),
wp_get_theme()->get( 'Version' ),
array( 'in_footer' => true )
);
wp_add_inline_script(
'twenty-twenty-one-ie11-polyfills',
wp_get_script_polyfill(
$wp_scripts,
array(
'Element.prototype.matches && Element.prototype.closest && window.NodeList && NodeList.prototype.forEach' => 'twenty-twenty-one-ie11-polyfills-asset',
)
)
);
// Main navigation scripts.
if ( has_nav_menu( 'primary' ) ) {
wp_enqueue_script(
'twenty-twenty-one-primary-navigation-script',
get_template_directory_uri() . '/assets/js/primary-navigation.js',
array( 'twenty-twenty-one-ie11-polyfills' ),
wp_get_theme()->get( 'Version' ),
array(
'in_footer' => false, // Because involves header.
'strategy' => 'defer',
)
);
}
// Responsive embeds script.
wp_enqueue_script(
'twenty-twenty-one-responsive-embeds-script',
get_template_directory_uri() . '/assets/js/responsive-embeds.js',
array( 'twenty-twenty-one-ie11-polyfills' ),
wp_get_theme()->get( 'Version' ),
array( 'in_footer' => true )
);
}
add_action( 'wp_enqueue_scripts', 'twenty_twenty_one_scripts' );
/**
* Enqueues block editor script.
*
* @since Twenty Twenty-One 1.0
*
* @return void
*/
function twentytwentyone_block_editor_script() {
wp_enqueue_script( 'twentytwentyone-editor', get_theme_file_uri( '/assets/js/editor.js' ), array( 'wp-blocks', 'wp-dom' ), wp_get_theme()->get( 'Version' ), array( 'in_footer' => true ) );
}
add_action( 'enqueue_block_editor_assets', 'twentytwentyone_block_editor_script' );
/**
* Fixes skip link focus in IE11.
*
* This does not enqueue the script because it is tiny and because it is only for IE11,
* thus it does not warrant having an entire dedicated blocking script being loaded.
*
* @since Twenty Twenty-One 1.0
* @deprecated Twenty Twenty-One 1.9 Removed from wp_print_footer_scripts action.
*
* @link https://git.io/vWdr2
*/
function twenty_twenty_one_skip_link_focus_fix() {
// If SCRIPT_DEBUG is defined and true, print the unminified file.
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
echo '';
} else {
// The following is minified via `npx terser --compress --mangle -- assets/js/skip-link-focus-fix.js`.
?>
get( 'Version' ),
array( 'in_footer' => true )
);
wp_enqueue_script(
'twentytwentyone-customize-preview',
get_theme_file_uri( '/assets/js/customize-preview.js' ),
array( 'customize-preview', 'customize-selective-refresh', 'jquery', 'twentytwentyone-customize-helpers' ),
wp_get_theme()->get( 'Version' ),
array( 'in_footer' => true )
);
}
add_action( 'customize_preview_init', 'twentytwentyone_customize_preview_init' );
/**
* Enqueues scripts for the customizer.
*
* @since Twenty Twenty-One 1.0
*
* @return void
*/
function twentytwentyone_customize_controls_enqueue_scripts() {
wp_enqueue_script(
'twentytwentyone-customize-helpers',
get_theme_file_uri( '/assets/js/customize-helpers.js' ),
array(),
wp_get_theme()->get( 'Version' ),
array( 'in_footer' => true )
);
}
add_action( 'customize_controls_enqueue_scripts', 'twentytwentyone_customize_controls_enqueue_scripts' );
/**
* Calculates classes for the main element.
*
* @since Twenty Twenty-One 1.0
*
* @return void
*/
function twentytwentyone_the_html_classes() {
/**
* Filters the classes for the main element.
*
* @since Twenty Twenty-One 1.0
*
* @param string The list of classes. Default empty string.
*/
$classes = apply_filters( 'twentytwentyone_html_classes', '' );
if ( ! $classes ) {
return;
}
echo 'class="' . esc_attr( $classes ) . '"';
}
/**
* Adds "is-IE" class to body if the user is on Internet Explorer.
*
* @since Twenty Twenty-One 1.0
*
* @return void
*/
function twentytwentyone_add_ie_class() {
?>
'post',
'type' => '',
] );
/**
* Filter meta type from object type and object id.
*
* @var string Meta type, default is post type name.
* @var string Object type.
* @var ?string|?int Object id.
*/
$type = apply_filters( 'rwmb_meta_type', $args['type'], $args['object_type'], $object_id );
if ( ! $type ) {
$type = get_post_type( $object_id );
}
return rwmb_get_registry( 'field' )->get( $key, $type, $args['object_type'] );
}
}
if ( ! function_exists( 'rwmb_meta_legacy' ) ) {
/**
* Get post meta.
*
* @param string $key Meta key. Required.
* @param array $args Array of arguments. Optional.
* @param int|null $post_id Post ID. null for current post. Optional.
*
* @return mixed
*/
function rwmb_meta_legacy( $key, $args = [], $post_id = null ) {
$args = wp_parse_args( $args, [
'type' => 'text',
'multiple' => false,
'clone' => false,
] );
$field = [
'id' => $key,
'type' => $args['type'],
'clone' => $args['clone'],
'multiple' => $args['multiple'],
];
$method = 'get_value';
switch ( $args['type'] ) {
case 'taxonomy':
case 'taxonomy_advanced':
$field['taxonomy'] = $args['taxonomy'];
break;
case 'map':
case 'osm':
case 'oembed':
$method = 'the_value';
break;
}
$field = RWMB_Field::call( 'normalize', $field );
return RWMB_Field::call( $method, $field, $args, $post_id );
}
}
if ( ! function_exists( 'rwmb_get_value' ) ) {
/**
* Get value of custom field.
* This is used to replace old version of rwmb_meta key.
*
* @param string $field_id Field ID. Required.
* @param array $args Additional arguments. Rarely used. See specific fields for details.
* @param int|null $post_id Post ID. null for current post. Optional.
*
* @return mixed false if field doesn't exist. Field value otherwise.
*/
function rwmb_get_value( $field_id, $args = [], $post_id = null ) {
$args = wp_parse_args( $args );
$field = rwmb_get_field_settings( $field_id, $args, $post_id );
// Get field value.
$value = $field ? RWMB_Field::call( 'get_value', $field, $args, $post_id ) : false;
/*
* Allow developers to change the returned value of field.
* For version < 4.8.2, the filter name was 'rwmb_get_field'.
*
* @param mixed $value Field value.
* @param array $field Field parameters.
* @param array $args Additional arguments. Rarely used. See specific fields for details.
* @param int|null $post_id Post ID. null for current post. Optional.
*/
$value = apply_filters( 'rwmb_get_value', $value, $field, $args, $post_id );
return $value;
}
}
if ( ! function_exists( 'rwmb_the_value' ) ) {
/**
* Display the value of a field
*
* @param string $field_id Field ID. Required.
* @param array $args Additional arguments. Rarely used. See specific fields for details.
* @param int|null $post_id Post ID. null for current post. Optional.
* @param bool $echo Display field meta value? Default `true` which works in almost all cases. We use `false` for the [rwmb_meta] shortcode.
*
* @return string
*/
function rwmb_the_value( $field_id, $args = [], $post_id = null, $echo = true ) {
$args = wp_parse_args( $args );
$field = rwmb_get_field_settings( $field_id, $args, $post_id );
if ( ! $field ) {
return '';
}
$output = RWMB_Field::call( 'the_value', $field, $args, $post_id );
/*
* Allow developers to change the returned value of field.
* For version < 4.8.2, the filter name was 'rwmb_get_field'.
*
* @param mixed $value Field HTML output.
* @param array $field Field parameters.
* @param array $args Additional arguments. Rarely used. See specific fields for details.
* @param int|null $post_id Post ID. null for current post. Optional.
*/
$output = apply_filters( 'rwmb_the_value', $output, $field, $args, $post_id );
if ( $echo ) {
echo $output; // phpcs:ignore WordPress.Security.EscapeOutput
}
return $output;
}
}
if ( ! function_exists( 'rwmb_get_object_fields' ) ) {
/**
* Get defined meta fields for object.
*
* @param int|string $type_or_id Object ID or post type / taxonomy (for terms) / user (for users).
* @param string $object_type Object type. Use post, term.
*
* @return array
*/
function rwmb_get_object_fields( $type_or_id, $object_type = 'post' ) {
$meta_boxes = rwmb_get_registry( 'meta_box' )->get_by( [ 'object_type' => $object_type ] );
array_walk( $meta_boxes, 'rwmb_check_meta_box_supports', [ $object_type, $type_or_id ] );
$meta_boxes = array_filter( $meta_boxes );
$fields = [];
foreach ( $meta_boxes as $meta_box ) {
foreach ( $meta_box->fields as $field ) {
$fields[ $field['id'] ] = $field;
}
}
return $fields;
}
}
if ( ! function_exists( 'rwmb_check_meta_box_supports' ) ) {
/**
* Check if a meta box supports an object.
*
* @param object $meta_box Meta Box object.
* @param int $key Not used.
* @param array $object_data Object data (type and ID).
*/
function rwmb_check_meta_box_supports( &$meta_box, $key, $object_data ) {
list( $object_type, $type_or_id ) = $object_data;
$type = null;
$prop = null;
switch ( $object_type ) {
case 'post':
$type = is_numeric( $type_or_id ) ? get_post_type( $type_or_id ) : $type_or_id;
$prop = 'post_types';
break;
case 'term':
$type = $type_or_id;
if ( is_numeric( $type_or_id ) ) {
$term = get_term( $type_or_id );
$type = is_wp_error( $term ) || ! $term ? null : $term->taxonomy;
}
$prop = 'taxonomies';
break;
case 'user':
$type = 'user';
$prop = 'user';
break;
case 'setting':
$type = $type_or_id;
$prop = 'settings_pages';
break;
}
if ( ! $type ) {
$meta_box = false;
return;
}
if ( isset( $meta_box->meta_box[ $prop ] ) && ! in_array( $type, $meta_box->meta_box[ $prop ], true ) ) {
$meta_box = false;
}
}
}
if ( ! function_exists( 'rwmb_get_registry' ) ) {
/**
* Get the registry by type.
* Always return the same instance of the registry.
*
* @param string $type Registry type.
*
* @return object
*/
function rwmb_get_registry( $type ) {
static $data = [];
$class = 'RWMB_' . RWMB_Helpers_String::title_case( $type ) . '_Registry';
if ( ! isset( $data[ $type ] ) ) {
$data[ $type ] = new $class();
}
return $data[ $type ];
}
}
if ( ! function_exists( 'rwmb_get_storage' ) ) {
/**
* Get storage instance.
*
* @param string $object_type Object type. Use post or term.
* @param RW_Meta_Box $meta_box Meta box object. Optional.
* @return RWMB_Storage_Interface
*/
function rwmb_get_storage( $object_type, $meta_box = null ) {
$class = 'RWMB_' . RWMB_Helpers_String::title_case( $object_type ) . '_Storage';
$class = class_exists( $class ) ? $class : 'RWMB_Post_Storage';
$storage = rwmb_get_registry( 'storage' )->get( $class );
return apply_filters( 'rwmb_get_storage', $storage, $object_type, $meta_box );
}
}
if ( ! function_exists( 'rwmb_request' ) ) {
/**
* Get request object.
*
* @return RWMB_Request
*/
function rwmb_request() {
static $request;
if ( ! $request ) {
$request = new RWMB_Request();
}
return $request;
}
}