--- wp-sitemap-page.php.orig 2020-07-13 11:48:56.611539910 +0200
+++ wp-sitemap-page.php 2020-07-13 11:50:42.255291217 +0200
@@ -527,7 +527,7 @@
$cpt = get_post_type_object( $only_cpt );
if ( !empty($cpt) ) {
- return wsp_return_content_type_cpt_items( $is_title_displayed, $display_nofollow, $cpt, $only_cpt, $wsp_exclude_pages, $sort );
+ return wsp_return_content_type_cpt_items( $is_title_displayed, $display_nofollow, $cpt, $only_cpt, $wsp_exclude_pages, $sort, $order );
}
// check if it's a taxonomy
@@ -919,9 +919,10 @@
* @param str $post_type
* @param str $wsp_exclude_pages
* @param str $sort
+ * @param str $order
* @return str $return
*/
-function wsp_return_content_type_cpt_items( $is_title_displayed=true, $display_nofollow=false, $cpt, $post_type, $wsp_exclude_pages, $sort=null ) {
+function wsp_return_content_type_cpt_items( $is_title_displayed=true, $display_nofollow=false, $cpt, $post_type, $wsp_exclude_pages, $sort=null, $order=null ) {
// init
$return = '';
@@ -940,10 +941,14 @@
$args['exclude'] = $wsp_exclude_pages;
}
- // change the sort order
+ // change the sort field
if ($sort!==null) {
$args['orderby'] = $sort;
}
+ // change the sort order
+ if ($order!==null) {
+ $args['order'] = $order;
+ }
// Query to get the current custom post type
$posts_cpt = get_posts( $args );