: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
global $herald_unique_module_posts;
$module = wp_parse_args( $module, herald_get_module_defaults( $module['type'] ) );
$args['ignore_sticky_posts'] = 1;
if ( !empty( $module['manual'] ) ) {
$args['posts_per_page'] = absint( count( $module['manual'] ) );
$args['orderby'] = 'post__in';
$args['post__in'] = $module['manual'];
$args['post_type'] = array_keys( get_post_types( array( 'public' => true ) ) ); //support all existing public post types
$args['post_type'] = $module['type'];
$args['posts_per_page'] = absint( $module['limit'] );
$args['orderby'] = $module['order'];
if ( $args['orderby'] == 'views' && function_exists( 'ev_get_meta_key' ) ) {
$args['orderby'] = 'meta_value_num';
$args['meta_key'] = ev_get_meta_key();
} else if ( strpos( $args['orderby'], 'reviews' ) !== false && herald_is_wp_review_active() ) {
if ( strpos( $args['orderby'], 'user' ) !== false ) {
$review_type = substr( $args['orderby'], 13, strlen( $args['orderby'] ) );
$args['orderby'] = 'meta_value_num';
$args['meta_key'] = 'wp_review_user_reviews';
$args['meta_query'] = array(
'key' => 'wp_review_user_review_type',
$review_type = substr( $args['orderby'], 8, strlen( $args['orderby'] ) );
$args['orderby'] = 'meta_value_num';
$args['meta_key'] = 'wp_review_total';
$args['meta_query'] = array(
'key' => 'wp_review_type',
$args['order'] = $module['sort'];
if ( $time_diff = $module['time'] ) {
$args['date_query'] = array( 'after' => date( 'Y-m-d', herald_calculate_time_diff( $time_diff ) ) );
if ( !empty( $herald_unique_module_posts ) ) {
$args['post__not_in'] = $herald_unique_module_posts;
if ( !empty( $module['exclude_by_id'] ) ) {
if ( !empty( $args['post__not_in'] ) ) {
$args['post__not_in'] = array_unique( array_merge( $args['post__not_in'], $module['exclude_by_id'] ) ) ;
$args['post__not_in'] = $module['exclude_by_id'];
if ( !empty( $module['tax'] ) ) {
foreach ( $module['tax'] as $k => $v ) {
$temp['operator'] = $module["{$k}_inc_exc"] == 'not_in' ? 'NOT IN' : 'IN';
$args['tax_query'] = $taxonomies;
$args = apply_filters('herald_modify_cpt_module_query_args', $args ); //Allow child themes or plugins to modify
$query = new WP_Query( $args );
if ( $module['unique'] && !is_wp_error( $query ) && !empty( $query ) ) {
foreach ( $query->posts as $p ) {
$herald_unique_module_posts[] = $p->ID;
* @param string $layout Layout ID
* @return int Bootsrap col-lg ID
if ( !function_exists( 'herald_layout_columns' ) ):
function herald_layout_columns( $layout ) {
$layouts = apply_filters('herald_modify_layout_columns', $layouts ); //Allow child themes or plugins to modify
return $layouts[$layout];
* Check if we need to apply eq height class to specific posts module
if ( !function_exists( 'herald_module_is_eq_height' ) ):
function herald_module_is_eq_height( $module ) {
if ( !herald_module_is_combined( $module ) ) {
if ( ( herald_layout_columns( $module['starter_layout'] ) * $module['starter_limit'] ) % $module['columns'] ) {
if ( !function_exists( 'herald_get_module_class' ) ):
function herald_get_module_class( $module ) {
if ( $module['type'] == 'featured' ) {
$class = 'col-lg-12 col-md-12 col-sm-12';
$class = 'col-lg-' . $module['columns'] . ' col-md-' . $module['columns'] .' col-sm-' . $module['columns'];
if ( !empty( $module['css_class'] ) ) {
$class .= ' ' . $module['css_class'];
* Get posts from manually selected field in modules
* @param srting $post_ids - Selected posts ids from choose manually meta field
* @return array - List of selected posts or empty list
if ( !function_exists( 'herald_get_manually_selected_posts' ) ):
function herald_get_manually_selected_posts( $post_ids, $module_type = 'posts' ) {
if ( empty($post_ids) ) {
$post_type = in_array($module_type, array('posts', 'featured')) ? array_keys( get_post_types( array( 'public' => true ) ) ) : $module_type;
$get_selected_posts = get_posts(
'post_type' => $post_type,
return wp_list_pluck( $get_selected_posts, 'post_title', 'ID' );
* Display manualy selected posts
* @param array $posts - Array of manualy selected posts
* @return HTML - Title of manualy selected post
if ( !function_exists( 'herald_display_manually_selected_posts' ) ):
function herald_display_manually_selected_posts($posts) {
foreach ( $posts as $id => $title ){
$output .= '<span><button type="button" class="ntdelbutton" data-id="'. esc_attr($id) .'"><span class="remove-tag-icon"></span></button><span class="herald-searched-title">'. esc_html( $title ). '</span></span>';
echo wp_kses_post( $output );
* Used for getting post types with all taxonomies
if (!function_exists('herald_get_posts_types_with_taxonomies')):
function herald_get_posts_types_with_taxonomies( $exclude = array() ) {
$post_types_with_taxonomies = array();
$post_types = herald_get_custom_post_types( true, array( 'topic', 'forum', 'guest-author', 'reply' ) );
$post_types[] = get_post_type_object('post');
foreach ($post_types as $post_type) {
if(in_array($post_type->name, $exclude)){
$post_taxonomies = herald_get_taxonomies($post_type->name);
$post_type->taxonomies = $post_taxonomies;
$post_types_with_taxonomies[] = $post_type;
return apply_filters('herald_modify_posts_types_with_taxonomies', $post_types_with_taxonomies);
* Now when taxonomies are dynamical in cover area depending on post type we have to overwrite old settings.
* For Category to cat and for post_tag to tag
if(!function_exists('herald_patch_category_and_tags')):
function herald_patch_taxonomy_id($taxonomy_id){
if ( in_array( $taxonomy_id, array( 'category', 'post_tag' ) ) ) {
if ( $taxonomy_id === 'category' ) {
if ( $taxonomy_id === 'post_tag' ) {