开发者 | NoseGraze |
---|---|
更新时间 | 2020年10月25日 18:11 |
捐献地址: | 去捐款 |
PHP版本: | 3.0 及以上 |
WordPress版本: | 5.5.2 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
<?php naked_social_share_buttons(); ?>
naked-social-share
to the /wp-content/plugins/
directory<?php naked_social_share_buttons(); ?>
Open up your theme file (for example, single.php
) and place this code exactly where you want the icons to appear: <?php naked_social_share_buttons(); ?>
The share counters are cached for 3 hours to improve loading times and to avoid making API calls on every single page load.
If you opt to display share counts, then the plugin uses third party APIs to get that information. However, these calls are made via ajax after the page is loaded, so you won't notice any impact on loading time. Here's how the process works:
You can add a new site using filters and actions from the plugin. Here's an example showing how to create an add-on plugin to add 'Email' as a social site option: https://gist.github.com/nosegraze/73e950885fdbbecb20fe
You can do this by creating a new add-on plugin and using the Naked Social Share filters. Here's an example for changing the Twitter icon:
function nss_addon_twitter_icon( $icon_html ) { return '<i class="fa fa-twitter-square"></i>'; } add_filter( 'naked_social_share_twitter_icon', 'nss_addon_twitter_icon' );
For more details, see this page: https://gist.github.com/nosegraze/f00b5101466752213e2d
Naked_Social_Share_Buttons::$url
property for all post/page URLs.page
post type.get_title()
method.:before
and reset some padding.array_key_exists
checks around the display code to hopefully avoid some errors from popping up.li
tag in case you want to style them differently.urlencode
functions with esc_url_raw
, as urlencode was preventing the social share requests from working properly.