Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/jetpack/modules/theme-to...
File: content-options.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Jetpack Compatibility File
[2] Fix | Delete
* See: https://jetpack.com/
[3] Fix | Delete
*
[4] Fix | Delete
* @package automattic/jetpack
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[8] Fix | Delete
exit( 0 );
[9] Fix | Delete
}
[10] Fix | Delete
[11] Fix | Delete
if ( ! class_exists( '\Automattic\Jetpack\Classic_Theme_Helper\Main' ) ) {
[12] Fix | Delete
[13] Fix | Delete
/**
[14] Fix | Delete
* Content Options.
[15] Fix | Delete
*
[16] Fix | Delete
* This feature will only be activated for themes that declare their support.
[17] Fix | Delete
* This can be done by adding code similar to the following during the
[18] Fix | Delete
* 'after_setup_theme' action:
[19] Fix | Delete
*
[20] Fix | Delete
add_theme_support( 'jetpack-content-options', array(
[21] Fix | Delete
'blog-display' => 'content', // the default setting of the theme: 'content', 'excerpt' or array( 'content', 'excerpt' ) for themes mixing both display.
[22] Fix | Delete
'author-bio' => true, // display or not the author bio: true or false.
[23] Fix | Delete
'author-bio-default' => false, // the default setting of the author bio, if it's being displayed or not: true or false (only required if false).
[24] Fix | Delete
'avatar-default' => true, // display or not the default avatar for the author bio: true or false.
[25] Fix | Delete
'masonry' => '.site-main', // a CSS selector matching the elements that triggers a masonry refresh if the theme is using a masonry layout.
[26] Fix | Delete
'post-details' => array(
[27] Fix | Delete
'stylesheet' => 'themeslug-style', // name of the theme's stylesheet.
[28] Fix | Delete
'date' => '.posted-on', // a CSS selector matching the elements that display the post date.
[29] Fix | Delete
'categories' => '.cat-links', // a CSS selector matching the elements that display the post categories.
[30] Fix | Delete
'tags' => '.tags-links', // a CSS selector matching the elements that display the post tags.
[31] Fix | Delete
'author' => '.byline', // a CSS selector matching the elements that display the post author.
[32] Fix | Delete
'comment' => '.comments-link', // a CSS selector matching the elements that display the comment link.
[33] Fix | Delete
),
[34] Fix | Delete
'featured-images' => array(
[35] Fix | Delete
'archive' => true, // enable or not the featured image check for archive pages: true or false.
[36] Fix | Delete
'archive-default' => false, // the default setting of the featured image on archive pages, if it's being displayed or not: true or false (only required if false).
[37] Fix | Delete
'post' => true, // enable or not the featured image check for single posts: true or false.
[38] Fix | Delete
'post-default' => false, // the default setting of the featured image on single posts, if it's being displayed or not: true or false (only required if false).
[39] Fix | Delete
'page' => true, // enable or not the featured image check for single pages: true or false.
[40] Fix | Delete
'page-default' => false, // the default setting of the featured image on single pages, if it's being displayed or not: true or false (only required if false).
[41] Fix | Delete
'portfolio' => true, // enable or not the featured image check for single projects: true or false.
[42] Fix | Delete
'portfolio-default' => false, // the default setting of the featured image on single projects, if it's being displayed or not: true or false (only required if false).
[43] Fix | Delete
'fallback' => true, // enable or not the featured image fallback: true or false.
[44] Fix | Delete
'fallback-default' => true, // the default setting for featured image fallbacks: true or false (only required if false)
[45] Fix | Delete
),
[46] Fix | Delete
) );
[47] Fix | Delete
*/
[48] Fix | Delete
[49] Fix | Delete
if ( ! function_exists( 'jetpack_content_options_init' ) ) {
[50] Fix | Delete
[51] Fix | Delete
/**
[52] Fix | Delete
* Activate the Content Options plugin.
[53] Fix | Delete
*
[54] Fix | Delete
* @deprecated 13.9 Moved to Classic Theme Helper package.
[55] Fix | Delete
* @uses current_theme_supports()
[56] Fix | Delete
*/
[57] Fix | Delete
function jetpack_content_options_init() {
[58] Fix | Delete
_deprecated_function( __FUNCTION__, 'jetpack-13.9' );
[59] Fix | Delete
// If the theme doesn't support 'jetpack-content-options', don't continue.
[60] Fix | Delete
if ( ! current_theme_supports( 'jetpack-content-options' ) ) {
[61] Fix | Delete
return;
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
// Load the Customizer options.
[65] Fix | Delete
require __DIR__ . '/content-options/customizer.php';
[66] Fix | Delete
[67] Fix | Delete
// Load Blog Display function.
[68] Fix | Delete
require __DIR__ . '/content-options/blog-display.php';
[69] Fix | Delete
[70] Fix | Delete
// Load Author Bio function.
[71] Fix | Delete
require __DIR__ . '/content-options/author-bio.php';
[72] Fix | Delete
[73] Fix | Delete
// Load Post Details function.
[74] Fix | Delete
require __DIR__ . '/content-options/post-details.php';
[75] Fix | Delete
[76] Fix | Delete
// Load Featured Images function.
[77] Fix | Delete
if ( jetpack_featured_images_should_load() ) {
[78] Fix | Delete
require __DIR__ . '/content-options/featured-images.php';
[79] Fix | Delete
}
[80] Fix | Delete
[81] Fix | Delete
// Load Featured Images Fallback function.
[82] Fix | Delete
if ( jetpack_featured_images_fallback_should_load() ) {
[83] Fix | Delete
require __DIR__ . '/content-options/featured-images-fallback.php';
[84] Fix | Delete
}
[85] Fix | Delete
}
[86] Fix | Delete
add_action( 'init', 'jetpack_content_options_init' );
[87] Fix | Delete
[88] Fix | Delete
}
[89] Fix | Delete
[90] Fix | Delete
if ( ! function_exists( 'jetpack_featured_images_get_settings' ) ) {
[91] Fix | Delete
[92] Fix | Delete
/**
[93] Fix | Delete
* Get featured images settings using the jetpack-content-options theme support.
[94] Fix | Delete
*
[95] Fix | Delete
* @deprecated 13.9 Moved to Classic Theme Helper package.
[96] Fix | Delete
*/
[97] Fix | Delete
function jetpack_featured_images_get_settings() {
[98] Fix | Delete
_deprecated_function( __FUNCTION__, 'jetpack-13.9' );
[99] Fix | Delete
$options = get_theme_support( 'jetpack-content-options' );
[100] Fix | Delete
[101] Fix | Delete
$featured_images = ( ! empty( $options[0]['featured-images'] ) ) ? $options[0]['featured-images'] : null;
[102] Fix | Delete
[103] Fix | Delete
$settings = array(
[104] Fix | Delete
'archive' => ( ! empty( $featured_images['archive'] ) ) ? $featured_images['archive'] : null,
[105] Fix | Delete
'post' => ( ! empty( $featured_images['post'] ) ) ? $featured_images['post'] : null,
[106] Fix | Delete
'page' => ( ! empty( $featured_images['page'] ) ) ? $featured_images['page'] : null,
[107] Fix | Delete
'portfolio' => ( ! empty( $featured_images['portfolio'] ) ) ? $featured_images['portfolio'] : null,
[108] Fix | Delete
'archive-default' => ( isset( $featured_images['archive-default'] ) && false === $featured_images['archive-default'] ) ? '' : 1,
[109] Fix | Delete
'post-default' => ( isset( $featured_images['post-default'] ) && false === $featured_images['post-default'] ) ? '' : 1,
[110] Fix | Delete
'page-default' => ( isset( $featured_images['page-default'] ) && false === $featured_images['page-default'] ) ? '' : 1,
[111] Fix | Delete
'portfolio-default' => ( isset( $featured_images['portfolio-default'] ) && false === $featured_images['portfolio-default'] ) ? '' : 1,
[112] Fix | Delete
'fallback' => ( ! empty( $featured_images['fallback'] ) ) ? $featured_images['fallback'] : null,
[113] Fix | Delete
'fallback-default' => ( isset( $featured_images['fallback-default'] ) && false === $featured_images['fallback-default'] ) ? '' : 1,
[114] Fix | Delete
);
[115] Fix | Delete
[116] Fix | Delete
$settings = array_merge(
[117] Fix | Delete
$settings,
[118] Fix | Delete
array(
[119] Fix | Delete
'archive-option' => get_option( 'jetpack_content_featured_images_archive', $settings['archive-default'] ),
[120] Fix | Delete
'post-option' => get_option( 'jetpack_content_featured_images_post', $settings['post-default'] ),
[121] Fix | Delete
'page-option' => get_option( 'jetpack_content_featured_images_page', $settings['page-default'] ),
[122] Fix | Delete
'portfolio-option' => get_option( 'jetpack_content_featured_images_portfolio', $settings['portfolio-default'] ),
[123] Fix | Delete
'fallback-option' => get_option( 'jetpack_content_featured_images_fallback', $settings['fallback-default'] ),
[124] Fix | Delete
)
[125] Fix | Delete
);
[126] Fix | Delete
[127] Fix | Delete
return $settings;
[128] Fix | Delete
}
[129] Fix | Delete
[130] Fix | Delete
}
[131] Fix | Delete
[132] Fix | Delete
if ( ! function_exists( 'jetpack_featured_images_should_load' ) ) {
[133] Fix | Delete
[134] Fix | Delete
/**
[135] Fix | Delete
* Determine if the Jetpack Featured Images should be load.
[136] Fix | Delete
*
[137] Fix | Delete
* @deprecated 13.9 Moved to Classic Theme Helper package.
[138] Fix | Delete
*/
[139] Fix | Delete
function jetpack_featured_images_should_load() {
[140] Fix | Delete
_deprecated_function( __FUNCTION__, 'jetpack-13.9' );
[141] Fix | Delete
// If the theme doesn't support post thumbnails, don't continue.
[142] Fix | Delete
if ( ! current_theme_supports( 'post-thumbnails' ) ) {
[143] Fix | Delete
return false;
[144] Fix | Delete
}
[145] Fix | Delete
[146] Fix | Delete
$opts = jetpack_featured_images_get_settings();
[147] Fix | Delete
[148] Fix | Delete
// If the theme doesn't support archive, post and page or if all the options are ticked and we aren't in the customizer, don't continue.
[149] Fix | Delete
if (
[150] Fix | Delete
( true !== $opts['archive'] && true !== $opts['post'] && true !== $opts['page'] )
[151] Fix | Delete
|| ( 1 === $opts['archive-option'] && 1 === $opts['post-option'] && 1 === $opts['page-option'] && ! is_customize_preview() )
[152] Fix | Delete
) {
[153] Fix | Delete
return false;
[154] Fix | Delete
}
[155] Fix | Delete
[156] Fix | Delete
return true;
[157] Fix | Delete
}
[158] Fix | Delete
[159] Fix | Delete
}
[160] Fix | Delete
[161] Fix | Delete
if ( ! function_exists( 'jetpack_featured_images_fallback_should_load' ) ) {
[162] Fix | Delete
[163] Fix | Delete
/**
[164] Fix | Delete
* Determine if the Jetpack Featured Images fallback should load.
[165] Fix | Delete
*
[166] Fix | Delete
* @deprecated 13.9 Moved to Classic Theme Helper package.
[167] Fix | Delete
*/
[168] Fix | Delete
function jetpack_featured_images_fallback_should_load() {
[169] Fix | Delete
_deprecated_function( __FUNCTION__, 'jetpack-13.9' );
[170] Fix | Delete
// If the theme doesn't support post thumbnails, don't continue.
[171] Fix | Delete
if ( ! current_theme_supports( 'post-thumbnails' ) ) {
[172] Fix | Delete
return false;
[173] Fix | Delete
}
[174] Fix | Delete
[175] Fix | Delete
$opts = jetpack_featured_images_get_settings();
[176] Fix | Delete
[177] Fix | Delete
// If the theme doesn't support fallback, don't continue.
[178] Fix | Delete
if ( true !== $opts['fallback'] ) {
[179] Fix | Delete
return false;
[180] Fix | Delete
}
[181] Fix | Delete
[182] Fix | Delete
return true;
[183] Fix | Delete
}
[184] Fix | Delete
[185] Fix | Delete
}
[186] Fix | Delete
}
[187] Fix | Delete
[188] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function