Skip to content

Instantly share code, notes, and snippets.

@inc2734
Created August 17, 2020 04:55
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 inc2734/9f7a2c2998f546056e1e30c1f150d296 to your computer and use it in GitHub Desktop.
Save inc2734/9f7a2c2998f546056e1e30c1f150d296 to your computer and use it in GitHub Desktop.
Snow Monkey の固定ページにシェアボタンを追加する
add_filter(
'snow_monkey_template_part_render',
function( $html, $slug, $name ) {
if ( 'template-parts/content/entry/content/content' === $slug && 'page' === $name ) {
$share_buttons_display_position = get_option( 'mwt-share-buttons-display-position' );
$share_buttons = get_option( 'mwt-share-buttons-buttons' );
ob_start();
if ( in_array( $share_buttons_display_position, [ 'top', 'both' ] ) && $share_buttons ) {
\Framework\Helper::get_template_part( 'template-parts/content/share-buttons' );
}
echo $html;
if ( in_array( $share_buttons_display_position, [ 'bottom', 'both' ] ) && $share_buttons ) {
\Framework\Helper::get_template_part( 'template-parts/content/share-buttons' );
}
return ob_get_clean();
}
return $html;
},
10,
3
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment