Created
September 1, 2020 08:56
-
-
Save mahfuj156/c4b49feb8725fa0e3e6e7568c4c4ba89 to your computer and use it in GitHub Desktop.
How to create a dynamic Open Graph (OG) image for your website by WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-thumbnail' ); ?> | |
<meta property="og:title" content="<?php the_title(); ?>" /> | |
<meta property="og:description" content="" /> | |
<meta property="og:image" content="<?php echo $image[0]; ?>" /> | |
<meta property="og:video" content="" /> | |
<meta property="og:video:width" content="560" /> | |
<meta property="og:video:height" content="340" /> | |
<meta property="og:video:type" content="application/x-shockwave-flash" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment