general changes

This commit is contained in:
2024-07-16 01:00:43 -07:00
parent 0f9e1492cc
commit 2da6388725
3 changed files with 14 additions and 14 deletions

View File

@ -14,45 +14,44 @@
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="https://gmpg.org/xfn/11">
<?php
$author_id = get_option('sophia_after_dark_home_og_user', 1); // Default to user ID 1 if not set
<?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: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";
// Uncomment and adjust the following lines if needed
$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: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();
?>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>