mirror of
https://github.com/ascribe/wp-theme
synced 2024-12-22 17:23:55 +01:00
fix permalink & sharing image
This commit is contained in:
parent
35c3dd3fd5
commit
1d9b246338
@ -12,6 +12,17 @@ $description = '';
|
||||
$image = '';
|
||||
$title = '';
|
||||
$url = get_bloginfo('wpurl');
|
||||
$permalink = esc_url( get_permalink($post->ID) );
|
||||
$twitter = '@ascribeio';
|
||||
|
||||
if ( has_post_thumbnail() ) {
|
||||
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' );
|
||||
$shareimage = $large_image_url[0];
|
||||
} else if ( get_field('header_background_image') != '' ) {
|
||||
$shareimage = get_field('header_background_image')['url'];
|
||||
} else {
|
||||
$shareimage = WPTHEME_TEMPLATE_URL . '/images/ico/apple-touch-icon-180x180.png';
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold desc="Get Title">
|
||||
|
13
header.php
13
header.php
@ -32,21 +32,22 @@ if (is_home()) {
|
||||
<base href="<?php echo $url; ?>">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0">
|
||||
<meta name="description" content="<?php echo $description ?>">
|
||||
|
||||
<meta property="og:title" content="<?php echo $title; ?>" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="<?php echo $url; ?>" />
|
||||
<meta property="og:image" content="<?php echo $image; ?>" />
|
||||
<meta property="og:url" content="<?php echo $permalink; ?>" />
|
||||
<meta property="og:image" content="<?php echo $shareimage; ?>" />
|
||||
<meta property="og:site_name" content="<?php echo get_bloginfo(); ?>" />
|
||||
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:title" content="<?php echo $title; ?>">
|
||||
<meta name="twitter:description" content="<?php echo $description ?>">
|
||||
<meta name="twitter:image:src" content="<?php echo $image; ?>">
|
||||
<meta name="twitter:domain" content="<?php echo $url; ?>">
|
||||
<meta name="twitter:image" content="<?php echo $shareimage; ?>">
|
||||
<meta name="twitter:site" content="<?php echo $twitter; ?>">
|
||||
|
||||
<meta itemprop="name" content="<?php echo $title; ?>">
|
||||
<meta itemprop="description" content="<?php echo $description ?>">
|
||||
<meta itemprop="image" content="<?php echo $image; ?>">
|
||||
<meta itemprop="image" content="<?php echo $shareimage; ?>">
|
||||
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="<?php echo WPTHEME_TEMPLATE_URL; ?>/images/ico/apple-touch-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="<?php echo WPTHEME_TEMPLATE_URL; ?>/images/ico/apple-touch-icon-60x60.png">
|
||||
|
Loading…
Reference in New Issue
Block a user