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/clone/wp-conte.../themes/herald/core
File: extensions.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/* Add classes to body tag */
[2] Fix | Delete
[3] Fix | Delete
add_filter( 'body_class', 'herald_body_class' );
[4] Fix | Delete
[5] Fix | Delete
if ( !function_exists( 'herald_body_class' ) ):
[6] Fix | Delete
function herald_body_class( $classes ) {
[7] Fix | Delete
[8] Fix | Delete
if ( herald_get_option( 'content_layout' ) == 'boxed' ) {
[9] Fix | Delete
$classes[] = 'herald-boxed';
[10] Fix | Delete
}
[11] Fix | Delete
[12] Fix | Delete
$classes[] = 'herald-v_' . str_replace('.', '_', HERALD_THEME_VERSION);
[13] Fix | Delete
[14] Fix | Delete
if ( is_child_theme() ) {
[15] Fix | Delete
$classes[] = 'herald-child';
[16] Fix | Delete
}
[17] Fix | Delete
[18] Fix | Delete
return $classes;
[19] Fix | Delete
}
[20] Fix | Delete
endif;
[21] Fix | Delete
[22] Fix | Delete
[23] Fix | Delete
/* Add media grabber features */
[24] Fix | Delete
[25] Fix | Delete
add_action( 'init', 'herald_add_media_grabber' );
[26] Fix | Delete
[27] Fix | Delete
if ( !function_exists( 'herald_add_media_grabber' ) ):
[28] Fix | Delete
function herald_add_media_grabber() {
[29] Fix | Delete
if ( !class_exists( 'Hybrid_Media_Grabber' ) ) {
[30] Fix | Delete
include_once get_parent_theme_file_path( '/inc/media-grabber/class-hybrid-media-grabber.php' );
[31] Fix | Delete
}
[32] Fix | Delete
}
[33] Fix | Delete
endif;
[34] Fix | Delete
[35] Fix | Delete
/* Add class to gallery images to run our pop-up and change sizes */
[36] Fix | Delete
[37] Fix | Delete
add_filter( 'shortcode_atts_gallery', 'herald_gallery_atts', 10, 3 );
[38] Fix | Delete
[39] Fix | Delete
if ( !function_exists( 'herald_gallery_atts' ) ):
[40] Fix | Delete
function herald_gallery_atts( $output, $pairs, $atts ) {
[41] Fix | Delete
[42] Fix | Delete
if ( herald_get_option( 'popup_img' ) ) {
[43] Fix | Delete
$atts['link'] = 'file';
[44] Fix | Delete
$output['link'] = 'file';
[45] Fix | Delete
add_filter( 'wp_get_attachment_link', 'herald_add_class_attachment_link', 10, 1 );
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
if ( !isset( $output['columns'] ) ) {
[49] Fix | Delete
$output['columns'] = 1;
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
if ( herald_get_option( 'auto_gallery_img_sizes' ) ) {
[53] Fix | Delete
switch ( $output['columns'] ) {
[54] Fix | Delete
case '1' : $output['size'] = 'herald-lay-a-full'; break;
[55] Fix | Delete
case '2' : $output['size'] = 'herald-lay-a'; break;
[56] Fix | Delete
case '3' : $output['size'] = 'herald-lay-c1'; break;
[57] Fix | Delete
case '4' : $output['size'] = 'herald-lay-f1-full'; break;
[58] Fix | Delete
case '5' :
[59] Fix | Delete
case '6' : $output['size'] = 'herald-lay-f1'; break;
[60] Fix | Delete
case '7' :
[61] Fix | Delete
case '8' :
[62] Fix | Delete
case '9' : $output['size'] = 'herald-lay-i1'; break;
[63] Fix | Delete
default: $output['size'] = 'herald-lay-a-full'; break;
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
//Check if has a matched image size
[67] Fix | Delete
global $herald_image_matches;
[68] Fix | Delete
[69] Fix | Delete
if ( !empty( $herald_image_matches ) && array_key_exists( $output['size'], $herald_image_matches ) ) {
[70] Fix | Delete
$output['size'] = $herald_image_matches[$output['size']];
[71] Fix | Delete
}
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
[75] Fix | Delete
[76] Fix | Delete
return $output;
[77] Fix | Delete
}
[78] Fix | Delete
endif;
[79] Fix | Delete
[80] Fix | Delete
if ( !function_exists( 'herald_add_class_attachment_link' ) ):
[81] Fix | Delete
function herald_add_class_attachment_link( $link ) {
[82] Fix | Delete
$link = str_replace( '<a', '<a class="herald-popup"', $link );
[83] Fix | Delete
return $link;
[84] Fix | Delete
}
[85] Fix | Delete
endif;
[86] Fix | Delete
[87] Fix | Delete
[88] Fix | Delete
[89] Fix | Delete
/**
[90] Fix | Delete
* Filter Function to set replace gallery block with gallery shortocede
[91] Fix | Delete
*
[92] Fix | Delete
* @since 2.2
[93] Fix | Delete
* @return $content
[94] Fix | Delete
*/
[95] Fix | Delete
[96] Fix | Delete
add_filter( 'the_content', 'herald_fallback_gallery_filter', 3 );
[97] Fix | Delete
[98] Fix | Delete
if ( !function_exists( 'herald_fallback_gallery_filter' ) ) :
[99] Fix | Delete
function herald_fallback_gallery_filter( $content ) {
[100] Fix | Delete
[101] Fix | Delete
if ( !herald_get_option( 'auto_gallery_img_sizes' ) ) {
[102] Fix | Delete
return $content;
[103] Fix | Delete
}
[104] Fix | Delete
[105] Fix | Delete
if(!function_exists('parse_blocks') ){
[106] Fix | Delete
return $content;
[107] Fix | Delete
}
[108] Fix | Delete
[109] Fix | Delete
if ( empty( $content ) ) {
[110] Fix | Delete
$post = get_post();
[111] Fix | Delete
$content = $post->post_content;
[112] Fix | Delete
}
[113] Fix | Delete
[114] Fix | Delete
$blocks = parse_blocks( $content );
[115] Fix | Delete
[116] Fix | Delete
if ( empty( $blocks ) ) {
[117] Fix | Delete
return $content;
[118] Fix | Delete
}
[119] Fix | Delete
[120] Fix | Delete
$found = false;
[121] Fix | Delete
[122] Fix | Delete
foreach ( $blocks as $block ) {
[123] Fix | Delete
[124] Fix | Delete
if ( $block['blockName'] == 'core/gallery' && isset( $block['attrs']['columns'] ) && $block['attrs']['columns'] < 2 ) {
[125] Fix | Delete
[126] Fix | Delete
$gallery_ids = [];
[127] Fix | Delete
[128] Fix | Delete
if ( isset( $block['attrs']['ids'] ) && !empty( $block['attrs']['ids'] ) ) {
[129] Fix | Delete
$gallery_ids = $block['attrs']['ids'];
[130] Fix | Delete
} else {
[131] Fix | Delete
preg_match_all( '/data-id="(.*?)"/i', $content, $id_matches );
[132] Fix | Delete
[133] Fix | Delete
if ( empty( $id_matches[1] ) ) {
[134] Fix | Delete
continue;
[135] Fix | Delete
}
[136] Fix | Delete
[137] Fix | Delete
foreach ( $id_matches[1] as $match ) {
[138] Fix | Delete
$gallery_ids[] = $match;
[139] Fix | Delete
}
[140] Fix | Delete
}
[141] Fix | Delete
[142] Fix | Delete
$pattern = '/<ul class="wp-block-gallery(.*?)<\/ul>/i';
[143] Fix | Delete
$shortcode = '[gallery ids="' . implode( ',', $gallery_ids ) . '" columns="1"]';
[144] Fix | Delete
$content = preg_replace( $pattern, $shortcode, $content, 1 );
[145] Fix | Delete
$found = true;
[146] Fix | Delete
}
[147] Fix | Delete
}
[148] Fix | Delete
[149] Fix | Delete
return $content;
[150] Fix | Delete
[151] Fix | Delete
[152] Fix | Delete
}
[153] Fix | Delete
endif;
[154] Fix | Delete
[155] Fix | Delete
[156] Fix | Delete
/* Unregister Entry Views widget */
[157] Fix | Delete
add_action( 'widgets_init', 'herald_unregister_widgets', 99 );
[158] Fix | Delete
[159] Fix | Delete
if ( !function_exists( 'herald_unregister_widgets' ) ):
[160] Fix | Delete
function herald_unregister_widgets() {
[161] Fix | Delete
[162] Fix | Delete
$widgets = array( 'EV_Widget_Entry_Views' );
[163] Fix | Delete
[164] Fix | Delete
//Allow child themes or plugins to add/remove widgets they want to unregister
[165] Fix | Delete
$widgets = apply_filters( 'herald_modify_unregister_widgets', $widgets );
[166] Fix | Delete
[167] Fix | Delete
if ( !empty( $widgets ) ) {
[168] Fix | Delete
foreach ( $widgets as $widget ) {
[169] Fix | Delete
unregister_widget( $widget );
[170] Fix | Delete
}
[171] Fix | Delete
}
[172] Fix | Delete
[173] Fix | Delete
}
[174] Fix | Delete
endif;
[175] Fix | Delete
[176] Fix | Delete
[177] Fix | Delete
/* Remove entry views support for other post types, we need post support only */
[178] Fix | Delete
[179] Fix | Delete
add_action( 'init', 'herald_remove_entry_views_support', 99 );
[180] Fix | Delete
[181] Fix | Delete
if ( !function_exists( 'herald_remove_entry_views_support' ) ):
[182] Fix | Delete
function herald_remove_entry_views_support() {
[183] Fix | Delete
[184] Fix | Delete
$types = array( 'page', 'attachment', 'literature', 'portfolio_item', 'recipe', 'restaurant_item' );
[185] Fix | Delete
[186] Fix | Delete
//Allow child themes or plugins to modify entry views support
[187] Fix | Delete
$widgets = apply_filters( 'herald_modify_entry_views_support', $types );
[188] Fix | Delete
[189] Fix | Delete
if ( !empty( $types ) ) {
[190] Fix | Delete
foreach ( $types as $type ) {
[191] Fix | Delete
remove_post_type_support( $type, 'entry-views' );
[192] Fix | Delete
}
[193] Fix | Delete
}
[194] Fix | Delete
[195] Fix | Delete
}
[196] Fix | Delete
endif;
[197] Fix | Delete
[198] Fix | Delete
[199] Fix | Delete
/* Prevent redirect issue that may brake home page pagination caused by some plugins */
[200] Fix | Delete
add_filter( 'redirect_canonical', 'herald_disable_redirect_canonical' );
[201] Fix | Delete
[202] Fix | Delete
function herald_disable_redirect_canonical( $redirect_url ) {
[203] Fix | Delete
if ( is_page_template( 'template-modules.php' ) && is_paged() ) {
[204] Fix | Delete
$redirect_url = false;
[205] Fix | Delete
}
[206] Fix | Delete
return $redirect_url;
[207] Fix | Delete
}
[208] Fix | Delete
[209] Fix | Delete
[210] Fix | Delete
[211] Fix | Delete
/* Add span elements to post count number in category widget */
[212] Fix | Delete
[213] Fix | Delete
add_filter( 'wp_list_categories', 'herald_add_span_cat_count', 10, 2 );
[214] Fix | Delete
[215] Fix | Delete
if ( !function_exists( 'herald_add_span_cat_count' ) ):
[216] Fix | Delete
function herald_add_span_cat_count( $links, $args ) {
[217] Fix | Delete
[218] Fix | Delete
if ( isset( $args['taxonomy'] ) && $args['taxonomy'] != 'category' ) {
[219] Fix | Delete
return $links;
[220] Fix | Delete
}
[221] Fix | Delete
[222] Fix | Delete
$links = preg_replace( '/(<a[^>]*>)/', '$1<span class="category-text">', $links );
[223] Fix | Delete
$links = str_replace( '</a>', '</span></a>', $links );
[224] Fix | Delete
$links = str_replace( '</a> (', '<span class="count">', $links );
[225] Fix | Delete
$links = str_replace( ')', '</span></a>', $links );
[226] Fix | Delete
[227] Fix | Delete
return $links;
[228] Fix | Delete
}
[229] Fix | Delete
endif;
[230] Fix | Delete
[231] Fix | Delete
[232] Fix | Delete
[233] Fix | Delete
[234] Fix | Delete
/* Pre get posts */
[235] Fix | Delete
add_action( 'pre_get_posts', 'herald_pre_get_posts' );
[236] Fix | Delete
[237] Fix | Delete
if ( !function_exists( 'herald_pre_get_posts' ) ):
[238] Fix | Delete
function herald_pre_get_posts( $query ) {
[239] Fix | Delete
[240] Fix | Delete
if ( !is_admin() && $query->is_main_query() && $query->is_archive() && !$query->is_feed()) {
[241] Fix | Delete
[242] Fix | Delete
$template = herald_detect_template();
[243] Fix | Delete
[244] Fix | Delete
/* Check whether to change number of posts per page for specific archive template */
[245] Fix | Delete
$ppp = herald_get_option( $template.'_ppp' );
[246] Fix | Delete
[247] Fix | Delete
if ( $template == 'category' ) {
[248] Fix | Delete
[249] Fix | Delete
$obj = get_queried_object();
[250] Fix | Delete
[251] Fix | Delete
if(!empty($obj)){
[252] Fix | Delete
[253] Fix | Delete
$cat_meta = herald_get_category_meta( $obj->term_id );
[254] Fix | Delete
[255] Fix | Delete
if ( $cat_meta['layout'] == 'inherit' || $cat_meta['ppp'] == 'inherit' ) {
[256] Fix | Delete
if ( $ppp == 'custom' ) {
[257] Fix | Delete
$ppp_num = absint( herald_get_option( $template.'_ppp_num' ) );
[258] Fix | Delete
$query->set( 'posts_per_page', $ppp_num );
[259] Fix | Delete
}
[260] Fix | Delete
} else {
[261] Fix | Delete
if ( $cat_meta['ppp'] == 'custom' ) {
[262] Fix | Delete
$query->set( 'posts_per_page', $cat_meta['ppp_num'] );
[263] Fix | Delete
}
[264] Fix | Delete
}
[265] Fix | Delete
}
[266] Fix | Delete
[267] Fix | Delete
} else {
[268] Fix | Delete
if ( $ppp == 'custom' ) {
[269] Fix | Delete
$ppp_num = absint( herald_get_option( $template.'_ppp_num' ) );
[270] Fix | Delete
$query->set( 'posts_per_page', $ppp_num );
[271] Fix | Delete
}
[272] Fix | Delete
}
[273] Fix | Delete
[274] Fix | Delete
/* Check for featured area on category page and exclude those posts from main post listing */
[275] Fix | Delete
if ( $template == 'category' ) {
[276] Fix | Delete
[277] Fix | Delete
$fa = herald_get_featured_area();
[278] Fix | Delete
[279] Fix | Delete
if ( !empty( $fa ) && herald_get_option( 'category_fa_unique' ) ) {
[280] Fix | Delete
[281] Fix | Delete
if ( isset( $fa['query'] ) && !is_wp_error( $fa['query'] ) && !empty( $fa['query'] ) ) {
[282] Fix | Delete
$exclude_ids = array();
[283] Fix | Delete
foreach ( $fa['query']->posts as $p ) {
[284] Fix | Delete
$exclude_ids[] = $p->ID;
[285] Fix | Delete
}
[286] Fix | Delete
[287] Fix | Delete
$query->set( 'post__not_in', $exclude_ids );
[288] Fix | Delete
}
[289] Fix | Delete
[290] Fix | Delete
}
[291] Fix | Delete
}
[292] Fix | Delete
[293] Fix | Delete
}
[294] Fix | Delete
[295] Fix | Delete
}
[296] Fix | Delete
endif;
[297] Fix | Delete
[298] Fix | Delete
[299] Fix | Delete
[300] Fix | Delete
/**
[301] Fix | Delete
* Modify WooCommerce Wrappers
[302] Fix | Delete
*
[303] Fix | Delete
* Modify WooCommerce Wrappers according to Herald Structure
[304] Fix | Delete
*
[305] Fix | Delete
* @return HTML output
[306] Fix | Delete
* @since 1.2
[307] Fix | Delete
*/
[308] Fix | Delete
[309] Fix | Delete
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
[310] Fix | Delete
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
[311] Fix | Delete
add_action( 'woocommerce_before_main_content', 'herald_woocommerce_wrapper_start', 10 );
[312] Fix | Delete
add_action( 'woocommerce_after_main_content', 'herald_woocommerce_wrapper_end', 10 );
[313] Fix | Delete
[314] Fix | Delete
if ( !function_exists( 'herald_woocommerce_wrapper_start' ) ):
[315] Fix | Delete
function herald_woocommerce_wrapper_start() {
[316] Fix | Delete
global $herald_sidebar_opts;
[317] Fix | Delete
$col_class = $herald_sidebar_opts['use_sidebar'] == 'none' ? 12 : 9;
[318] Fix | Delete
$left_sid_mod_class = $herald_sidebar_opts['use_sidebar'] == 'left' ? 'herald-woo-mod-right' : '';
[319] Fix | Delete
echo '<div class="herald-section container"><div class="row"><div class="herald-module herald-main-content '.$left_sid_mod_class.' col-lg-'.esc_attr( $col_class ).' col-md-'.esc_attr( $col_class ).'">';
[320] Fix | Delete
}
[321] Fix | Delete
endif;
[322] Fix | Delete
[323] Fix | Delete
if ( !function_exists( 'herald_woocommerce_wrapper_end' ) ):
[324] Fix | Delete
function herald_woocommerce_wrapper_end() {
[325] Fix | Delete
echo '</div>';
[326] Fix | Delete
}
[327] Fix | Delete
endif;
[328] Fix | Delete
[329] Fix | Delete
add_action( 'herald_before_end_content', 'herald_woocommerce_close_wrap' );
[330] Fix | Delete
[331] Fix | Delete
if ( !function_exists( 'herald_woocommerce_close_wrap' ) ):
[332] Fix | Delete
function herald_woocommerce_close_wrap() {
[333] Fix | Delete
if ( herald_is_woocommerce_active() && herald_is_woocommerce_page() ) {
[334] Fix | Delete
echo '</div></div>';
[335] Fix | Delete
}
[336] Fix | Delete
}
[337] Fix | Delete
endif;
[338] Fix | Delete
[339] Fix | Delete
[340] Fix | Delete
/**
[341] Fix | Delete
* Woocommerce Cart Elements
[342] Fix | Delete
*
[343] Fix | Delete
* @return bool
[344] Fix | Delete
* @since 1.9
[345] Fix | Delete
*/
[346] Fix | Delete
if ( !function_exists( 'herald_woocommerce_cart_elements' ) ):
[347] Fix | Delete
function herald_woocommerce_cart_elements() {
[348] Fix | Delete
if( !herald_is_woocommerce_active() ){ return; }
[349] Fix | Delete
$elements = array();
[350] Fix | Delete
$elements['cart_url'] = wc_get_cart_url();
[351] Fix | Delete
$elements['products_count'] = WC()->cart->get_cart_contents_count();
[352] Fix | Delete
return $elements;
[353] Fix | Delete
}
[354] Fix | Delete
endif;
[355] Fix | Delete
[356] Fix | Delete
/**
[357] Fix | Delete
* Woocommerce Ajaxify Cart
[358] Fix | Delete
*
[359] Fix | Delete
* @return bool
[360] Fix | Delete
* @since 1.9
[361] Fix | Delete
*/
[362] Fix | Delete
[363] Fix | Delete
if ( !function_exists( 'herald_woocommerce_ajax_fragments' ) ):
[364] Fix | Delete
[365] Fix | Delete
if ( herald_is_woocommerce_active() && version_compare( WC_VERSION, '3.2.6', '<') ) {
[366] Fix | Delete
add_filter( 'add_to_cart_fragments', 'herald_woocommerce_ajax_fragments' );
[367] Fix | Delete
} else {
[368] Fix | Delete
add_filter( 'woocommerce_add_to_cart_fragments', 'herald_woocommerce_ajax_fragments' );
[369] Fix | Delete
}
[370] Fix | Delete
[371] Fix | Delete
function herald_woocommerce_ajax_fragments( $fragments ) {
[372] Fix | Delete
ob_start();
[373] Fix | Delete
$elements = herald_woocommerce_cart_elements();
[374] Fix | Delete
if (!empty($elements)) :
[375] Fix | Delete
?>
[376] Fix | Delete
<a class="herald-custom-cart fa fa-shopping-cart" href="<?php echo esc_url( $elements['cart_url'] ); ?>">
[377] Fix | Delete
<?php if( $elements['products_count'] > 0 ) : ?>
[378] Fix | Delete
<span class="herald-cart-count"><?php echo absint( $elements['products_count'] ); ?></span>
[379] Fix | Delete
<?php endif; ?>
[380] Fix | Delete
</a>
[381] Fix | Delete
<?php
[382] Fix | Delete
endif;
[383] Fix | Delete
$fragments['a.herald-custom-cart'] = ob_get_clean();
[384] Fix | Delete
[385] Fix | Delete
return $fragments;
[386] Fix | Delete
}
[387] Fix | Delete
endif;
[388] Fix | Delete
[389] Fix | Delete
[390] Fix | Delete
/**
[391] Fix | Delete
* Support for WMPU Dev - Custom Sidebars Plugin
[392] Fix | Delete
*
[393] Fix | Delete
* If sidebar params are not entered in a plugin settings, it will inherit before and after params from our theme
[394] Fix | Delete
*
[395] Fix | Delete
* @return array of sidebar params
[396] Fix | Delete
* @since 1.5
[397] Fix | Delete
*/
[398] Fix | Delete
[399] Fix | Delete
add_filter( 'cs_sidebar_params', 'herald_cs_sidebar_params' );
[400] Fix | Delete
[401] Fix | Delete
if ( !function_exists( 'herald_cs_sidebar_params' ) ):
[402] Fix | Delete
function herald_cs_sidebar_params( $sidebar ) {
[403] Fix | Delete
[404] Fix | Delete
if ( empty( $sidebar['before_widget'] ) && empty( $sidebar['after_widget'] ) ) {
[405] Fix | Delete
$sidebar['before_widget'] = '<div id="%1$s" class="widget %2$s">';
[406] Fix | Delete
$sidebar['after_widget'] = '</div>';
[407] Fix | Delete
}
[408] Fix | Delete
[409] Fix | Delete
if ( empty( $sidebar['before_title'] ) && empty( $sidebar['after_title'] ) ) {
[410] Fix | Delete
$sidebar['before_title'] = '<h4 class="widget-title h6"><span>';
[411] Fix | Delete
$sidebar['after_title'] = '</span></h4>';
[412] Fix | Delete
}
[413] Fix | Delete
[414] Fix | Delete
return $sidebar;
[415] Fix | Delete
}
[416] Fix | Delete
endif;
[417] Fix | Delete
[418] Fix | Delete
/**
[419] Fix | Delete
* Filter Function to add class to linked media image for popup
[420] Fix | Delete
*
[421] Fix | Delete
* @return $content
[422] Fix | Delete
*/
[423] Fix | Delete
[424] Fix | Delete
add_filter( 'the_content', 'herald_popup_media_in_content', 100, 1 );
[425] Fix | Delete
[426] Fix | Delete
add_filter('bbp_get_topic_content','herald_popup_media_in_content');
[427] Fix | Delete
add_filter('bbp_get_reply_content','herald_popup_media_in_content');
[428] Fix | Delete
[429] Fix | Delete
if ( !function_exists( 'herald_popup_media_in_content' ) ):
[430] Fix | Delete
function herald_popup_media_in_content( $content ) {
[431] Fix | Delete
[432] Fix | Delete
if ( herald_get_option( 'on_single_img_popup' ) ) {
[433] Fix | Delete
[434] Fix | Delete
$pattern = "/<a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")>/i";
[435] Fix | Delete
$replacement = '<a$1class="herald-popup-img" href=$2$3.$4$5>';
[436] Fix | Delete
$content = preg_replace( $pattern, $replacement, $content );
[437] Fix | Delete
return $content;
[438] Fix | Delete
}
[439] Fix | Delete
[440] Fix | Delete
return $content;
[441] Fix | Delete
}
[442] Fix | Delete
endif;
[443] Fix | Delete
[444] Fix | Delete
/**
[445] Fix | Delete
* Add comment form default fields args filter
[446] Fix | Delete
* to replace comment fields labels
[447] Fix | Delete
*/
[448] Fix | Delete
[449] Fix | Delete
add_filter('comment_form_default_fields', 'herald_comment_fields_labels');
[450] Fix | Delete
[451] Fix | Delete
if(!function_exists('herald_comment_fields_labels')):
[452] Fix | Delete
function herald_comment_fields_labels($fields){
[453] Fix | Delete
[454] Fix | Delete
$replace = array(
[455] Fix | Delete
'author' => array(
[456] Fix | Delete
'old' => esc_html__( 'Name', 'herald' ),
[457] Fix | Delete
'new' =>__herald( 'comment_name' )
[458] Fix | Delete
),
[459] Fix | Delete
'email' => array(
[460] Fix | Delete
'old' => esc_html__( 'Email', 'herald' ),
[461] Fix | Delete
'new' =>__herald( 'comment_email' )
[462] Fix | Delete
),
[463] Fix | Delete
'url' => array(
[464] Fix | Delete
'old' => esc_html__( 'Website', 'herald' ),
[465] Fix | Delete
'new' =>__herald( 'comment_website' )
[466] Fix | Delete
),
[467] Fix | Delete
[468] Fix | Delete
'cookies' => array(
[469] Fix | Delete
'old' => esc_html__( 'Save my name, email, and website in this browser for the next time I comment.', 'herald' ),
[470] Fix | Delete
'new' =>__herald( 'comment_cookie_gdpr' )
[471] Fix | Delete
)
[472] Fix | Delete
);
[473] Fix | Delete
[474] Fix | Delete
foreach($fields as $key => $field){
[475] Fix | Delete
[476] Fix | Delete
if(array_key_exists($key, $replace)){
[477] Fix | Delete
$fields[$key] = str_replace($replace[$key]['old'], $replace[$key]['new'], $fields[$key]);
[478] Fix | Delete
}
[479] Fix | Delete
[480] Fix | Delete
}
[481] Fix | Delete
[482] Fix | Delete
return $fields;
[483] Fix | Delete
[484] Fix | Delete
}
[485] Fix | Delete
[486] Fix | Delete
endif;
[487] Fix | Delete
[488] Fix | Delete
[489] Fix | Delete
/**
[490] Fix | Delete
* Filter for social share options on frontend in the_content filter
[491] Fix | Delete
*
[492] Fix | Delete
* @param array $options - Array of options
[493] Fix | Delete
* @return array
[494] Fix | Delete
* @since 2.1.4
[495] Fix | Delete
*/
[496] Fix | Delete
add_filter( 'meks_ess_modify_options', 'herald_social_share_modify_options' );
[497] Fix | Delete
[498] Fix | Delete
if ( !function_exists( 'herald_social_share_modify_options' ) ):
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function