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: helpers.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* Debug (log) function
[3] Fix | Delete
*
[4] Fix | Delete
* Outputs any content into log file in theme root directory
[5] Fix | Delete
*
[6] Fix | Delete
* @param mixed $mixed Content to output
[7] Fix | Delete
* @since 1.0
[8] Fix | Delete
*/
[9] Fix | Delete
[10] Fix | Delete
if ( !function_exists( 'herald_log' ) ):
[11] Fix | Delete
function herald_log( $mixed ) {
[12] Fix | Delete
[13] Fix | Delete
if ( !function_exists( 'WP_Filesystem' ) || !WP_Filesystem() ) {
[14] Fix | Delete
return false;
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
if ( is_array( $mixed ) ) {
[18] Fix | Delete
$mixed = print_r( $mixed, 1 );
[19] Fix | Delete
} else if ( is_object( $mixed ) ) {
[20] Fix | Delete
ob_start();
[21] Fix | Delete
var_dump( $mixed );
[22] Fix | Delete
$mixed = ob_get_clean();
[23] Fix | Delete
}
[24] Fix | Delete
[25] Fix | Delete
global $wp_filesystem;
[26] Fix | Delete
$existing = $wp_filesystem->get_contents( get_parent_theme_file_path( 'log' ) );
[27] Fix | Delete
$wp_filesystem->put_contents( get_parent_theme_file_path( 'log' ), $existing. $mixed . PHP_EOL );
[28] Fix | Delete
}
[29] Fix | Delete
endif;
[30] Fix | Delete
[31] Fix | Delete
/**
[32] Fix | Delete
* Get option value from theme options
[33] Fix | Delete
*
[34] Fix | Delete
* A wrapper function for WordPress native get_option()
[35] Fix | Delete
* which gets an option from specific option key (set in theme options panel)
[36] Fix | Delete
*
[37] Fix | Delete
* @param string $option Name of the option
[38] Fix | Delete
* @return mixed Specific option value or "false" (if option is not found)
[39] Fix | Delete
* @since 1.0
[40] Fix | Delete
*/
[41] Fix | Delete
[42] Fix | Delete
if ( !function_exists( 'herald_get_option' ) ):
[43] Fix | Delete
function herald_get_option( $option ) {
[44] Fix | Delete
[45] Fix | Delete
global $herald_settings;
[46] Fix | Delete
[47] Fix | Delete
if ( empty( $herald_settings ) ) {
[48] Fix | Delete
$herald_settings = get_option( 'herald_settings' );
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
if ( !isset( $herald_settings[$option] ) ) {
[52] Fix | Delete
$herald_settings[$option] = herald_get_default_option( $option );
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
if ( isset( $herald_settings[$option] ) ) {
[56] Fix | Delete
return is_array( $herald_settings[$option] ) && isset( $herald_settings[$option]['url'] ) ? $herald_settings[$option]['url'] : $herald_settings[$option];
[57] Fix | Delete
} else {
[58] Fix | Delete
return false;
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
}
[62] Fix | Delete
endif;
[63] Fix | Delete
[64] Fix | Delete
/**
[65] Fix | Delete
* Get current post layout
[66] Fix | Delete
*
[67] Fix | Delete
* It checks which posts layout to display based on current template options
[68] Fix | Delete
*
[69] Fix | Delete
* @param int $i Index of the current post in loop
[70] Fix | Delete
* @return string Layout ID
[71] Fix | Delete
* @since 1.0
[72] Fix | Delete
*/
[73] Fix | Delete
[74] Fix | Delete
if ( !function_exists( 'herald_get_current_post_layout' ) ):
[75] Fix | Delete
function herald_get_current_post_layout( $i ) {
[76] Fix | Delete
[77] Fix | Delete
$layout = 'a'; //layout a as default
[78] Fix | Delete
$starter_limit = 0; //do not display starter layout by default
[79] Fix | Delete
[80] Fix | Delete
$herald_template = herald_detect_template();
[81] Fix | Delete
[82] Fix | Delete
if ( in_array( $herald_template, array( 'search', 'tag', 'author', 'archive' ) ) ) {
[83] Fix | Delete
[84] Fix | Delete
$layout = herald_get_option( $herald_template.'_layout' );
[85] Fix | Delete
$starter_layout = herald_get_option( $herald_template.'_starter_layout' );
[86] Fix | Delete
$starter_limit = $starter_layout != 'none' ? herald_get_option( $herald_template.'_starter_limit' ) : 0;
[87] Fix | Delete
[88] Fix | Delete
} else if ( $herald_template == 'category' ) {
[89] Fix | Delete
[90] Fix | Delete
$obj = get_queried_object();
[91] Fix | Delete
[92] Fix | Delete
if ( isset( $obj->term_id ) ) {
[93] Fix | Delete
[94] Fix | Delete
$meta = herald_get_category_meta( $obj->term_id );
[95] Fix | Delete
$layout = $meta['layout'] == 'inherit' ? herald_get_option( $herald_template.'_layout' ) : $meta['layout'];
[96] Fix | Delete
[97] Fix | Delete
if ( $meta['starter_layout'] != 'inherit' ) {
[98] Fix | Delete
$starter_layout = $meta['starter_layout'];
[99] Fix | Delete
$starter_limit = $starter_layout != 'none' ? $meta['starter_limit'] : 0;
[100] Fix | Delete
} else {
[101] Fix | Delete
$starter_layout = herald_get_option( $herald_template.'_starter_layout' );
[102] Fix | Delete
$starter_limit = $starter_layout != 'none' ? herald_get_option( $herald_template.'_starter_limit' ) : 0;
[103] Fix | Delete
}
[104] Fix | Delete
[105] Fix | Delete
}
[106] Fix | Delete
}
[107] Fix | Delete
[108] Fix | Delete
if ( !is_paged() && $starter_limit > $i ) {
[109] Fix | Delete
return $starter_layout;
[110] Fix | Delete
}
[111] Fix | Delete
[112] Fix | Delete
return $layout;
[113] Fix | Delete
}
[114] Fix | Delete
endif;
[115] Fix | Delete
[116] Fix | Delete
[117] Fix | Delete
/**
[118] Fix | Delete
* Get layout of single post
[119] Fix | Delete
*
[120] Fix | Delete
* It checks which layout to display for current single post
[121] Fix | Delete
*
[122] Fix | Delete
* @return string Layout ID
[123] Fix | Delete
* @since 1.0
[124] Fix | Delete
*/
[125] Fix | Delete
[126] Fix | Delete
if ( !function_exists( 'herald_get_single_layout' ) ):
[127] Fix | Delete
function herald_get_single_layout( $post_id = false ) {
[128] Fix | Delete
[129] Fix | Delete
$layout = herald_get_post_meta( $post_id, 'layout' );
[130] Fix | Delete
if ( $layout == 'inherit' ) {
[131] Fix | Delete
$layout = herald_get_option( 'single_layout' );
[132] Fix | Delete
}
[133] Fix | Delete
[134] Fix | Delete
if ( herald_is_paginated_post() && in_array( $layout, array( 3, 6, 9 ) ) ) {
[135] Fix | Delete
$layout -= 1;
[136] Fix | Delete
}
[137] Fix | Delete
[138] Fix | Delete
return $layout;
[139] Fix | Delete
}
[140] Fix | Delete
endif;
[141] Fix | Delete
[142] Fix | Delete
/**
[143] Fix | Delete
* Get position of meta bar for single post
[144] Fix | Delete
*
[145] Fix | Delete
* It checks which layout to display for current single post
[146] Fix | Delete
*
[147] Fix | Delete
* @return string Layout ID
[148] Fix | Delete
* @since 1.3
[149] Fix | Delete
*/
[150] Fix | Delete
[151] Fix | Delete
if ( !function_exists( 'herald_get_single_meta_bar_position' ) ):
[152] Fix | Delete
function herald_get_single_meta_bar_position() {
[153] Fix | Delete
[154] Fix | Delete
$layout = herald_get_post_meta( get_the_ID(), 'meta_bar_position' );
[155] Fix | Delete
if ( $layout == 'inherit' ) {
[156] Fix | Delete
$layout = herald_get_option( 'single_meta_bar_position' );
[157] Fix | Delete
}
[158] Fix | Delete
[159] Fix | Delete
return $layout;
[160] Fix | Delete
}
[161] Fix | Delete
endif;
[162] Fix | Delete
[163] Fix | Delete
[164] Fix | Delete
/**
[165] Fix | Delete
* Get layout for page
[166] Fix | Delete
*
[167] Fix | Delete
* It checks which layout to display for current page
[168] Fix | Delete
*
[169] Fix | Delete
* @return string Layout ID
[170] Fix | Delete
* @since 1.0
[171] Fix | Delete
*/
[172] Fix | Delete
[173] Fix | Delete
if ( !function_exists( 'herald_get_page_layout' ) ):
[174] Fix | Delete
function herald_get_page_layout( $post_id = false ) {
[175] Fix | Delete
[176] Fix | Delete
$layout = herald_get_page_meta( $post_id, 'layout' );
[177] Fix | Delete
[178] Fix | Delete
if ( $layout == 'inherit' ) {
[179] Fix | Delete
$layout = herald_get_option( 'page_layout' );
[180] Fix | Delete
}
[181] Fix | Delete
[182] Fix | Delete
return $layout;
[183] Fix | Delete
}
[184] Fix | Delete
endif;
[185] Fix | Delete
[186] Fix | Delete
[187] Fix | Delete
[188] Fix | Delete
/**
[189] Fix | Delete
* Get post meta data
[190] Fix | Delete
*
[191] Fix | Delete
* @param unknown $field specific option key
[192] Fix | Delete
* @return mixed meta data value or set of values
[193] Fix | Delete
* @since 1.0
[194] Fix | Delete
*/
[195] Fix | Delete
[196] Fix | Delete
if ( !function_exists( 'herald_get_post_meta' ) ):
[197] Fix | Delete
function herald_get_post_meta( $post_id = false, $field = false ) {
[198] Fix | Delete
[199] Fix | Delete
if ( empty( $post_id ) ) {
[200] Fix | Delete
$post_id = get_the_ID();
[201] Fix | Delete
}
[202] Fix | Delete
[203] Fix | Delete
$defaults = array(
[204] Fix | Delete
'layout' => 'inherit',
[205] Fix | Delete
'use_sidebar' => 'inherit',
[206] Fix | Delete
'sidebar' => 'inherit',
[207] Fix | Delete
'sticky_sidebar' => 'inherit',
[208] Fix | Delete
'meta_bar_position' => 'inherit',
[209] Fix | Delete
'display' => array(
[210] Fix | Delete
'fimg' => 'inherit',
[211] Fix | Delete
'headline' => 'inherit',
[212] Fix | Delete
'tags' => 'inherit',
[213] Fix | Delete
'author' => 'inherit',
[214] Fix | Delete
'sticky_bar' => 'inherit',
[215] Fix | Delete
'related' => 'inherit',
[216] Fix | Delete
'ad_above' => 1,
[217] Fix | Delete
'ad_below' => 1
[218] Fix | Delete
)
[219] Fix | Delete
);
[220] Fix | Delete
[221] Fix | Delete
$meta = get_post_meta( $post_id, '_herald_meta', true );
[222] Fix | Delete
$meta = herald_parse_args( $meta, $defaults );
[223] Fix | Delete
[224] Fix | Delete
[225] Fix | Delete
if ( $field ) {
[226] Fix | Delete
if ( isset( $meta[$field] ) ) {
[227] Fix | Delete
return $meta[$field];
[228] Fix | Delete
} else {
[229] Fix | Delete
return false;
[230] Fix | Delete
}
[231] Fix | Delete
}
[232] Fix | Delete
[233] Fix | Delete
return $meta;
[234] Fix | Delete
}
[235] Fix | Delete
endif;
[236] Fix | Delete
[237] Fix | Delete
[238] Fix | Delete
/**
[239] Fix | Delete
* Get page meta data
[240] Fix | Delete
*
[241] Fix | Delete
* @param unknown $field specific option key
[242] Fix | Delete
* @return mixed meta data value or set of values
[243] Fix | Delete
* @since 1.0
[244] Fix | Delete
*/
[245] Fix | Delete
[246] Fix | Delete
if ( !function_exists( 'herald_get_page_meta' ) ):
[247] Fix | Delete
function herald_get_page_meta( $post_id = false, $field = false ) {
[248] Fix | Delete
[249] Fix | Delete
if ( empty( $post_id ) ) {
[250] Fix | Delete
$post_id = get_the_ID();
[251] Fix | Delete
}
[252] Fix | Delete
[253] Fix | Delete
$defaults = array(
[254] Fix | Delete
'layout' => 'inherit',
[255] Fix | Delete
'use_sidebar' => 'inherit',
[256] Fix | Delete
'sidebar' => 'inherit',
[257] Fix | Delete
'sticky_sidebar' => 'inherit',
[258] Fix | Delete
'sections' => array(),
[259] Fix | Delete
'pag' => 'none',
[260] Fix | Delete
'authors' => array(
[261] Fix | Delete
'orderby' => 'post_count',
[262] Fix | Delete
'order' => 'DESC',
[263] Fix | Delete
'exclude' => '',
[264] Fix | Delete
'roles' => array()
[265] Fix | Delete
),
[266] Fix | Delete
);
[267] Fix | Delete
[268] Fix | Delete
$meta = get_post_meta( $post_id, '_herald_meta', true );
[269] Fix | Delete
$meta = herald_parse_args( $meta, $defaults );
[270] Fix | Delete
[271] Fix | Delete
[272] Fix | Delete
if ( $field ) {
[273] Fix | Delete
if ( isset( $meta[$field] ) ) {
[274] Fix | Delete
return $meta[$field];
[275] Fix | Delete
} else {
[276] Fix | Delete
return false;
[277] Fix | Delete
}
[278] Fix | Delete
}
[279] Fix | Delete
[280] Fix | Delete
return $meta;
[281] Fix | Delete
}
[282] Fix | Delete
endif;
[283] Fix | Delete
[284] Fix | Delete
[285] Fix | Delete
/**
[286] Fix | Delete
* Get category meta data
[287] Fix | Delete
*
[288] Fix | Delete
* @param unknown $field specific option key
[289] Fix | Delete
* @return mixed meta data value or set of values
[290] Fix | Delete
* @since 1.0
[291] Fix | Delete
*/
[292] Fix | Delete
[293] Fix | Delete
if ( !function_exists( 'herald_get_category_meta' ) ):
[294] Fix | Delete
function herald_get_category_meta( $cat_id = false, $field = false ) {
[295] Fix | Delete
$defaults = array(
[296] Fix | Delete
'layout' => 'inherit',
[297] Fix | Delete
'use_sidebar' => 'inherit',
[298] Fix | Delete
'sidebar' => 'inherit',
[299] Fix | Delete
'sticky_sidebar' => 'inherit',
[300] Fix | Delete
'starter_layout' => 'inherit',
[301] Fix | Delete
'starter_limit' => herald_get_option( 'category_starter_limit' ),
[302] Fix | Delete
'fa_layout' => 'inherit',
[303] Fix | Delete
'color_type' => 'inherit',
[304] Fix | Delete
'color' => herald_get_option( 'color_content_acc' ),
[305] Fix | Delete
'pag' => 'inherit',
[306] Fix | Delete
'ppp' => 'inherit',
[307] Fix | Delete
'ppp_num' => herald_get_option( 'category_ppp' ) == 'inherit' ? get_option( 'posts_per_page' ) : herald_get_option( 'category_ppp_num' ),
[308] Fix | Delete
'image' => ''
[309] Fix | Delete
);
[310] Fix | Delete
[311] Fix | Delete
if ( $cat_id ) {
[312] Fix | Delete
$meta = get_option( '_herald_category_'.$cat_id );
[313] Fix | Delete
$meta = wp_parse_args( (array) $meta, $defaults );
[314] Fix | Delete
} else {
[315] Fix | Delete
$meta = $defaults;
[316] Fix | Delete
}
[317] Fix | Delete
[318] Fix | Delete
if ( $field ) {
[319] Fix | Delete
if ( isset( $meta[$field] ) ) {
[320] Fix | Delete
return $meta[$field];
[321] Fix | Delete
} else {
[322] Fix | Delete
return false;
[323] Fix | Delete
}
[324] Fix | Delete
}
[325] Fix | Delete
[326] Fix | Delete
return $meta;
[327] Fix | Delete
}
[328] Fix | Delete
endif;
[329] Fix | Delete
[330] Fix | Delete
/**
[331] Fix | Delete
* Get current pagination
[332] Fix | Delete
*
[333] Fix | Delete
* It checks which pagination type to display based on current template options
[334] Fix | Delete
*
[335] Fix | Delete
* @return string|bool Pagination layout or false if there is no pagination
[336] Fix | Delete
* @since 1.0
[337] Fix | Delete
*/
[338] Fix | Delete
[339] Fix | Delete
if ( !function_exists( 'herald_get_current_pagination' ) ):
[340] Fix | Delete
function herald_get_current_pagination() {
[341] Fix | Delete
[342] Fix | Delete
global $wp_query;
[343] Fix | Delete
[344] Fix | Delete
if ( $wp_query->max_num_pages <= 1 ) {
[345] Fix | Delete
return false;
[346] Fix | Delete
}
[347] Fix | Delete
[348] Fix | Delete
$layout = 'numeric'; //layout numeric as default
[349] Fix | Delete
[350] Fix | Delete
$herald_template = herald_detect_template();
[351] Fix | Delete
[352] Fix | Delete
if ( in_array( $herald_template, array( 'search', 'tag', 'author', 'archive' ) ) ) {
[353] Fix | Delete
[354] Fix | Delete
$layout = herald_get_option( $herald_template.'_pag' );
[355] Fix | Delete
[356] Fix | Delete
} else if ( $herald_template == 'category' ) {
[357] Fix | Delete
[358] Fix | Delete
$obj = get_queried_object();
[359] Fix | Delete
[360] Fix | Delete
if ( isset( $obj->term_id ) ) {
[361] Fix | Delete
$meta = herald_get_category_meta( $obj->term_id );
[362] Fix | Delete
$layout = $meta['pag'] == 'inherit' ? herald_get_option( $herald_template.'_pag' ) : $meta['pag'];
[363] Fix | Delete
}
[364] Fix | Delete
[365] Fix | Delete
}
[366] Fix | Delete
[367] Fix | Delete
return $layout;
[368] Fix | Delete
}
[369] Fix | Delete
endif;
[370] Fix | Delete
[371] Fix | Delete
/**
[372] Fix | Delete
* Numeric pagination
[373] Fix | Delete
*
[374] Fix | Delete
* @param string $prev Previous link text
[375] Fix | Delete
* @param string $next Next link text
[376] Fix | Delete
* @return string Pagination HTML output or empty string
[377] Fix | Delete
* @since 1.0
[378] Fix | Delete
*/
[379] Fix | Delete
[380] Fix | Delete
if ( !function_exists( 'herald_numeric_pagination' ) ):
[381] Fix | Delete
function herald_numeric_pagination( $prev = '&lsaquo;', $next = '&rsaquo;' ) {
[382] Fix | Delete
global $wp_query, $wp_rewrite;
[383] Fix | Delete
$wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;
[384] Fix | Delete
$pagination = array(
[385] Fix | Delete
'base' => @add_query_arg( 'paged', '%#%' ),
[386] Fix | Delete
'format' => '',
[387] Fix | Delete
'total' => $wp_query->max_num_pages,
[388] Fix | Delete
'current' => $current,
[389] Fix | Delete
'prev_text' => $prev,
[390] Fix | Delete
'next_text' => $next,
[391] Fix | Delete
'type' => 'plain'
[392] Fix | Delete
);
[393] Fix | Delete
if ( $wp_rewrite->using_permalinks() )
[394] Fix | Delete
$pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' );
[395] Fix | Delete
[396] Fix | Delete
if ( !empty( $wp_query->query_vars['s'] ) )
[397] Fix | Delete
$pagination['add_args'] = array( 's' => str_replace( ' ', '+', get_query_var( 's' ) ) );
[398] Fix | Delete
[399] Fix | Delete
$links = paginate_links( $pagination );
[400] Fix | Delete
[401] Fix | Delete
return empty( $links ) ? '' : $links;
[402] Fix | Delete
}
[403] Fix | Delete
endif;
[404] Fix | Delete
[405] Fix | Delete
[406] Fix | Delete
/**
[407] Fix | Delete
* Get author social links
[408] Fix | Delete
*
[409] Fix | Delete
* @param int $author_id ID of an author/user
[410] Fix | Delete
* @return string HTML output of social links
[411] Fix | Delete
* @since 1.0
[412] Fix | Delete
*/
[413] Fix | Delete
[414] Fix | Delete
if ( !function_exists( 'herald_get_author_social' ) ):
[415] Fix | Delete
function herald_get_author_social( $author_id ) {
[416] Fix | Delete
[417] Fix | Delete
$output = '';
[418] Fix | Delete
[419] Fix | Delete
if ( $url = get_the_author_meta( 'url', $author_id ) ) {
[420] Fix | Delete
$output .= '<a href="'.esc_url( $url ).'" target="_blank" class="fa fa-link"></a>';
[421] Fix | Delete
}
[422] Fix | Delete
[423] Fix | Delete
$social = herald_get_social();
[424] Fix | Delete
[425] Fix | Delete
if ( !empty( $social ) ) {
[426] Fix | Delete
foreach ( $social as $id => $name ) {
[427] Fix | Delete
if ( $social_url = get_the_author_meta( $id, $author_id ) ) {
[428] Fix | Delete
[429] Fix | Delete
if ( $id == 'twitter' ) {
[430] Fix | Delete
$pos = strpos( $social_url, '@' );
[431] Fix | Delete
if($pos !== false){
[432] Fix | Delete
$social_url = 'https://twitter.com/'.substr( $social_url, $pos, strlen( $social_url ) );
[433] Fix | Delete
}
[434] Fix | Delete
}
[435] Fix | Delete
[436] Fix | Delete
$output .= '<a href="'.esc_url( $social_url ).'" target="_blank" class="fa fa-'.$id.'"></a>';
[437] Fix | Delete
}
[438] Fix | Delete
}
[439] Fix | Delete
}
[440] Fix | Delete
[441] Fix | Delete
return $output;
[442] Fix | Delete
}
[443] Fix | Delete
endif;
[444] Fix | Delete
[445] Fix | Delete
[446] Fix | Delete
/**
[447] Fix | Delete
* Get trending posts
[448] Fix | Delete
*
[449] Fix | Delete
* @return object WP_Query
[450] Fix | Delete
* @since 1.0
[451] Fix | Delete
*/
[452] Fix | Delete
[453] Fix | Delete
if ( !function_exists( 'herald_get_trending_posts' ) ):
[454] Fix | Delete
function herald_get_trending_posts( $post_id = false ) {
[455] Fix | Delete
[456] Fix | Delete
$args['ignore_sticky_posts'] = 1;
[457] Fix | Delete
[458] Fix | Delete
$manual = herald_get_option( 'trending_manual' );
[459] Fix | Delete
[460] Fix | Delete
if ( !empty( $manual ) ) {
[461] Fix | Delete
[462] Fix | Delete
$manual = array_map( 'absint', explode( ",", $manual ) );
[463] Fix | Delete
$args['posts_per_page'] = absint( count( $manual ) );
[464] Fix | Delete
$args['orderby'] = 'post__in';
[465] Fix | Delete
$args['post__in'] = $manual;
[466] Fix | Delete
$args['post_type'] = array_keys( get_post_types( array( 'public' => true ) ) ); //support all existing public post types
[467] Fix | Delete
[468] Fix | Delete
} else {
[469] Fix | Delete
[470] Fix | Delete
$number_of_posts = herald_get_option('trending_slider') == true ? herald_get_option('trending_slider_post') : herald_get_option('trending_number');
[471] Fix | Delete
[472] Fix | Delete
$args['post_type'] = 'post';
[473] Fix | Delete
$args['posts_per_page'] = $number_of_posts;
[474] Fix | Delete
$args['orderby'] = herald_get_option( 'trending_order' );
[475] Fix | Delete
[476] Fix | Delete
if ( $args['orderby'] == 'views' && function_exists( 'ev_get_meta_key' ) ) {
[477] Fix | Delete
[478] Fix | Delete
$args['orderby'] = 'meta_value_num';
[479] Fix | Delete
$args['meta_key'] = ev_get_meta_key();
[480] Fix | Delete
[481] Fix | Delete
} else if ( strpos( $args['orderby'], 'reviews' ) !== false && herald_is_wp_review_active() ) {
[482] Fix | Delete
[483] Fix | Delete
if ( strpos( $args['orderby'], 'user' ) !== false ) {
[484] Fix | Delete
[485] Fix | Delete
$review_type = substr( $args['orderby'], 13, strlen( $args['orderby'] ) );
[486] Fix | Delete
[487] Fix | Delete
$args['orderby'] = 'meta_value_num';
[488] Fix | Delete
$args['meta_key'] = 'wp_review_user_reviews';
[489] Fix | Delete
[490] Fix | Delete
$args['meta_query'] = array(
[491] Fix | Delete
array(
[492] Fix | Delete
'key' => 'wp_review_user_review_type',
[493] Fix | Delete
'value' => $review_type,
[494] Fix | Delete
)
[495] Fix | Delete
);
[496] Fix | Delete
[497] Fix | Delete
} else {
[498] Fix | Delete
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function