: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
/* Store registered sidebars so we can get them before wp_registered_sidebars is initialized to use them in theme options */
add_action( 'admin_init', 'herald_check_sidebars' );
if ( !function_exists( 'herald_check_sidebars' ) ):
function herald_check_sidebars() {
global $wp_registered_sidebars;
if ( !empty( $wp_registered_sidebars ) ) {
update_option( 'herald_registered_sidebars', $wp_registered_sidebars );
/* Change customize link to lead to theme options instead of live customizer */
add_filter( 'wp_prepare_themes_for_js', 'herald_change_customize_link' );
if ( !function_exists( 'herald_change_customize_link' ) ):
function herald_change_customize_link( $themes ) {
if ( array_key_exists( 'herald', $themes ) ) {
$themes['herald']['actions']['customize'] = admin_url( 'admin.php?page=herald_options' );
/* Change default arguments of flickr widget plugin */
add_filter( 'mks_flickr_widget_modify_defaults', 'herald_flickr_widget_defaults' );
if ( !function_exists( 'herald_flickr_widget_defaults' ) ):
function herald_flickr_widget_defaults( $defaults ) {
$defaults['t_width'] = 93;
$defaults['t_height'] = 93;
/* Change default arguments of author widget plugin */
add_filter( 'mks_author_widget_modify_defaults', 'herald_author_widget_defaults' );
if ( !function_exists( 'herald_author_widget_defaults' ) ):
function herald_author_widget_defaults( $defaults ) {
$defaults['avatar_size'] = 80;
/* Change default arguments of social widget plugin */
add_filter( 'mks_social_widget_modify_defaults', 'herald_social_widget_defaults' );
if ( !function_exists( 'herald_social_widget_defaults' ) ):
function herald_social_widget_defaults( $defaults ) {
$defaults['style'] = 'circle';
add_action( 'admin_init', 'herald_check_installation' );
if ( !function_exists( 'herald_check_installation' ) ):
function herald_check_installation() {
add_action( 'admin_notices', 'herald_welcome_msg', 1 );
add_action( 'admin_notices', 'herald_update_msg', 1 );
add_action( 'admin_notices', 'herald_required_plugins_msg', 1 );
/* Show welcome message and quick tips after theme activation */
if ( !function_exists( 'herald_welcome_msg' ) ):
function herald_welcome_msg() {
if ( get_option( 'herald_welcome_box_displayed' ) || get_option( 'merlin_herald_completed' ) ) {
update_option( 'herald_theme_version', HERALD_THEME_VERSION );
include_once get_parent_theme_file_path( '/core/admin/welcome-panel.php' );
/* Show message box after theme update */
if ( !function_exists( 'herald_update_msg' ) ):
function herald_update_msg() {
if ( !get_option( 'herald_welcome_box_displayed' ) && !get_option( 'merlin_herald_completed' ) ) {
$prev_version = get_option( 'herald_theme_version' );
$cur_version = HERALD_THEME_VERSION;
if ( $prev_version === false ) { $prev_version = '0.0.0'; }
if ( version_compare( $cur_version, $prev_version, '>' ) ) {
include_once get_parent_theme_file_path( '/core/admin/update-panel.php' );
* Display message if required plugins are not installed and activated
if ( !function_exists( 'herald_required_plugins_msg' ) ):
function herald_required_plugins_msg() {
if ( !get_option( 'herald_welcome_box_displayed' ) && !get_option( 'merlin_herald_completed' ) ) {
if ( !herald_is_redux_active() ) {
$class = 'notice notice-error';
$message = wp_kses_post( sprintf( __( 'Important: Redux Framework plugin is required to run your theme options panel. Please visit <a href="%s">recommended plugins page</a> to install it.', 'herald' ), admin_url( 'admin.php?page=install-required-plugins' ) ) );
printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
/* White label WP Review plugin - remove banner from options */
add_filter( 'wp_review_remove_branding', '__return_true' );
/* Remove WP review for pages */
add_filter( 'wp_review_excluded_post_types', 'herald_wp_review_exclude_post_types' );
if ( !function_exists( 'herald_wp_review_exclude_post_types' ) ):
function herald_wp_review_exclude_post_types( $excluded ) {
/* Remove WP review notice */
remove_action('admin_notices', 'wp_review_admin_notice');
/* Remove WP review jQuery UI from admin pages */
add_action('admin_enqueue_scripts', 'herald_wp_review_exclude_admin_scripts', 99 );
if ( !function_exists( 'herald_wp_review_exclude_admin_scripts' ) ):
function herald_wp_review_exclude_admin_scripts() {
if( herald_is_wp_review_active() ) {
wp_dequeue_style( 'plugin_name-admin-ui-css' );
wp_dequeue_style( 'wp-review-admin-ui-css' );
wp_dequeue_style( 'jquery-ui.js' );
* Check for Additional CSS in Theme Options and transfer it to Customize -> Additional CSS
add_action('admin_init','herald_patch_additional_css');
if ( !function_exists( 'herald_patch_additional_css' ) ) :
function herald_patch_additional_css() {
$additional_css = herald_get_option( 'additional_css' );
if ( empty( $additional_css ) ) {
$herald_settings = get_option( 'herald_settings' );
$herald_settings['additional_css'] = '';
update_option( 'herald_settings', $herald_settings ) ;
$customize_css = wp_get_custom_css_post();
if ( !empty( $customize_css ) && !is_wp_error( $customize_css ) ) {
$additional_css .= $customize_css->post_content;
wp_update_custom_css_post($additional_css);
* Filter for social share option fields
* @param array $args - Array of default fields
add_filter( 'meks_ess_modify_options_fields', 'herald_social_share_option_fields_filter' );
if ( !function_exists( 'herald_social_share_option_fields_filter' ) ):
function herald_social_share_option_fields_filter( $args ) {
unset( $args['location'] );
unset( $args['post_type'] );
unset( $args['label_share'] );
* Patching for social share platforms for meks easy share plugin
add_action('admin_init','herald_patch_social_share_platforms');
if ( !function_exists( 'herald_patch_social_share_platforms' ) ) :
function herald_patch_social_share_platforms() {
$social_platforms = herald_get_option( 'social_share' );
if ( empty( $social_platforms ) ) {
$herald_settings = get_option( 'herald_settings' );
$herald_settings['social_share'] = '';
update_option( 'herald_settings', $herald_settings ) ;
$new_platforms = array();
foreach ( $social_platforms as $platform => $value ) {
$new_platforms['platforms'][] = $platform;
update_option( 'meks_ess_settings', $new_platforms );
* Add Meks dashboard widget
add_action( 'wp_dashboard_setup', 'herald_add_dashboard_widgets' );
if ( !function_exists( 'herald_add_dashboard_widgets' ) ):
function herald_add_dashboard_widgets() {
add_meta_box( 'herald_dashboard_widget', 'Meks - WordPress Themes & Plugins', 'herald_dashboard_widget_cb', 'dashboard', 'side', 'high' );
if ( !function_exists( 'herald_dashboard_widget_cb' ) ):
function herald_dashboard_widget_cb() {
$transient = 'herald_mksaw';
$hide = '<style>#herald_dashboard_widget{display:none;}</style>';
$data = get_transient( $transient );
if ( $data == 'error' ) {
$url = 'https://demo.mekshq.com/mksaw.php';
$args = array( 'body' => array( 'key' => md5( 'meks' ), 'theme' => 'herald' ) );
$response = wp_remote_post( $url, $args );
if ( is_wp_error( $response ) ) {
set_transient( $transient, 'error', DAY_IN_SECONDS );
$json = wp_remote_retrieve_body( $response );
set_transient( $transient, 'error', DAY_IN_SECONDS );
$json = json_decode( $json );
if ( !isset( $json->data ) ) {
set_transient( $transient, 'error', DAY_IN_SECONDS );
set_transient( $transient, $json->data, DAY_IN_SECONDS );