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

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../themes/herald/core
File: modules.php
[500] Fix | Delete
}
[501] Fix | Delete
endif;
[502] Fix | Delete
[503] Fix | Delete
[504] Fix | Delete
[505] Fix | Delete
[506] Fix | Delete
/**
[507] Fix | Delete
* Get module heading
[508] Fix | Delete
*
[509] Fix | Delete
* Function gets heading/title html for current module
[510] Fix | Delete
*
[511] Fix | Delete
* @param array $module Module data
[512] Fix | Delete
* @return string HTML output
[513] Fix | Delete
* @since 1.0
[514] Fix | Delete
*/
[515] Fix | Delete
[516] Fix | Delete
if ( !function_exists( 'herald_get_module_heading' ) ):
[517] Fix | Delete
function herald_get_module_heading( $module ) {
[518] Fix | Delete
[519] Fix | Delete
$args = array();
[520] Fix | Delete
$sub_cats = array();
[521] Fix | Delete
[522] Fix | Delete
if ( !empty( $module['cat'] ) && count( $module['cat'] ) == 1 && $module['cat_inc_exc'] == 'in') {
[523] Fix | Delete
$args['cat'] = $module['cat'][0];
[524] Fix | Delete
}
[525] Fix | Delete
[526] Fix | Delete
if ( isset( $args['cat'] ) && isset( $module['cat_nav'] ) && !empty( $module['cat_nav'] ) ) {
[527] Fix | Delete
$sub_cats = get_categories( array( 'parent' => $args['cat'], 'hide_empty' => false ) );
[528] Fix | Delete
if ( !empty( $sub_cats ) ) {
[529] Fix | Delete
$args['subnav'] = '';
[530] Fix | Delete
foreach ( $sub_cats as $child ) {
[531] Fix | Delete
$args['subnav'] .= '<a href="'.esc_url( get_category_link( $child ) ).'">'.$child->name.'</a>';
[532] Fix | Delete
}
[533] Fix | Delete
}
[534] Fix | Delete
}
[535] Fix | Delete
[536] Fix | Delete
if ( !empty( $module['title'] ) && empty( $module['hide_title'] ) ) {
[537] Fix | Delete
[538] Fix | Delete
$icon_responsive_class = !empty( $sub_cats ) ? 'herald-mobile-hidden' : '';
[539] Fix | Delete
[540] Fix | Delete
if ( !empty( $module['title_link'] ) ) {
[541] Fix | Delete
$module['title'] = '<a href="'.esc_url( $module['title_link'] ).'">'.$module['title'].'<i class="fa fa-chevron-right '.$icon_responsive_class.'"></i></a>';
[542] Fix | Delete
}
[543] Fix | Delete
[544] Fix | Delete
if ( !empty( $sub_cats ) ) {
[545] Fix | Delete
$module['title'] .= '<i class="fa fa-angle-down herald-sub-cat-icon" aria-hidden="true"></i><div class="herald-mod-subnav-mobile">'.$args['subnav'].'</div>';
[546] Fix | Delete
}
[547] Fix | Delete
[548] Fix | Delete
$args['title'] = '<h2 class="h6 herald-mod-h herald-color">'.$module['title'].'</h2>';
[549] Fix | Delete
[550] Fix | Delete
}
[551] Fix | Delete
[552] Fix | Delete
$args['actions'] = '';
[553] Fix | Delete
[554] Fix | Delete
if ( isset( $module['more_text'] ) && !empty( $module['more_text'] ) && !empty( $module['more_url'] ) ) {
[555] Fix | Delete
$args['actions'].= '<a class="herald-all-link" href="'.esc_url( $module['more_url'] ).'">'.$module['more_text'].'</a>';
[556] Fix | Delete
}
[557] Fix | Delete
[558] Fix | Delete
if ( herald_module_is_slider( $module ) ) {
[559] Fix | Delete
$args['actions'].= '<div class="herald-slider-controls" data-col="'.esc_attr( herald_layout_columns( $module['layout'] ) ).'" data-autoplay="'.absint( $module['autoplay'] ).'"></div>';
[560] Fix | Delete
}
[561] Fix | Delete
[562] Fix | Delete
return !empty( $args ) ? herald_print_heading( $args ) : '';
[563] Fix | Delete
[564] Fix | Delete
}
[565] Fix | Delete
endif;
[566] Fix | Delete
[567] Fix | Delete
/**
[568] Fix | Delete
* Get module query
[569] Fix | Delete
*
[570] Fix | Delete
* @param array $module Module data
[571] Fix | Delete
* @return object WP_query
[572] Fix | Delete
* @since 1.0
[573] Fix | Delete
*/
[574] Fix | Delete
[575] Fix | Delete
if ( !function_exists( 'herald_get_module_query' ) ):
[576] Fix | Delete
function herald_get_module_query( $module, $paged = false ) {
[577] Fix | Delete
[578] Fix | Delete
global $herald_unique_module_posts;
[579] Fix | Delete
[580] Fix | Delete
$module = wp_parse_args( $module, herald_get_module_defaults( $module['type'] ) );
[581] Fix | Delete
[582] Fix | Delete
$args['ignore_sticky_posts'] = 1;
[583] Fix | Delete
[584] Fix | Delete
if ( !empty( $module['manual'] ) ) {
[585] Fix | Delete
[586] Fix | Delete
$args['posts_per_page'] = absint( count( $module['manual'] ) );
[587] Fix | Delete
$args['orderby'] = 'post__in';
[588] Fix | Delete
$args['post__in'] = $module['manual'];
[589] Fix | Delete
$args['post_type'] = array_keys( get_post_types( array( 'public' => true ) ) ); //support all existing public post types
[590] Fix | Delete
[591] Fix | Delete
} else {
[592] Fix | Delete
[593] Fix | Delete
$args['post_type'] = 'post';
[594] Fix | Delete
$args['posts_per_page'] = absint( $module['limit'] );
[595] Fix | Delete
[596] Fix | Delete
if ( !empty( $module['cat'] ) ) {
[597] Fix | Delete
[598] Fix | Delete
if ( $module['cat_child'] ) {
[599] Fix | Delete
$child_cat_temp = array();
[600] Fix | Delete
foreach ( $module['cat'] as $parent ) {
[601] Fix | Delete
$child_cats = get_categories( array( 'child_of' => $parent ) );
[602] Fix | Delete
if ( !empty( $child_cats ) ) {
[603] Fix | Delete
foreach ( $child_cats as $child ) {
[604] Fix | Delete
$child_cat_temp[] = $child->term_id;
[605] Fix | Delete
}
[606] Fix | Delete
}
[607] Fix | Delete
}
[608] Fix | Delete
$module['cat'] = array_merge( $module['cat'], $child_cat_temp );
[609] Fix | Delete
}
[610] Fix | Delete
[611] Fix | Delete
$args['category__'.$module['cat_inc_exc']] = $module['cat'];
[612] Fix | Delete
}
[613] Fix | Delete
[614] Fix | Delete
if ( !empty( $module['tag'] ) ) {
[615] Fix | Delete
$args['tag__'.$module['tag_inc_exc']] = herald_get_tax_term_id_by_slug( $module['tag'] );
[616] Fix | Delete
}
[617] Fix | Delete
[618] Fix | Delete
[619] Fix | Delete
$args['tax_query'] = array();
[620] Fix | Delete
[621] Fix | Delete
if ( !empty( $module['tax'] ) ) {
[622] Fix | Delete
$taxonomies = array();
[623] Fix | Delete
foreach ( $module['tax'] as $k => $v ) {
[624] Fix | Delete
$temp = array();
[625] Fix | Delete
$temp['fields'] = 'id';
[626] Fix | Delete
$temp['taxonomy'] = $k;
[627] Fix | Delete
$temp['terms'] = $v;
[628] Fix | Delete
$temp['operator'] = $module["{$k}_inc_exc"] == 'not_in' ? 'NOT IN' : 'IN';
[629] Fix | Delete
$taxonomies[] = $temp;
[630] Fix | Delete
}
[631] Fix | Delete
[632] Fix | Delete
$args['tax_query'] = $taxonomies;
[633] Fix | Delete
}
[634] Fix | Delete
[635] Fix | Delete
[636] Fix | Delete
if ( !empty( $module['author'] ) ) {
[637] Fix | Delete
$args['author__'.$module['author_inc_exc']] = $module['author'];
[638] Fix | Delete
}
[639] Fix | Delete
[640] Fix | Delete
if ( !empty( $module['format'] ) ) {
[641] Fix | Delete
[642] Fix | Delete
if ( $module['format'] == 'standard' ) {
[643] Fix | Delete
[644] Fix | Delete
$terms = array();
[645] Fix | Delete
$formats = get_theme_support( 'post-formats' );
[646] Fix | Delete
if ( !empty( $formats ) && is_array( $formats[0] ) ) {
[647] Fix | Delete
foreach ( $formats[0] as $format ) {
[648] Fix | Delete
$terms[] = 'post-format-'.$format;
[649] Fix | Delete
}
[650] Fix | Delete
}
[651] Fix | Delete
$operator = 'NOT IN';
[652] Fix | Delete
[653] Fix | Delete
} else {
[654] Fix | Delete
$terms = array( 'post-format-'.$module['format'] );
[655] Fix | Delete
$operator = 'IN';
[656] Fix | Delete
}
[657] Fix | Delete
[658] Fix | Delete
$args['tax_query'][] = array(
[659] Fix | Delete
'taxonomy' => 'post_format',
[660] Fix | Delete
'field' => 'slug',
[661] Fix | Delete
'terms' => $terms,
[662] Fix | Delete
'operator' => $operator
[663] Fix | Delete
);
[664] Fix | Delete
}
[665] Fix | Delete
[666] Fix | Delete
$args['orderby'] = $module['order'];
[667] Fix | Delete
[668] Fix | Delete
if ( $args['orderby'] == 'views' && function_exists( 'ev_get_meta_key' ) ) {
[669] Fix | Delete
[670] Fix | Delete
$args['orderby'] = 'meta_value_num';
[671] Fix | Delete
$args['meta_key'] = ev_get_meta_key();
[672] Fix | Delete
[673] Fix | Delete
} else if ( strpos( $args['orderby'], 'reviews' ) !== false && herald_is_wp_review_active() ) {
[674] Fix | Delete
[675] Fix | Delete
if ( strpos( $args['orderby'], 'user' ) !== false ) {
[676] Fix | Delete
[677] Fix | Delete
$review_type = substr( $args['orderby'], 13, strlen( $args['orderby'] ) );
[678] Fix | Delete
[679] Fix | Delete
$args['orderby'] = 'meta_value_num';
[680] Fix | Delete
$args['meta_key'] = 'wp_review_user_reviews';
[681] Fix | Delete
[682] Fix | Delete
$args['meta_query'] = array(
[683] Fix | Delete
array(
[684] Fix | Delete
'key' => 'wp_review_user_review_type',
[685] Fix | Delete
'value' => $review_type,
[686] Fix | Delete
)
[687] Fix | Delete
);
[688] Fix | Delete
[689] Fix | Delete
} else {
[690] Fix | Delete
[691] Fix | Delete
$review_type = substr( $args['orderby'], 8, strlen( $args['orderby'] ) );
[692] Fix | Delete
[693] Fix | Delete
$args['orderby'] = 'meta_value_num';
[694] Fix | Delete
$args['meta_key'] = 'wp_review_total';
[695] Fix | Delete
[696] Fix | Delete
$args['meta_query'] = array(
[697] Fix | Delete
array(
[698] Fix | Delete
'key' => 'wp_review_type',
[699] Fix | Delete
'value' => $review_type,
[700] Fix | Delete
)
[701] Fix | Delete
);
[702] Fix | Delete
}
[703] Fix | Delete
[704] Fix | Delete
}
[705] Fix | Delete
[706] Fix | Delete
if ( count( $args['tax_query'] ) > 1 ) {
[707] Fix | Delete
$args['tax_query']['relation'] = 'OR';
[708] Fix | Delete
}
[709] Fix | Delete
[710] Fix | Delete
$args['order'] = $module['sort'];
[711] Fix | Delete
[712] Fix | Delete
if ( $time_diff = $module['time'] ) {
[713] Fix | Delete
$args['date_query'] = array( 'after' => date( 'Y-m-d', herald_calculate_time_diff( $time_diff ) ) );
[714] Fix | Delete
}
[715] Fix | Delete
[716] Fix | Delete
if ( !empty( $herald_unique_module_posts ) ) {
[717] Fix | Delete
$args['post__not_in'] = $herald_unique_module_posts;
[718] Fix | Delete
}
[719] Fix | Delete
[720] Fix | Delete
if ( !empty( $module['exclude_by_id'] ) ) {
[721] Fix | Delete
[722] Fix | Delete
if ( !empty( $args['post__not_in'] ) ) {
[723] Fix | Delete
$args['post__not_in'] = array_unique( array_merge( $args['post__not_in'], $module['exclude_by_id'] ) ) ;
[724] Fix | Delete
} else {
[725] Fix | Delete
$args['post__not_in'] = $module['exclude_by_id'];
[726] Fix | Delete
}
[727] Fix | Delete
}
[728] Fix | Delete
[729] Fix | Delete
[730] Fix | Delete
}
[731] Fix | Delete
[732] Fix | Delete
if ( $paged ) {
[733] Fix | Delete
$args['paged'] = $paged;
[734] Fix | Delete
}
[735] Fix | Delete
[736] Fix | Delete
$args = apply_filters('herald_modify_module_query_args', $args ); //Allow child themes or plugins to modify
[737] Fix | Delete
[738] Fix | Delete
$query = new WP_Query( $args );
[739] Fix | Delete
[740] Fix | Delete
if ( $module['unique'] && !is_wp_error( $query ) && !empty( $query ) ) {
[741] Fix | Delete
[742] Fix | Delete
foreach ( $query->posts as $p ) {
[743] Fix | Delete
$herald_unique_module_posts[] = $p->ID;
[744] Fix | Delete
}
[745] Fix | Delete
}
[746] Fix | Delete
[747] Fix | Delete
return $query;
[748] Fix | Delete
[749] Fix | Delete
}
[750] Fix | Delete
endif;
[751] Fix | Delete
[752] Fix | Delete
/**
[753] Fix | Delete
* Get featured module query
[754] Fix | Delete
*
[755] Fix | Delete
* @param array $module Module data
[756] Fix | Delete
* @return object WP_query
[757] Fix | Delete
* @since 1.0
[758] Fix | Delete
*/
[759] Fix | Delete
[760] Fix | Delete
if ( !function_exists( 'herald_get_featured_module_query' ) ):
[761] Fix | Delete
function herald_get_featured_module_query( $module ) {
[762] Fix | Delete
[763] Fix | Delete
global $herald_unique_module_posts;
[764] Fix | Delete
[765] Fix | Delete
$module = wp_parse_args( $module, herald_get_module_defaults( $module['type'] ) );
[766] Fix | Delete
[767] Fix | Delete
$args['ignore_sticky_posts'] = 1;
[768] Fix | Delete
[769] Fix | Delete
if ( !empty( $module['manual'] ) ) {
[770] Fix | Delete
[771] Fix | Delete
$args['orderby'] = 'post__in';
[772] Fix | Delete
$args['post__in'] = $module['manual'];
[773] Fix | Delete
$args['post_type'] = array_keys( get_post_types( array( 'public' => true ) ) ); //support all existing public post types
[774] Fix | Delete
[775] Fix | Delete
} else {
[776] Fix | Delete
[777] Fix | Delete
$args['post_type'] = $module['post_type'];
[778] Fix | Delete
$post_type_with_taxonomies = herald_get_post_type_with_taxonomies($module['post_type']);
[779] Fix | Delete
$args['posts_per_page'] = absint( herald_get_featured_area_numposts( $module['layout'] ) );
[780] Fix | Delete
[781] Fix | Delete
if(!empty($post_type_with_taxonomies->taxonomies)){
[782] Fix | Delete
foreach ( $post_type_with_taxonomies->taxonomies as $taxonomy ) {
[783] Fix | Delete
$taxonomy_id = herald_patch_taxonomy_id($taxonomy['id']);
[784] Fix | Delete
[785] Fix | Delete
if(empty($module[$taxonomy_id . '_inc_exc']) || empty($module[$taxonomy_id])){
[786] Fix | Delete
continue;
[787] Fix | Delete
}
[788] Fix | Delete
[789] Fix | Delete
$operator = $module[$taxonomy_id . '_inc_exc'] === 'not_in' ? 'NOT IN' : 'IN';
[790] Fix | Delete
[791] Fix | Delete
if($taxonomy['hierarchical']){
[792] Fix | Delete
$include_children = !empty($module[$taxonomy_id . '_child']) ? boolval($module[$taxonomy_id . '_child']) : false;
[793] Fix | Delete
$args['tax_query'][] = array(
[794] Fix | Delete
'taxonomy' => $taxonomy['id'],
[795] Fix | Delete
'field' => 'id',
[796] Fix | Delete
'terms' => $module[$taxonomy_id],
[797] Fix | Delete
'operator' => $operator,
[798] Fix | Delete
'include_children' => $include_children
[799] Fix | Delete
);
[800] Fix | Delete
}else{
[801] Fix | Delete
$args['tax_query'][] = array(
[802] Fix | Delete
'taxonomy' => $taxonomy['id'],
[803] Fix | Delete
'field' => 'id',
[804] Fix | Delete
'terms' => herald_get_tax_term_id_by_slug( $module[$taxonomy_id], $taxonomy['id']),
[805] Fix | Delete
'operator' => $operator
[806] Fix | Delete
);
[807] Fix | Delete
}
[808] Fix | Delete
}
[809] Fix | Delete
}
[810] Fix | Delete
[811] Fix | Delete
if ( !empty( $module['author'] ) ) {
[812] Fix | Delete
$args['author__'.$module['author_inc_exc']] = $module['author'];
[813] Fix | Delete
}
[814] Fix | Delete
[815] Fix | Delete
if ( !empty( $module['format'] ) && $module['post_type'] == 'post' ) {
[816] Fix | Delete
[817] Fix | Delete
if ( $module['format'] == 'standard' ) {
[818] Fix | Delete
[819] Fix | Delete
$terms = array();
[820] Fix | Delete
$formats = get_theme_support( 'post-formats' );
[821] Fix | Delete
if ( !empty( $formats ) && is_array( $formats[0] ) ) {
[822] Fix | Delete
foreach ( $formats[0] as $format ) {
[823] Fix | Delete
$terms[] = 'post-format-'.$format;
[824] Fix | Delete
}
[825] Fix | Delete
}
[826] Fix | Delete
$operator = 'NOT IN';
[827] Fix | Delete
[828] Fix | Delete
} else {
[829] Fix | Delete
$terms = array( 'post-format-'.$module['format'] );
[830] Fix | Delete
$operator = 'IN';
[831] Fix | Delete
}
[832] Fix | Delete
[833] Fix | Delete
$args['tax_query'][] =
[834] Fix | Delete
array(
[835] Fix | Delete
'taxonomy' => 'post_format',
[836] Fix | Delete
'field' => 'slug',
[837] Fix | Delete
'terms' => $terms,
[838] Fix | Delete
'operator' => $operator
[839] Fix | Delete
);
[840] Fix | Delete
}
[841] Fix | Delete
[842] Fix | Delete
$args['orderby'] = $module['order'];
[843] Fix | Delete
[844] Fix | Delete
if ( $args['orderby'] == 'views' && function_exists( 'ev_get_meta_key' ) ) {
[845] Fix | Delete
$args['orderby'] = 'meta_value_num';
[846] Fix | Delete
$args['meta_key'] = ev_get_meta_key();
[847] Fix | Delete
} else if ( strpos( $args['orderby'], 'reviews' ) !== false && herald_is_wp_review_active() ) {
[848] Fix | Delete
[849] Fix | Delete
if ( strpos( $args['orderby'], 'user' ) !== false ) {
[850] Fix | Delete
[851] Fix | Delete
$review_type = substr( $args['orderby'], 13, strlen( $args['orderby'] ) );
[852] Fix | Delete
[853] Fix | Delete
$args['orderby'] = 'meta_value_num';
[854] Fix | Delete
$args['meta_key'] = 'wp_review_user_reviews';
[855] Fix | Delete
[856] Fix | Delete
$args['meta_query'] = array(
[857] Fix | Delete
array(
[858] Fix | Delete
'key' => 'wp_review_user_review_type',
[859] Fix | Delete
'value' => $review_type,
[860] Fix | Delete
)
[861] Fix | Delete
);
[862] Fix | Delete
[863] Fix | Delete
} else {
[864] Fix | Delete
[865] Fix | Delete
$review_type = substr( $args['orderby'], 8, strlen( $args['orderby'] ) );
[866] Fix | Delete
[867] Fix | Delete
$args['orderby'] = 'meta_value_num';
[868] Fix | Delete
$args['meta_key'] = 'wp_review_total';
[869] Fix | Delete
[870] Fix | Delete
$args['meta_query'] = array(
[871] Fix | Delete
array(
[872] Fix | Delete
'key' => 'wp_review_type',
[873] Fix | Delete
'value' => $review_type,
[874] Fix | Delete
)
[875] Fix | Delete
);
[876] Fix | Delete
}
[877] Fix | Delete
[878] Fix | Delete
}
[879] Fix | Delete
[880] Fix | Delete
$args['order'] = $module['sort'];
[881] Fix | Delete
[882] Fix | Delete
if ( $time_diff = $module['time'] ) {
[883] Fix | Delete
$args['date_query'] = array( 'after' => date( 'Y-m-d', herald_calculate_time_diff( $time_diff ) ) );
[884] Fix | Delete
}
[885] Fix | Delete
[886] Fix | Delete
if ( !empty( $herald_unique_module_posts ) ) {
[887] Fix | Delete
$args['post__not_in'] = $herald_unique_module_posts;
[888] Fix | Delete
}
[889] Fix | Delete
[890] Fix | Delete
if ( !empty( $module['exclude_by_id'] ) ) {
[891] Fix | Delete
[892] Fix | Delete
if ( !empty( $args['post__not_in'] ) ) {
[893] Fix | Delete
$args['post__not_in'] = array_unique( array_merge( $args['post__not_in'], $module['exclude_by_id'] ) ) ;
[894] Fix | Delete
} else {
[895] Fix | Delete
$args['post__not_in'] = $module['exclude_by_id'];
[896] Fix | Delete
}
[897] Fix | Delete
}
[898] Fix | Delete
}
[899] Fix | Delete
[900] Fix | Delete
$args = apply_filters('herald_modify_featured_module_query_args', $args ); //Allow child themes or plugins to modify
[901] Fix | Delete
[902] Fix | Delete
$query = new WP_Query( $args );
[903] Fix | Delete
[904] Fix | Delete
if ( $module['unique'] && !is_wp_error( $query ) && !empty( $query ) ) {
[905] Fix | Delete
[906] Fix | Delete
foreach ( $query->posts as $p ) {
[907] Fix | Delete
$herald_unique_module_posts[] = $p->ID;
[908] Fix | Delete
}
[909] Fix | Delete
}
[910] Fix | Delete
[911] Fix | Delete
return $query;
[912] Fix | Delete
[913] Fix | Delete
}
[914] Fix | Delete
endif;
[915] Fix | Delete
[916] Fix | Delete
/**
[917] Fix | Delete
* Get module products query
[918] Fix | Delete
*
[919] Fix | Delete
* @param array $module Module data
[920] Fix | Delete
* @return object WP_query
[921] Fix | Delete
* @since 1.0
[922] Fix | Delete
*/
[923] Fix | Delete
[924] Fix | Delete
if ( !function_exists( 'herald_get_module_products_query' ) ):
[925] Fix | Delete
function herald_get_module_products_query( $module ) {
[926] Fix | Delete
[927] Fix | Delete
$module = wp_parse_args( $module, herald_get_module_defaults( $module['type'] ) );
[928] Fix | Delete
[929] Fix | Delete
$args['ignore_sticky_posts'] = 1;
[930] Fix | Delete
[931] Fix | Delete
if ( !empty( $module['manual'] ) ) {
[932] Fix | Delete
[933] Fix | Delete
$args['posts_per_page'] = absint( count( $module['manual'] ) );
[934] Fix | Delete
$args['orderby'] = 'post__in';
[935] Fix | Delete
$args['post__in'] = $module['manual'];
[936] Fix | Delete
$args['post_type'] = 'product';
[937] Fix | Delete
[938] Fix | Delete
} else {
[939] Fix | Delete
[940] Fix | Delete
$args['post_type'] = 'product';
[941] Fix | Delete
$args['posts_per_page'] = absint( $module['limit'] );
[942] Fix | Delete
[943] Fix | Delete
$args['tax_query'] = array();
[944] Fix | Delete
[945] Fix | Delete
if ( !empty( $module['cat'] ) ) {
[946] Fix | Delete
$args['tax_query'][] = array(
[947] Fix | Delete
'taxonomy' => 'product_cat',
[948] Fix | Delete
'field' => 'term_id',
[949] Fix | Delete
'terms' => $module['cat'],
[950] Fix | Delete
'operator' => $module["cat_inc_exc"] == 'not_in' ? 'NOT IN' : 'IN'
[951] Fix | Delete
);
[952] Fix | Delete
}
[953] Fix | Delete
[954] Fix | Delete
if ( !empty( $module['tag'] ) ) {
[955] Fix | Delete
$args['tax_query'][] = array(
[956] Fix | Delete
'taxonomy' => 'product_tag',
[957] Fix | Delete
'field' => 'slug',
[958] Fix | Delete
'terms' => $module['tag'],
[959] Fix | Delete
'operator' => $module["tag_inc_exc"] == 'not_in' ? 'NOT IN' : 'IN'
[960] Fix | Delete
);
[961] Fix | Delete
}
[962] Fix | Delete
[963] Fix | Delete
if ( count( $args['tax_query'] ) > 1 ) {
[964] Fix | Delete
$args['tax_query']['relation'] = 'AND';
[965] Fix | Delete
}
[966] Fix | Delete
[967] Fix | Delete
$args['orderby'] = $module['order'];
[968] Fix | Delete
[969] Fix | Delete
if ( $args['orderby'] == 'views' && function_exists( 'ev_get_meta_key' ) ) {
[970] Fix | Delete
$args['orderby'] = 'meta_value_num';
[971] Fix | Delete
$args['meta_key'] = ev_get_meta_key();
[972] Fix | Delete
}
[973] Fix | Delete
[974] Fix | Delete
if ( $time_diff = $module['time'] ) {
[975] Fix | Delete
$args['date_query'] = array( 'after' => date( 'Y-m-d', herald_calculate_time_diff( $time_diff ) ) );
[976] Fix | Delete
}
[977] Fix | Delete
[978] Fix | Delete
}
[979] Fix | Delete
[980] Fix | Delete
$args = apply_filters('herald_modify_products_module_query_args', $args ); //Allow child themes or plugins to modify
[981] Fix | Delete
[982] Fix | Delete
$query = new WP_Query( $args );
[983] Fix | Delete
[984] Fix | Delete
return $query;
[985] Fix | Delete
[986] Fix | Delete
}
[987] Fix | Delete
endif;
[988] Fix | Delete
[989] Fix | Delete
/**
[990] Fix | Delete
* Get module cpt query
[991] Fix | Delete
*
[992] Fix | Delete
* @param array $module Module data
[993] Fix | Delete
* @return object WP_query
[994] Fix | Delete
* @since 1.6
[995] Fix | Delete
*/
[996] Fix | Delete
[997] Fix | Delete
if ( !function_exists( 'herald_get_module_cpt_query' ) ):
[998] Fix | Delete
function herald_get_module_cpt_query( $module, $paged = false ) {
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function