Update functions.php

This commit is contained in:
Nicholas A. Ferrell 2024-09-03 02:26:22 +00:00
parent c380ec00dc
commit 56f792ff50

View File

@ -28,4 +28,43 @@ if ( !function_exists( 'child_theme_configurator_css' ) ):
endif; endif;
add_action( 'wp_enqueue_scripts', 'child_theme_configurator_css', 10 ); add_action( 'wp_enqueue_scripts', 'child_theme_configurator_css', 10 );
// END ENQUEUE PARENT ACTION // END ENQUEUE PARENT ACTION
// modify search
add_filter( 'relevanssi_light_custom_fields', function( $fields ) { return array( '_genesis_description' ); } );
// 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');