Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MASUKKAN KE FILE HEADER.PHP
- <meta property="og:image" content="<?php $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); echo $feat_image; ?>"/>
- <meta property="og:image:secure_url" content="<?php $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); echo $feat_image; ?>" />
- <meta property="og:image:width" content="700" />
- <meta property="og:image:height" content="700" />
- ==============================
- DI BAWAH INI TIDAK BERFUNFSI KRN BUKAN KODENYA
- ===============
- header.php
- ==========
- <meta property="og:image" content="<?php bloginfo('og_image_tag'); ?>"/>
- functions.php
- =============
- /**
- * Outputs an image tag based on whether it's https or not.
- *
- * @param string $image_url The image URL.
- *
- * @return void
- */
- function og_image_tag( $image_url ) {
- $this->opengraph->og_tag( 'og:image', esc_url( $image_url ) );
- // Add secure URL if detected. Not all services implement this, so the regular one also needs to be rendered.
- if ( strpos( $image_url, 'https://' ) === 0 ) {
- $this->opengraph->og_tag( 'og:image:secure_url', esc_url( $image_url ) );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement