Cannot get Rich Links to work
-
Hi there
I’ve tried inserting some very simple <meta property> tags in order to get rich previews (ie on social media sites), and although they appear correctly on RichPreview.org , no actual social media services are picking them up.
Facebook’s crawler says there’s no data to scrape at all, so I know it’s not a caching issue on Facebook’s end.
The server-side caching is currently disabled, so that’s not causing a delay.
Below is the code I inserted into my functions.php file.
if(is_single() || is_page()) { if(has_post_thumbnail($post->ID)) { $img_src = wp_get_attachment_image_src(get_post_thumbnail_id( $post->ID ), 'medium'); } else { $img_src = get_stylesheet_directory_uri() . 'wp-content/themes/gonzo/images/no-image-featured-image.png'; } if($excerpt = $post->post_excerpt) { $excerpt = strip_tags($post->post_excerpt); $excerpt = str_replace("", "'", $excerpt); } else { $excerpt = get_bloginfo('description'); } ?> <meta property="og:title" content="<?php echo the_title(); ?>"/> <meta property="og:description" content="Get the latest news and events at the Out of the Blue Drill Hall in Leith."/> <meta property="og:type" content="event"/> <meta property="og:url" content="<?php echo the_permalink(); ?>"/> <meta property="og:image" content="<?php echo $img_src; ?>"/> <meta property="og:site_name" content="<?php echo get_bloginfo(); ?>"/>
Thanks in advance!
- This topic was modified 7 years, 6 months ago by . Reason: Removed duplicate link
- This topic was modified 7 years, 6 months ago by . Reason: fixed code format
The page I need help with: [log in to see the link]
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Cannot get Rich Links to work’ is closed to new replies.