Created
August 17, 2020 04:55
-
-
Save inc2734/9f7a2c2998f546056e1e30c1f150d296 to your computer and use it in GitHub Desktop.
Snow Monkey の固定ページにシェアボタンを追加する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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