Skip to content

Instantly share code, notes, and snippets.

@graylaurenm

graylaurenm/functions.php

Last active Mar 30, 2017
Embed
What would you like to do?
Automatically Add WP Recipe Maker "Jump" And "Print" Buttons to ALL Posts http://oncecoupled.com/2016/09/auto-jump-print-buttons-wprm/
<?php // Do NOT copy this line. :)
/**
* Automatically insert WPRM buttons
*
* @author Lauren Gray, Once Coupled
* @link https://oncecoupled.com
*/
add_action('genesis_entry_content', 'oncecoupled_wprm_buttons', 1);
function oncecoupled_wprm_buttons() {
if ( is_single() && ( shortcode_exists( 'wprm-recipe-jump' ) || shortcode_exists( 'wprm-recipe-print' ) ) ) {
echo '<div class="wprm-buttons">';
if ( shortcode_exists( 'wprm-recipe-jump' ) ) {
echo do_shortcode( '[wprm-recipe-jump]' );
}
if ( shortcode_exists( 'wprm-recipe-print' ) ) {
echo do_shortcode( '[wprm-recipe-print]' );
}
echo '</div>';
}
}
/* Starter Styling for WPRM Buttons – Once Coupled */
.wprm-buttons {
text-align: center;
}
.wprm-buttons a {
display: inline-block;
background: #000;
color: #fff;
padding: 10px 20px;
margin: 0 10px 20px;
}
.wprm-buttons a:hover {
background: #555;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment