不断出现语法错误,不确定原因。这是我正在使用的代码
function my_epl_listing_default_sort($query) {
// Do nothing if in dashboard or not an archive page
if ( is_admin() || ! $query->is_main_query() )
return;
// Do nothing if Easy Property Listings is not active
if ( ! function_exists( \'epl_all_post_types\' ) )
return;
// Do nothing if doing search
if ( epl_is_search() )
return;
/// Sort EPL listings by price on archive page
if ( is_post_type_archive( epl_all_post_types() == \'true\' ) ) {
$query->set( \'meta_key\', \'title\' );
$query->set( \'order\', \'ASC\' );
$query->set( \'orderby\', \'meta_value\' );
return;
}
}
add_action( \'pre_get_posts\', \'my_epl_listing_default_sort\' );