did some sniff sniff
This commit is contained in:
44
header.php
44
header.php
@@ -20,35 +20,35 @@
|
||||
|
||||
<?php
|
||||
// Set default author for home page OG metadata
|
||||
$author_id = (int) get_option( 'sophia_after_dark_home_og_user', 1 );
|
||||
$author_id = (int) get_option( 'sophia_after_dark_home_og_user', 1 );
|
||||
$author_bio = get_the_author_meta( 'description', $author_id );
|
||||
|
||||
if ( is_front_page() ) {
|
||||
$home_og_image = get_option( 'sophia_after_dark_home_og_image' );
|
||||
$home_og_image = get_option( 'sophia_after_dark_home_og_image' );
|
||||
|
||||
if ( $home_og_image ) {
|
||||
printf( '<meta property="og:image" content="%s" />' . "\n", esc_url( $home_og_image ) );
|
||||
}
|
||||
if ( $home_og_image ) {
|
||||
printf( '<meta property="og:image" content="%s" />' . "\n", esc_url( $home_og_image ) );
|
||||
}
|
||||
|
||||
printf( '<meta property="og:title" content="%s" />' . "\n", esc_attr( get_bloginfo( 'name' ) . ' - ' . get_bloginfo( 'description' ) ) );
|
||||
printf( '<meta property="og:description" content="%s" />' . "\n", esc_attr( $author_bio ) );
|
||||
printf( '<meta property="og:url" content="%s" />' . "\n", esc_url( home_url( '/' ) ) );
|
||||
printf( '<meta property="og:title" content="%s" />' . "\n", esc_attr( get_bloginfo( 'name' ) . ' - ' . get_bloginfo( 'description' ) ) );
|
||||
printf( '<meta property="og:description" content="%s" />' . "\n", esc_attr( $author_bio ) );
|
||||
printf( '<meta property="og:url" content="%s" />' . "\n", esc_url( home_url( '/' ) ) );
|
||||
|
||||
} elseif ( is_singular() ) {
|
||||
global $post;
|
||||
$thumbnail_url = get_template_directory_uri() . '/assets/images/default-og-image.webp';
|
||||
global $post;
|
||||
$thumbnail_url = get_template_directory_uri() . '/assets/images/default-og-image.webp';
|
||||
|
||||
if ( has_post_thumbnail( $post?->ID ) ) {
|
||||
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'og-image-size' );
|
||||
if ( ! empty( $image[0] ) ) {
|
||||
$thumbnail_url = $image[0];
|
||||
}
|
||||
}
|
||||
if ( has_post_thumbnail( $post?->ID ) ) {
|
||||
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'og-image-size' );
|
||||
if ( ! empty( $image[0] ) ) {
|
||||
$thumbnail_url = $image[0];
|
||||
}
|
||||
}
|
||||
|
||||
printf( '<meta property="og:image" content="%s" />' . "\n", esc_url( $thumbnail_url ) );
|
||||
printf( '<meta property="og:title" content="%s" />' . "\n", esc_attr( get_the_title() ) );
|
||||
printf( '<meta property="og:description" content="%s" />' . "\n", esc_attr( get_the_excerpt() ) );
|
||||
printf( '<meta property="og:url" content="%s" />' . "\n", esc_url( get_permalink() ) );
|
||||
printf( '<meta property="og:image" content="%s" />' . "\n", esc_url( $thumbnail_url ) );
|
||||
printf( '<meta property="og:title" content="%s" />' . "\n", esc_attr( get_the_title() ) );
|
||||
printf( '<meta property="og:description" content="%s" />' . "\n", esc_attr( get_the_excerpt() ) );
|
||||
printf( '<meta property="og:url" content="%s" />' . "\n", esc_url( get_permalink() ) );
|
||||
}
|
||||
|
||||
wp_head();
|
||||
@@ -58,9 +58,9 @@ wp_head();
|
||||
<body <?php body_class(); ?>>
|
||||
<?php
|
||||
if ( function_exists( 'wp_body_open' ) ) {
|
||||
wp_body_open();
|
||||
wp_body_open();
|
||||
} else {
|
||||
do_action( 'wp_body_open' ); // Backwards compatibility for < WP 5.2
|
||||
do_action( 'wp_body_open' ); // Backwards compatibility for < WP 5.2
|
||||
}
|
||||
|
||||
do_action( 'sophia_after_dark_before_page' );
|
||||
|
||||
Reference in New Issue
Block a user