Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/hide-fea...
File: index.php
<?php
[0] Fix | Delete
/*
[1] Fix | Delete
[2] Fix | Delete
Plugin Name: Hide Featured Image
[3] Fix | Delete
[4] Fix | Delete
Plugin URI: http://shahpranav.com/2015/05/hide-featured-image-on-single-post/
[5] Fix | Delete
[6] Fix | Delete
Description: To show/hide featured images on individual posts.
[7] Fix | Delete
[8] Fix | Delete
Version: 1.3.1
[9] Fix | Delete
[10] Fix | Delete
Author: shahpranaf
[11] Fix | Delete
[12] Fix | Delete
Author URI: http://shahpranav.com/
[13] Fix | Delete
[14] Fix | Delete
License: GPLv2 or later
[15] Fix | Delete
[16] Fix | Delete
*/
[17] Fix | Delete
[18] Fix | Delete
[19] Fix | Delete
// Actions and hooks
[20] Fix | Delete
add_action( 'add_meta_boxes', 'sh_post_types_custom_box' ); // WP 3.0+
[21] Fix | Delete
add_action( 'admin_init', 'sh_post_types_custom_box', 1 ); // backwards compatible
[22] Fix | Delete
add_action( 'save_post', 'sh_post_types_save_postdata' ); /* Do something with the data entered */
[23] Fix | Delete
add_action( 'wp_head', 'sh_featured_image');
[24] Fix | Delete
add_action( 'admin_menu', 'sh_settings_menu' );
[25] Fix | Delete
add_action( 'admin_init', 'sh_hide_register_settings' );
[26] Fix | Delete
add_action( 'init', 'sh_hide_featured_image_init' );
[27] Fix | Delete
[28] Fix | Delete
/**
[29] Fix | Delete
* Adds a box to the main column on the Post and Page edit screens
[30] Fix | Delete
*
[31] Fix | Delete
* @since Hide Featured Image 1.0
[32] Fix | Delete
*/
[33] Fix | Delete
function sh_post_types_custom_box() {
[34] Fix | Delete
[35] Fix | Delete
global $sh_post_types;
[36] Fix | Delete
$sh_post_types = get_post_types( '', 'names' );
[37] Fix | Delete
unset( $sh_post_types['attachment'], $sh_post_types['revision'], $sh_post_types['nav_menu_item'] );
[38] Fix | Delete
[39] Fix | Delete
foreach ($sh_post_types as $post_type) {
[40] Fix | Delete
add_meta_box( 'hide_featured', __( 'Hide Featured Image?', 'hide-featured-image' ), 'sh_featured_box', $post_type, 'side', 'default' );
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
/**
[46] Fix | Delete
* Add metabox to posts.
[47] Fix | Delete
*/
[48] Fix | Delete
function sh_featured_box($post){
[49] Fix | Delete
wp_nonce_field( plugin_basename( __FILE__ ), $post->post_type . '_noncename' );
[50] Fix | Delete
[51] Fix | Delete
$hide_featured = get_post_meta( $post->ID, '_hide_featured', true ); ?>
[52] Fix | Delete
<input type="radio" name="_hide_featured" value="1" <?php checked( $hide_featured, 1 ); ?>><?php _e( 'Yes', 'hide-featured-image' ); ?>&nbsp;&nbsp;
[53] Fix | Delete
<input type="radio" name="_hide_featured" value="2" <?php checked( $hide_featured, 2 ); ?>><?php _e( 'No', 'hide-featured-image' ); ?><?php
[54] Fix | Delete
[55] Fix | Delete
}
[56] Fix | Delete
[57] Fix | Delete
/**
[58] Fix | Delete
* When the post is saved, saves our custom data
[59] Fix | Delete
*
[60] Fix | Delete
* @since Hide Featured Image 1.0
[61] Fix | Delete
*/
[62] Fix | Delete
function sh_post_types_save_postdata( $post_id ) {
[63] Fix | Delete
[64] Fix | Delete
global $sh_post_types;
[65] Fix | Delete
[66] Fix | Delete
// verify if this is an auto save routine.
[67] Fix | Delete
// If it is our form has not been submitted, so we dont want to do anything
[68] Fix | Delete
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
[69] Fix | Delete
return;
[70] Fix | Delete
[71] Fix | Delete
// verify this came from the our screen and with proper authorization,
[72] Fix | Delete
// because save_post can be triggered at other times
[73] Fix | Delete
[74] Fix | Delete
if ( !wp_verify_nonce( @$_POST[$_POST['post_type'] . '_noncename'], plugin_basename( __FILE__ ) ) )
[75] Fix | Delete
return;
[76] Fix | Delete
[77] Fix | Delete
// OK,nonce has been verified and now we can save the data according the the capabilities of the user
[78] Fix | Delete
if( in_array($_POST['post_type'], $sh_post_types) ) {
[79] Fix | Delete
if ( !current_user_can( 'edit_page', $post_id ) ) {
[80] Fix | Delete
return;
[81] Fix | Delete
} else {
[82] Fix | Delete
$hide_featured = ( isset( $_POST['_hide_featured'] ) && $_POST['_hide_featured'] == 1 ) ? '1' : $_POST['_hide_featured'];
[83] Fix | Delete
update_post_meta( $post_id, '_hide_featured', $hide_featured );
[84] Fix | Delete
}
[85] Fix | Delete
}
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
/**
[89] Fix | Delete
* To hide featured image from single post page
[90] Fix | Delete
*
[91] Fix | Delete
* @since Hide Featured Image 1.0
[92] Fix | Delete
*/
[93] Fix | Delete
function sh_featured_image() {
[94] Fix | Delete
[95] Fix | Delete
if( is_single() || is_page() ){
[96] Fix | Delete
[97] Fix | Delete
$hide = false;
[98] Fix | Delete
$sh_hide_all = get_option('sh_hide_all_image');/* Hide all post or image */
[99] Fix | Delete
$hide_image = get_post_meta( get_the_ID(), '_hide_featured', true );/* Hide single post */
[100] Fix | Delete
[101] Fix | Delete
[102] Fix | Delete
$hide = ( is_page() && isset( $sh_hide_all['page_image'] ) && $sh_hide_all['page_image'] && $hide_image != 2 ) ? true : $hide ;
[103] Fix | Delete
$hide = ( is_singular( 'post' ) && isset( $sh_hide_all['post_image'] ) && $sh_hide_all['post_image'] && $hide_image != 2 ) ? true : $hide ;
[104] Fix | Delete
$hide = ( isset( $hide_image ) && $hide_image && $hide_image != 2 )? true : $hide;/* Hide single post */
[105] Fix | Delete
[106] Fix | Delete
if( $hide ){ ?>
[107] Fix | Delete
<style>
[108] Fix | Delete
.has-post-thumbnail img.wp-post-image,
[109] Fix | Delete
.attachment-twentyseventeen-featured-image.wp-post-image { display: none !important; }
[110] Fix | Delete
</style><?php
[111] Fix | Delete
}
[112] Fix | Delete
}
[113] Fix | Delete
}
[114] Fix | Delete
[115] Fix | Delete
/**
[116] Fix | Delete
* To add menu option in dashboard
[117] Fix | Delete
*
[118] Fix | Delete
* @since Hide Featured Image 1.1
[119] Fix | Delete
*/
[120] Fix | Delete
function sh_settings_menu() {
[121] Fix | Delete
add_submenu_page(
[122] Fix | Delete
'options-general.php', // admin page slug
[123] Fix | Delete
__( 'Hide Featured Image', 'hide-featured-image' ), // page title
[124] Fix | Delete
__( 'Hide Featured Image', 'hide-featured-image' ), // menu title
[125] Fix | Delete
'manage_options', // capability required to see the page
[126] Fix | Delete
'sh_hide_options', // admin page slug, e.g. options-general.php?page=wporg_options
[127] Fix | Delete
'sh_settings_page' // callback function to display the options page
[128] Fix | Delete
);
[129] Fix | Delete
}
[130] Fix | Delete
[131] Fix | Delete
/**
[132] Fix | Delete
* Register the settings
[133] Fix | Delete
*/
[134] Fix | Delete
function sh_hide_register_settings() {
[135] Fix | Delete
register_setting( 'sh_hide_options', 'sh_hide_all_image' );
[136] Fix | Delete
}
[137] Fix | Delete
[138] Fix | Delete
/**
[139] Fix | Delete
* To add settings page
[140] Fix | Delete
*
[141] Fix | Delete
* @since Hide Featured Image 1.1
[142] Fix | Delete
*/
[143] Fix | Delete
function sh_settings_page() {
[144] Fix | Delete
if ( ! isset( $_REQUEST['settings-updated'] ) )
[145] Fix | Delete
$_REQUEST['settings-updated'] = false; ?>
[146] Fix | Delete
[147] Fix | Delete
<div class="wrap hide_featured">
[148] Fix | Delete
[149] Fix | Delete
<h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
[150] Fix | Delete
[151] Fix | Delete
<div id="poststuff">
[152] Fix | Delete
<div id="post-body">
[153] Fix | Delete
<div class="postbox-container column-primary">
[154] Fix | Delete
<div id="hide_featured_setting" class="postbox">
[155] Fix | Delete
<button type="button" class="handlediv" aria-expanded="true">
[156] Fix | Delete
<span class="screen-reader-text">Toggle panel: General Settings</span>
[157] Fix | Delete
<span class="toggle-indicator" aria-hidden="true"></span>
[158] Fix | Delete
</button>
[159] Fix | Delete
<h2 class="hndle"><span>General Settings</span></h2>
[160] Fix | Delete
<div class="inside">
[161] Fix | Delete
<form method="post" action="options.php">
[162] Fix | Delete
<?php settings_fields( 'sh_hide_options' ); ?>
[163] Fix | Delete
<?php $hide_image = get_option( 'sh_hide_all_image' ); ?>
[164] Fix | Delete
<table class="form-table">
[165] Fix | Delete
<tr valign="top"><th scope="row"><?php _e( 'Hide Image from all Posts(not Custom Post Type)?', 'hide-featured-image' ); ?></th>
[166] Fix | Delete
<td>
[167] Fix | Delete
<?php $selected = ( isset( $hide_image['post_image'] ) ) ? $hide_image['post_image'] : 0; ?>
[168] Fix | Delete
<input type="radio" name="sh_hide_all_image[post_image]" value="1" <?php checked( $selected, 1 ); ?>><?php _e( 'Yes', 'hide-featured-image' ); ?>&nbsp;&nbsp;
[169] Fix | Delete
<input type="radio" name="sh_hide_all_image[post_image]" value="0" <?php checked( $selected, 0 ); ?>><?php _e( 'No', 'hide-featured-image' ); ?>
[170] Fix | Delete
</td>
[171] Fix | Delete
</tr>
[172] Fix | Delete
<tr valign="top"><th scope="row"><?php _e( 'Hide Image from all Pages?', 'hide-featured-image' ); ?></th>
[173] Fix | Delete
<td>
[174] Fix | Delete
<?php $selected = ( isset( $hide_image['page_image'] ) ) ? $hide_image['page_image'] : 0; ?>
[175] Fix | Delete
<input type="radio" name="sh_hide_all_image[page_image]" value="1" <?php checked( $selected, 1 ); ?>><?php _e( 'Yes', 'hide-featured-image' ); ?>&nbsp;&nbsp;
[176] Fix | Delete
<input type="radio" name="sh_hide_all_image[page_image]" value="0" <?php checked( $selected, 0 ); ?>><?php _e( 'No', 'hide-featured-image' ); ?>
[177] Fix | Delete
</td>
[178] Fix | Delete
</tr>
[179] Fix | Delete
</table><br>
[180] Fix | Delete
<input type="submit" class="button button-primary" >
[181] Fix | Delete
</form><br>
[182] Fix | Delete
</div>
[183] Fix | Delete
</div>
[184] Fix | Delete
[185] Fix | Delete
<div class="postbox">
[186] Fix | Delete
<h2 class="hndle"><span><?php _e('How to use "Hide Featured Image" Plugin ?', 'hide-featured-image'); ?></span></h2>
[187] Fix | Delete
<ol>
[188] Fix | Delete
<li></p><?php _e("To hide featured images from all Posts(not Custom Post Types) Or from Pages, select the 'Yes' option above.", 'hide-featured-image'); ?></li>
[189] Fix | Delete
<li><?php _e("If you want to hide featured image from few posts/pages and not all, then edit that single page and select 'yes' to hide feature image from that particular post.", 'hide-featured-image'); ?></li>
[190] Fix | Delete
<li><?php _e('At any point, the option selected on single page/post will override the option provided in settings page. So if you have selected "Hide All" and want to show featured image on one post then you can select "No"(don\'t hide featured image) from edit page of that post.', 'hide-featured-image'); ?></li>
[191] Fix | Delete
<li><?php _e('For any query or detailed information please visit', 'hide-featured-image'); ?>
[192] Fix | Delete
<a title="<?php _e( 'Plugin home', 'hide-featured-image' ); ?>" href="http://shahpranav.com/2015/05/hide-featured-image-on-single-post/">
[193] Fix | Delete
<?php _e( 'Plugin home', 'hide-featured-image' ); ?>
[194] Fix | Delete
</a>
[195] Fix | Delete
</li>
[196] Fix | Delete
</ol>
[197] Fix | Delete
</div>
[198] Fix | Delete
[199] Fix | Delete
</div> <!-- end post-body-content -->
[200] Fix | Delete
[201] Fix | Delete
<div class="postbox-container column-secondary">
[202] Fix | Delete
<div id="hide_featured_donate" class="postbox">
[203] Fix | Delete
<button type="button" class="handlediv" aria-expanded="true">
[204] Fix | Delete
<span class="screen-reader-text">Toggle panel: Support this plugin</span>
[205] Fix | Delete
<span class="toggle-indicator" aria-hidden="true"></span>
[206] Fix | Delete
</button>
[207] Fix | Delete
<h2 class="hndle"><span><?php _e("Support this plugin", 'hide-featured-image'); ?></span></h2>
[208] Fix | Delete
<div class="inside">
[209] Fix | Delete
<p><?php printf(__("If you found this plugin useful, or I've already helped you, please consider buying me a %s coffee %s or two.", 'hide-featured-image'), "<a href='https://ko-fi.com/M4M6E3Y9' target='_blank'>", "</a>"); ?></p>
[210] Fix | Delete
<p><?php _e("Donations help alleviate the time spent developing and supporting this plugin and are greatly appreciated.", 'hide-featured-image');?></p>
[211] Fix | Delete
<a href='https://ko-fi.com/M4M6E3Y9' target='_blank'><img height='46' style='border:0px;height:46px;' src='https://az743702.vo.msecnd.net/cdn/kofi1.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
[212] Fix | Delete
</div>
[213] Fix | Delete
</div>
[214] Fix | Delete
</div>
[215] Fix | Delete
</div> <!-- end post-body -->
[216] Fix | Delete
</div> <!-- end poststuff -->
[217] Fix | Delete
</div>
[218] Fix | Delete
<style>
[219] Fix | Delete
.hide_featured #poststuff .column-primary {
[220] Fix | Delete
width: 71%;
[221] Fix | Delete
padding: 0;
[222] Fix | Delete
float: left;
[223] Fix | Delete
}
[224] Fix | Delete
.hide_featured #poststuff .column-secondary {
[225] Fix | Delete
width: 28%;
[226] Fix | Delete
float: right;
[227] Fix | Delete
padding: 0;
[228] Fix | Delete
}
[229] Fix | Delete
.hide_featured li {
[230] Fix | Delete
line-height: 1.4em;
[231] Fix | Delete
}
[232] Fix | Delete
</style><?php
[233] Fix | Delete
}
[234] Fix | Delete
[235] Fix | Delete
function sh_hide_featured_image_init() {
[236] Fix | Delete
load_plugin_textdomain( 'hide-featured-image', false, 'hide-featured-image/languages' );
[237] Fix | Delete
}
[238] Fix | Delete
?>
[239] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function