summaryrefslogtreecommitdiff
blob: 2881790b00c097ee0d8a01e96b5007da03eea5a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
 * Jetpack Compatibility File
 * See: http://jetpack.com/
 */

function twentysixteen_jetpack_setup() {
	/**
	 * Add theme support for Responsive Videos.
	 */
	add_theme_support( 'jetpack-responsive-videos' );
}
add_action( 'after_setup_theme', 'twentysixteen_jetpack_setup' );

function twentysixteen_init_jetpack() {
	/**
	 * Add our compat CSS file for custom widget stylings and such.
	 * Set the version equal to filemtime for development builds, and the JETPACK__VERSION for production
	 * or skip it entirely for wpcom.
	 */
	$version = false;
	if ( method_exists( 'Jetpack', 'is_development_version' ) ) {
		$version = Jetpack::is_development_version() ? filemtime( plugin_dir_path( __FILE__ ) . 'twentysixteen.css' ) : JETPACK__VERSION;
	}
	wp_enqueue_style( 'twentysixteen-jetpack', plugins_url( 'twentysixteen.css', __FILE__ ), array(), $version );
	wp_style_add_data( 'twentysixteen-jetpack', 'rtl', 'replace' );
}
add_action( 'init', 'twentysixteen_init_jetpack' );

/**
 * Alter gallery widget default width.
 */
function twentysixteen_gallery_widget_content_width( $width ) {
	return 390;
}
add_filter( 'gallery_widget_content_width', 'twentysixteen_gallery_widget_content_width' );

/**
 * Remove ratings from excerpts that are used as intro on blog index, single, and archive pages.
 */
function twentysixteen_remove_share() {
	if ( is_single() || is_archive() || is_home() ) {
	    remove_filter( 'the_excerpt', 'sharing_display', 19 );
	    if ( class_exists( 'Jetpack_Likes' ) ) {
	        remove_filter( 'the_excerpt', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 );
	    }
	}
}
add_action( 'loop_start', 'twentysixteen_remove_share' );