承接 clubdeuce/wp-share-this 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

clubdeuce/wp-share-this

最新稳定版本:0.0.6

Composer 安装命令:

composer require clubdeuce/wp-share-this

包简介

An Share This library for WordPress.

README 文档

README

Scrutinizer Code Quality

WP Share-This

This library allows for easy implementation of sharing links using the ShareThis. Please note, this library is in no way affiliated with ShareThis or its subsidiaries.

Installation

The easiest method for including this library is via Composer. Simply run the follow command in your project root (assuming that is where your composer.json is located):

composer require clubdeuce/wp-share-this

This library will be autoloaded, assuming you include vendor/autoload.php in your project.

You can also download this library and include it manually.

Usage

  • Register service(s): WP_Share_This::register_service( 'twitter' ). The full list of supported services can be found here.
  • Initialize the library: WP_Share_This::initialize().
  • Render the links: WP_Share_This::the_sharing_links().

Methods

Method Description Since
register_id( string $share_this_id ) Specify the ShareThis user id for tracking 0.0.1
register_service( string $service_name, array $params ) Specify a service to be included. You can pass parameters specific to this service (see below for a list of parameters). 0.0.1
the_sharing_links( null/array $params ) Output the sharing links. You can pass parameters specific to this block of links (see below for a list of parameters). 0.0.1
use_og( bool $use ) Specify whether to include the OpenGraph information in the <head> of the document. Default: true. 0.0.2

Parameters

The following parameters can be specified for the sharing links on a per-service basis (not all items apply to every service):

Name Description
url Specifies URL (can be shortened URL) that you would like shared. Default: current global $post permalink.
short_url Specifies a shortened URL that can be used in conjunction with the data-url. Default: null
title Specifies title that you would like shared. Defaults to current global $post title.
image Specifies link to image you would like displayed in the shared content. Default: current global $post featured image if present.
description Specifies summary text/description you wish to share. Default: current global $post excerpt.
username Specifies your Twitter username.
message Specifies the body copy of e-mail shares. Default: current global $post excerpt.
share_count Specify whether to include the share count for this individual link item. Default: true.

Examples:

To register services with unique parameters:

WP_Share_This::register_service( 'twitter', array(
    'username'    => 'myTwitterHandle',
    'share_count' => false,
) );

WP_Share_This::register_service( 'facebook', array(
    'image' => 'https://example.com/image.png',
);

WP_Share_This::register_service( 'email', array(
    'message' => __( 'Look at this really interesting article I found!', 'txt_domain' ),
) );  

To render the links with overrides to the defaults:

WP_Share_This::the_sharing_links( array(
    'share_count' => false,
) );

To render sharing links for a post other than the current global $post item:

WP_Share_This::the_sharing_links( array(
    'post' => get_post( $post_id ),
) );

Filters

This library exposes a number of filters:

Filter Description Parameters Since
wpst_link_classes_$service This filter allows you to specify classes for each service link, _e.g. add_filter( 'wpst_classes_twitter', 'my_function' ) array classnames 0.0.1
wpst_og_url Allows you to filter the URL exposed via OpenGraph string URL 0.0.1
wpst_og_title Allows you to filter the title exposed via OpenGraph string title 0.0.1
wpst_og_description Allows you to filter the description exposed via OpenGraph string description 0.0.1
wpst_og_image Allows you to filter the image exposed via OpenGraph string image URL 0.0.1
wpst_link_text Allows you to filter the text displayed for the sharing link (defaults to the service name) string text 0.0.1

统计信息

  • 总下载量: 2.45k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2019-12-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固