Skip to content

Instantly share code, notes, and snippets.

@cookbookplugin
Last active May 16, 2018 06:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cookbookplugin/5cc81adb8f4ccecf35e1a582d1ecaa87 to your computer and use it in GitHub Desktop.
Save cookbookplugin/5cc81adb8f4ccecf35e1a582d1ecaa87 to your computer and use it in GitHub Desktop.
Add Instagram Info to Recipe Card
<?php
//* Do NOT include the opening php tag
add_action( 'cookbook_recipe_after', 'cookbook_recipe_instagram', 10 );
/**
* Display the Instagram Information.
*/
function cookbook_recipe_instagram() {
echo '<div ' . cookbook_get_attr( $recipe, 'instagram' ) . '>';
echo '<i class="fa fa-instagram fa-5x fa-pull-left"></i>';
echo '<h4>Did you make a recipe?</h4>';
echo '<p>Tag <a href="http://instagram.com/cookbookplugin" target="_blank">@cookbookplugin</a> on Instagram and hashtag it <strong>#cookwithcookbook</strong>.</p>';
echo '</div>';
}
.cookbook-instagram {
background: #333;
color: #fff;
margin: -20px auto 0;
padding: 20px;
}
.cookbook-instagram h4 {
color: #fff;
margin: 3px 0 5px;
}
.cookbook-instagram a {
color: #fff;
text-decoration: underline;
}
.cookbook-instagram a:focus,
.cookbook-instagram a:hover {
color: #55585a;
}
.cookbook-instagram p {
margin-bottom: 0;
}
@media screen and (min-width: 500px) {
.cookbook-instagram {
margin: -20 auto 0;
padding: 30px;
}
}
@joshuadavidnelson
Copy link

I was getting an error with the cookbook_recipe_instagram function, it looks like it's missing the $recipe parameter:

function cookbook_recipe_instagram( $recipe ) {
	echo '<div ' . cookbook_get_attr( $recipe, 'instagram' ) . '>';
		echo '<i class="fa fa-instagram fa-5x fa-pull-left"></i>';
		echo '<h4>Did you make a recipe?</h4>';
		echo '<p>Tag <a href="http://instagram.com/cookbookplugin" target="_blank">@cookbookplugin</a> on Instagram and hashtag it <strong>#cookwithcookbook</strong>.</p>';
	echo '</div>';
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment