emusem-press/functions.php

72 lines
3.5 KiB
PHP
Raw Permalink Normal View History

<?php
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;
// BEGIN ENQUEUE PARENT ACTION
// AUTO GENERATED - Do not modify or remove comment markers above or below:
if ( !function_exists( 'chld_thm_cfg_locale_css' ) ):
function chld_thm_cfg_locale_css( $uri ){
if ( empty( $uri ) && is_rtl() && file_exists( get_template_directory() . '/rtl.css' ) )
$uri = get_template_directory_uri() . '/rtl.css';
return $uri;
}
endif;
add_filter( 'locale_stylesheet_uri', 'chld_thm_cfg_locale_css' );
if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
function chld_thm_cfg_parent_css() {
wp_enqueue_style( 'chld_thm_cfg_parent', trailingslashit( get_template_directory_uri() ) . 'style.css', array( ) );
}
endif;
add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css', 10 );
if ( !function_exists( 'child_theme_configurator_css' ) ):
function child_theme_configurator_css() {
wp_enqueue_style( 'chld_thm_cfg_separate', trailingslashit( get_stylesheet_directory_uri() ) . 'ctc-style.css', array( 'chld_thm_cfg_parent','sempress-style' ) );
}
endif;
add_action( 'wp_enqueue_scripts', 'child_theme_configurator_css', 10 );
2024-09-03 02:26:22 +00:00
// END ENQUEUE PARENT ACTION
2024-09-03 02:30:10 +00:00
// specific functions for Relevanssi Light search plugin, do not use if you are not using the plugin
add_filter( 'relevanssi_light_custom_fields', function( $fields ) { return array( '_genesis_description' ); } ); // add The SEO Framework meta description to Relevanssi Light index
add_filter( 'relevanssi_light_boolean_mode', '__return_true' ); // enable boolean search mode for Relevanssi Light
2024-09-03 02:26:22 +00:00
// add dublin core metadata to header
function add_dublin_core_metadata() {
if (is_single()) {
$post_id = get_the_ID();
$author = get_post_field('post_author', $post_id);
$author_name = wp_kses_post(get_the_author_meta('display_name', $author));
$title = wp_kses_post(get_the_title());
$date = get_the_date('Y-m-d');
$description = wp_kses_post(get_the_excerpt());
$publisher = 'SITE NAME'; // replace with your own site's name
$rights = 'Copyright ' . date('Y') . ' ' . $publisher . '. All Rights Reserved.';
echo '<meta name="DC.title" content="' . esc_attr($title) . '">';
echo '<meta name="DC.creator" content="' . esc_attr($author_name) . '">';
echo '<meta name="DC.date" content="' . esc_attr($date) . '">';
echo '<meta name="DC.description" content="' . esc_attr($description) . '">';
echo '<meta name="DC.publisher" content="' . esc_attr($publisher) . '">';
echo '<meta name="DC.rights" content="' . esc_attr($rights) . '">';
echo '<meta name="DC.type" content="Text">';
echo '<meta name="DC.format" content="text/html">';
} else {
$blog_title = wp_kses_post(get_bloginfo('name'));
$blog_description = wp_kses_post(get_bloginfo('description'));
$publisher = 'SITE NAME'; // replace with your own site's name
$rights = 'Copyright ' . date('Y') . ' ' . $publisher . '. All Rights Reserved.';
echo '<meta name="DC.title" content="' . esc_attr($blog_title) . '">';
echo '<meta name="DC.description" content="' . esc_attr($blog_description) . '">';
echo '<meta name="DC.publisher" content="' . esc_attr($publisher) . '">';
echo '<meta name="DC.rights" content="' . esc_attr($rights) . '">';
echo '<meta name="DC.type" content="Text">';
echo '<meta name="DC.format" content="text/html">';
}
}
add_action('wp_head', 'add_dublin_core_metadata');