Advertisement
pusatdata

Share FB Image Fullwidth dengan Flexithemes

Mar 19th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. MASUKKAN KE FILE HEADER.PHP
  2. <meta property="og:image" content="<?php $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); echo $feat_image; ?>"/>
  3. <meta property="og:image:secure_url" content="<?php $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); echo $feat_image; ?>" />
  4. <meta property="og:image:width" content="700" />
  5. <meta property="og:image:height" content="700" />
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17. ==============================
  18. DI BAWAH INI TIDAK BERFUNFSI KRN BUKAN KODENYA
  19. ===============
  20.  
  21.  
  22. header.php
  23. ==========
  24. <meta property="og:image" content="<?php bloginfo('og_image_tag'); ?>"/>
  25.  
  26. functions.php
  27. =============
  28. /**
  29. * Outputs an image tag based on whether it's https or not.
  30. *
  31. * @param string $image_url The image URL.
  32. *
  33. * @return void
  34. */
  35. function og_image_tag( $image_url ) {
  36. $this->opengraph->og_tag( 'og:image', esc_url( $image_url ) );
  37.  
  38. // Add secure URL if detected. Not all services implement this, so the regular one also needs to be rendered.
  39. if ( strpos( $image_url, 'https://' ) === 0 ) {
  40. $this->opengraph->og_tag( 'og:image:secure_url', esc_url( $image_url ) );
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement