SHARE
TWEET

Untitled

a guest Nov 17th, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. // Twitter Title.
  4. add_filter( 'socialsnap_twitter_card_title', 'custom_socialsnap_twitter_card_title', 10, 2 );
  5. function custom_socialsnap_twitter_card_title( $title, $post_id ) {
  6.    
  7.     if ( 99 === $post_id && isset( $_POST['ls'] ) && 'xxx' === $_POST['ls'] ) {
  8.         return 'This is a twitter title for page with ID 99 and ‘xxx’ as ‘ls’ parameter';
  9.     }
  10.  
  11.     return $title;
  12. }
  13.  
  14. // Twitter Description.
  15. add_filter( 'socialsnap_twitter_card_description', 'custom_socialsnap_twitter_card_description', 10, 2 );
  16. function socialsnap_twitter_card_description( $description, $post_id ) {
  17.    
  18.     if ( 99 === $post_id && isset( $_POST['ls'] ) && 'xxx' === $_POST['ls'] ) {
  19.         return 'This is a twitter description for page with ID 99 and ‘xxx’ as ‘ls’ parameter';
  20.     }
  21.  
  22.     return $description;
  23. }
  24.  
  25. // Twitter Image.
  26. add_filter( 'socialsnap_twitter_card_image', 'custom_socialsnap_twitter_card_image', 10, 2 );
  27. function custom_socialsnap_twitter_card_image( $image, $post_id ) {
  28.    
  29.     if ( 99 === $post_id && isset( $_POST['ls'] ) && 'xxx' === $_POST['ls'] ) {
  30.         $image = wp_get_attachment_image_src( IMAGE_ID, 'full' ); // Replace IMAGE_ID with image id.
  31.         return $image; // This is a twitter image for page with ID 99 and ‘xxx’ as ‘ls’ parameter';
  32.     }
  33.  
  34.     return $image;
  35. }
  36.  
  37. // Facebook/OG Title.
  38. add_filter( 'socialsnap_og_title', 'custom_socialsnap_og_title', 10, 2 );
  39. function custom_socialsnap_og_title( $title, $post_id ) {
  40.    
  41.     if ( 99 === $post_id && isset( $_POST['ls'] ) && 'xxx' === $_POST['ls'] ) {
  42.         return 'This is an OG title for page with ID 99 and ‘xxx’ as ‘ls’ parameter';
  43.     }
  44.  
  45.     return $title;
  46. }
  47.  
  48. // Facebook/OG Description.
  49. add_filter( 'socialsnap_og_description', 'custom_socialsnap_og_description', 10, 2 );
  50. function custom_socialsnap_og_description( $description, $post_id ) {
  51.    
  52.     if ( 99 === $post_id && isset( $_POST['ls'] ) && 'xxx' === $_POST['ls'] ) {
  53.         return 'This is an OG description for page with ID 99 and ‘xxx’ as ‘ls’ parameter';
  54.     }
  55.  
  56.     return $description;
  57. }
  58.  
  59. // Facebook/OG Image.
  60. add_filter( 'socialsnap_og_image', 'custom_socialsnap_og_image', 10, 2 );
  61. function custom_socialsnap_og_image( $image, $post_id ) {
  62.    
  63.     if ( 99 === $post_id && isset( $_POST['ls'] ) && 'xxx' === $_POST['ls'] ) {
  64.         $image = wp_get_attachment_image_src( IMAGE_ID, 'full' ); // Replace IMAGE_ID with image id.
  65.         return $image; // This is an OG image for page with ID 99 and ‘xxx’ as ‘ls’ parameter';
  66.     }
  67.  
  68.     return $image;
  69. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top