If the “Pin This…” banner is showing up on the first image of your non-recipe posts, add the filter below to your theme's functions.php
file.
***Before doing this, make sure that you have access to your site's files via FTP (the editor in WordPress is not sufficient in case problems arise) and that you are comfortable with editing your functions.php file. Any minor error in the functions.php file can result in the “white screen of death,” which is easily fixed via FTP but is difficult to fix otherwise (and a nuisance as your site will be unavailable until fixed).***
If you aren't comfortable editing your theme's functions.php
file, we recommend reaching out to your developer, as we are not able to make those changes for you.
Are you a Tasty Recipes user? Use this filter.
With this filter, Tasty Pins checks specifically for a Tasty Recipes card in your posts. If a Tasty Recipes card is not found, the Pinterest banner will not appear in the post.
/**
* Only show the 'Pin This' banner when a post has a Tasty Recipe.
*
* @param boolean $should_add_banner Whether or not the banner should be added.
* @param integer $post_id ID for the post.
* @param string $content Post content.
* @return boolean
*/
add_filter(
'tasty_pins_should_add_banner',
function( $should_add_banner, $post_id, $content ) {
// Don't show the banner on posts without Tasty Recipes.
if ( $should_add_banner && false === stripos( $content, 'tasty-recipe' ) ) {
$should_add_banner = false;
}
return $should_add_banner;
},
10,
3
);
Using a different recipe plugin? Use this filter instead.
If your post's schema does not include “recipe
,” Tasty Pins will ignore the post and prevent the Pinterest banner from appearing on your non-recipe posts.
/**
* Only show the 'Pin This' banner when a post has a 'Recipe' category.
*
* @param boolean $should_add_banner Whether or not the banner should be added.
* @param integer $post_id ID for the post.
* @param string $content Post content.
* @return boolean
*/
add_filter(
'tasty_pins_should_add_banner',
function( $should_add_banner, $post_id, $content ) {
// Don't show the banner on posts without a 'Recipe' category.
if ( $should_add_banner && ! has_term( 'Recipe', 'category', $post_id ) ) {
$should_add_banner = false;
}
return $should_add_banner;
},
10,
3
);