Skip to content

Instantly share code, notes, and snippets.

@graylaurenm
Last active March 30, 2017 20:20
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 graylaurenm/e188f783b6f1ff34906c34eb2c654359 to your computer and use it in GitHub Desktop.
Save graylaurenm/e188f783b6f1ff34906c34eb2c654359 to your computer and use it in GitHub Desktop.
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