145 lines
4.9 KiB
PHP
145 lines
4.9 KiB
PHP
<?php
|
|
/**
|
|
* The header for our theme
|
|
*
|
|
* This is the template that displays all of the <head> section and everything up until <div id="content">
|
|
*
|
|
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
|
|
*
|
|
* @package Sophia After Dark
|
|
* @since 1.0.0
|
|
*/
|
|
|
|
?>
|
|
<!doctype html>
|
|
<html <?php language_attributes(); ?>>
|
|
<head>
|
|
|
|
<?php
|
|
$author_id = get_option('sophia_after_dark_home_og_user', 1); // Default to user ID 1 if not set
|
|
$author_bio = get_the_author_meta('description', $author_id);
|
|
|
|
echo '<meta charset="' . get_bloginfo('charset') . '">' . "\n";
|
|
echo '<meta name="viewport" content="width=device-width, initial-scale=1">' . "\n";
|
|
|
|
if (is_front_page()) {
|
|
$home_og_image = get_option('sophia_after_dark_home_og_image');
|
|
if ($home_og_image) {
|
|
echo '<meta property="og:image" content="' . esc_url($home_og_image) . '" />' . "\n";
|
|
}
|
|
echo '<meta property="og:title" content="' . esc_attr(get_bloginfo('name') . ' - ' . get_bloginfo('description')) . '" />' . "\n";
|
|
echo '<meta property="og:description" content="' . esc_attr($author_bio) . '" />' . "\n";
|
|
echo '<meta property="og:url" content="' . esc_url(home_url('/')) . '" />' . "\n";
|
|
} elseif (is_single() || is_page()) {
|
|
global $post;
|
|
if (has_post_thumbnail($post->ID)) {
|
|
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'og-image-size');
|
|
if ($thumbnail) {
|
|
echo '<meta property="og:image" content="' . esc_url($thumbnail[0]) . '" />' . "\n";
|
|
// $thumbnail_url = esc_url($thumbnail[0]);
|
|
// $thumbnail_parts = pathinfo($thumbnail_url);
|
|
// $thumbnail_new_url = $thumbnail_parts['dirname'] . '/' . $thumbnail_parts['filename'] . '-1536x878.' . $thumbnail_parts['extension'];
|
|
// echo '<meta property="og:image" content="' . $thumbnail_new_url . '" />' . "\n";
|
|
}
|
|
} else {
|
|
echo '<meta property="og:image" content="' . esc_url(get_template_directory_uri() . '/assets/images/default-og-image.webp') . '" />' . "\n";
|
|
}
|
|
|
|
echo '<meta property="og:title" content="' . esc_attr(get_the_title()) . '" />' . "\n";
|
|
echo '<meta property="og:description" content="' . esc_attr(get_the_excerpt()) . '" />' . "\n";
|
|
echo '<meta property="og:url" content="' . esc_url(get_permalink()) . '" />' . "\n";
|
|
}
|
|
echo '<link rel="profile" href="https://gmpg.org/xfn/11">' . "\n";
|
|
wp_head();
|
|
?>
|
|
</head>
|
|
|
|
<body <?php body_class(); ?>>
|
|
|
|
<?php
|
|
if ( function_exists( 'wp_body_open' ) ) {
|
|
wp_body_open();
|
|
} else {
|
|
/**
|
|
* Hook: wp_body_open
|
|
*
|
|
* @since 1.1.0
|
|
*/
|
|
do_action( 'wp_body_open' );
|
|
}
|
|
|
|
/**
|
|
* sophia_after_dark before page hook
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
do_action( 'sophia_after_dark_before_page' );
|
|
?>
|
|
|
|
<div id="page" class="site">
|
|
<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip To Content', 'sophia-after-dark' ) ?></a>
|
|
<?php
|
|
/**
|
|
* sophia_after_dark before header
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
do_action( 'sophia_after_dark_before_header' );
|
|
|
|
$sophia_after_dark_enable_top_header = get_theme_mod( 'sophia_after_dark_enable_top_header', true );
|
|
if ( true === $sophia_after_dark_enable_top_header ) {
|
|
/**
|
|
* hook - sophia_after_dark_top_header
|
|
*
|
|
* @hooked - sophia_after_dark_top_header_start - 5
|
|
* @hooked - sophia_after_dark_trending_section - 10
|
|
* @hooked - sophia_after_dark_top_header_nav - 20
|
|
* @hooked - sophia_after_dark_top_header_end - 50
|
|
*/
|
|
do_action( 'sophia_after_dark_top_header' );
|
|
}
|
|
|
|
/**
|
|
* sophia_after_dark main header
|
|
*
|
|
* @hooked - sophia_after_dark_main_header_start - 5
|
|
* @hooked - sophia_after_dark_site_branding - 10
|
|
* @hooked - sophia_after_dark_menu_wrapper_start - 15
|
|
* @hooked - sophia_after_dark_header_main_menu - 20
|
|
* @hooked - sophia_after_dark_menu_icon_wrapper_start - 25
|
|
* @hooked - sophia_after_dark_menu_social_icons - 30
|
|
* @hooked - sophia_after_dark_menu_search_icon - 35
|
|
* @hooked - sophia_after_dark_menu_icon_wrapper_end - 40
|
|
* @hooked - sophia_after_dark_menu_wrapper_end - 45
|
|
* @hooked - sophia_after_dark_main_header_end - 50
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
do_action( 'sophia_after_dark_main_header' );
|
|
|
|
if ( is_front_page() ) {
|
|
/**
|
|
* hook - front_slider_section
|
|
* displays front top section before archive blogs.
|
|
*/
|
|
do_action( 'sophia_after_dark_front_slider_section' );
|
|
}
|
|
|
|
if ( ! is_front_page() ) {
|
|
/**
|
|
* sophia_after_dark_innerpage_header hook
|
|
*
|
|
* @hooked - sophia_after_dark_innerpage_header_start - 5
|
|
* @hooked - sophia_after_dark_innerpage_header_title - 10
|
|
* @hooked - sophia_after_dark_breadcrumb_content - 15
|
|
* @hooked - sophia_after_dark_innerpage_header_end - 20
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
do_action( 'sophia_after_dark_innerpage_header' );
|
|
}
|
|
?>
|
|
|
|
<div id="content" class="site-content">
|
|
<div class="mt-container">
|