\Jetpack_Likes

Module Name: Likes Module Description: Likes are a way for people to show their appreciation for content you have written. It’s also a way for you to show the world how popular your content has become.

First Introduced: 2.2 Sort Order: 4 Requires Connection: Yes Auto Activate: No Module Tags: Social

Summary

Methods
Properties
Constants
init()
__construct()
module_toggle()
configuration_redirect()
load_jp_css()
configuration_target_area()
add_likes_to_sharing_meta_box_title()
add_meta_box()
meta_box_save()
meta_box_content()
sharing_meta_box_content()
admin_discussion_likes_settings_init()
admin_discussion_likes_settings_section()
admin_likes_get_option()
admin_discussion_likes_settings_field()
admin_discussion_likes_settings_validate()
admin_settings_init()
admin_settings_showbuttonon_init()
admin_settings_showbuttonon_callback()
process_update_requests_if_sharedaddy_not_loaded()
admin_settings_callback()
sharing_menu()
sharing_page()
updated_message()
sharing_block()
admin_init()
action_init()
load_admin_css()
enqueue_admin_scripts()
likes_edit_column()
add_like_count_column()
post_likes()
comment_likes()
post_flair_service_enabled_like()
admin_bar_likes()
likes_master()
get_options()
is_likes_visible()
is_enabled_sitewide()
is_comments_enabled()
is_admin_bar_button_visible()
is_post_likeable()
is_index_enabled()
is_single_post_enabled()
is_single_page_enabled()
is_attachment_enabled()
$version
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$version

$version

Methods

init()

init()

__construct()

__construct()

module_toggle()

module_toggle()

configuration_redirect()

configuration_redirect()

Redirects to the likes section of the sharing page.

load_jp_css()

load_jp_css()

Loads Jetpack's CSS on the sharing page so we can use .jetpack-targetable

configuration_target_area()

configuration_target_area(string $html) : string

Adds in the jetpack-targetable class so when we visit sharing#likes our like settings get highlighted by a yellow box

Parameters

string $html

row heading for the sharedaddy "which page" setting

Returns

string —

html with the jetpack-targetable class and likes id. tbody gets closed after the like settings

add_likes_to_sharing_meta_box_title()

add_likes_to_sharing_meta_box_title(string $title)

Replaces the "Sharing" title for the post screen metabox with "Likes and Shares"

Parameters

string $title

The current title of the metabox, not needed/used.

add_meta_box()

add_meta_box()

Adds a metabox to the post screen if the sharing one doesn't currently exist.

meta_box_save()

meta_box_save( $post_id)

Parameters

$post_id

meta_box_content()

meta_box_content( $post)

Shows the likes option in the post screen metabox.

Parameters

$post

sharing_meta_box_content()

sharing_meta_box_content( $post)

WordPress.com: Metabox option for sharing (sharedaddy will handle this on the JP blog)

Parameters

$post

admin_discussion_likes_settings_init()

admin_discussion_likes_settings_init()

Options to be added to the discussion page (see also admin_settings_init, etc below for Sharing settings page)

admin_discussion_likes_settings_section()

admin_discussion_likes_settings_section()

admin_likes_get_option()

admin_likes_get_option( $option)

Parameters

$option

admin_discussion_likes_settings_field()

admin_discussion_likes_settings_field()

admin_discussion_likes_settings_validate()

admin_discussion_likes_settings_validate( $input)

Parameters

$input

admin_settings_init()

admin_settings_init()

The actual options block to be inserted into the sharing page.

admin_settings_showbuttonon_init()

admin_settings_showbuttonon_init()

If sharedaddy is not loaded, we don't have the "Show buttons on" yet, so we need to add that since it affects likes too.

admin_settings_showbuttonon_callback()

admin_settings_showbuttonon_callback()

If sharedaddy is not loaded, we still need to save the the settings of the "Show buttons on" option.

process_update_requests_if_sharedaddy_not_loaded()

process_update_requests_if_sharedaddy_not_loaded()

Adds the admin update hook so we can save settings even if Sharedaddy is not enabled.

admin_settings_callback()

admin_settings_callback()

Saves the setting in the database, bumps a stat on WordPress.com

sharing_menu()

sharing_menu()

Adds the 'sharing' menu to the settings menu.

Only ran if sharedaddy and publicize are not already active.

sharing_page()

sharing_page()

Provides a sharing page with the sharing_global_options hook so we can display the setting.

Only ran if sharedaddy and publicize are not already active.

updated_message()

updated_message()

Returns the settings have been saved message.

sharing_block()

sharing_block()

Returns just the "sharing buttons" w/ like option block, so it can be inserted into different sharing page contexts

admin_init()

admin_init()

action_init()

action_init()

load_admin_css()

load_admin_css()

Load the CSS needed for the wp-admin area.

enqueue_admin_scripts()

enqueue_admin_scripts()

Load the JS required for loading the like counts.

likes_edit_column()

likes_edit_column(string $column_name, int $post_id)

Add "Likes" column data to the post edit table in wp-admin.

Parameters

string $column_name
int $post_id

add_like_count_column()

add_like_count_column(array $columns) : array

Add a "Likes" column header to the post edit table in wp-admin.

Parameters

array $columns

Returns

array

post_likes()

post_likes( $content)

Parameters

$content

comment_likes()

comment_likes( $content,  $comment)

Parameters

$content
$comment

post_flair_service_enabled_like()

post_flair_service_enabled_like( $classes)

Parameters

$classes

admin_bar_likes()

admin_bar_likes()

likes_master()

likes_master()

get_options()

get_options() : array

Get the 'disabled_likes' option from the DB of the current blog.

Returns

array

is_likes_visible()

is_likes_visible()

Are likes visible in this context?

Some of this code was taken and modified from sharing_display() to ensure similar logic and filters apply here, too.

is_enabled_sitewide()

is_enabled_sitewide() : boolean

Returns the current state of the "WordPress.com Likes are" option.

Returns

boolean —

true if enabled sitewide, false if not

is_comments_enabled()

is_comments_enabled() : boolean

Returns if comment likes are enabled. Defaults to 'on'

Returns

boolean —

true if we should show comment likes, false if not

is_admin_bar_button_visible()

is_admin_bar_button_visible()

is_post_likeable()

is_post_likeable(int $post_id)

Are likes enabled for this post?

Parameters

int $post_id

is_index_enabled()

is_index_enabled() : bool

Are Post Likes enabled on archive/front/search pages?

Returns

bool

is_single_post_enabled()

is_single_post_enabled() : bool

Are Post Likes enabled on single posts?

Returns

bool

is_single_page_enabled()

is_single_page_enabled() : bool

Are Post Likes enabled on single pages?

Returns

bool

is_attachment_enabled()

is_attachment_enabled() : bool

Are Media Likes enabled on single pages?

Returns

bool