Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Twitter Title.
- add_filter( 'socialsnap_twitter_card_title', 'custom_socialsnap_twitter_card_title', 10, 2 );
- function custom_socialsnap_twitter_card_title( $title, $post_id ) {
- if ( 99 === $post_id && isset( $_POST['ls'] ) && 'xxx' === $_POST['ls'] ) {
- return 'This is a twitter title for page with ID 99 and ‘xxx’ as ‘ls’ parameter';
- }
- return $title;
- }
- // Twitter Description.
- add_filter( 'socialsnap_twitter_card_description', 'custom_socialsnap_twitter_card_description', 10, 2 );
- function custom_socialsnap_twitter_card_description( $description, $post_id ) {
- if ( 99 === $post_id && isset( $_POST['ls'] ) && 'xxx' === $_POST['ls'] ) {
- return 'This is a twitter description for page with ID 99 and ‘xxx’ as ‘ls’ parameter';
- }
- return $description;
- }
- // Twitter Image.
- add_filter( 'socialsnap_twitter_card_image', 'custom_socialsnap_twitter_card_image', 10, 2 );
- function custom_socialsnap_twitter_card_image( $image, $post_id ) {
- if ( 99 === $post_id && isset( $_POST['ls'] ) && 'xxx' === $_POST['ls'] ) {
- $image = wp_get_attachment_image_src( IMAGE_ID, 'full' ); // Replace IMAGE_ID with image id.
- return $image; // This is a twitter image for page with ID 99 and ‘xxx’ as ‘ls’ parameter';
- }
- return $image;
- }
- // Facebook/OG Title.
- add_filter( 'socialsnap_og_title', 'custom_socialsnap_og_title', 10, 2 );
- function custom_socialsnap_og_title( $title, $post_id ) {
- if ( 99 === $post_id && isset( $_POST['ls'] ) && 'xxx' === $_POST['ls'] ) {
- return 'This is an OG title for page with ID 99 and ‘xxx’ as ‘ls’ parameter';
- }
- return $title;
- }
- // Facebook/OG Description.
- add_filter( 'socialsnap_og_description', 'custom_socialsnap_og_description', 10, 2 );
- function custom_socialsnap_og_description( $description, $post_id ) {
- if ( 99 === $post_id && isset( $_POST['ls'] ) && 'xxx' === $_POST['ls'] ) {
- return 'This is an OG description for page with ID 99 and ‘xxx’ as ‘ls’ parameter';
- }
- return $description;
- }
- // Facebook/OG Image.
- add_filter( 'socialsnap_og_image', 'custom_socialsnap_og_image', 10, 2 );
- function custom_socialsnap_og_image( $image, $post_id ) {
- if ( 99 === $post_id && isset( $_POST['ls'] ) && 'xxx' === $_POST['ls'] ) {
- $image = wp_get_attachment_image_src( IMAGE_ID, 'full' ); // Replace IMAGE_ID with image id.
- return $image; // This is an OG image for page with ID 99 and ‘xxx’ as ‘ls’ parameter';
- }
- return $image;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement