Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • I’m also interested in this functionality. We are going to use this plugin to color code events coming from about 20 different institutions, many of which won’t have events all the time. @joshpaynedesigns , did you come up with a solution?

    Ah, figured it out for anyone that’s interested. The order variable never gets passed to the custom post type items function. To fix this you need to add the $order variable here in the plugin’s wp-sitemap-page.php file (edits have ‘strong’ tags around them… don’t copy the strong tags into the php code):

    if ( !empty($cpt) ) {
    				return wsp_return_content_type_cpt_items( $is_title_displayed, $display_nofollow, $cpt, $only_cpt, $wsp_exclude_pages, $sort, <strong>$order</strong> );
    			}

    Then within the wsp_return_content_type_cpt_items function (edits have ‘strong’ tags around them… don’t copy the strong tags into the php code):

    function wsp_return_content_type_cpt_items( $is_title_displayed=true, $display_nofollow=false, $cpt, $post_type, $wsp_exclude_pages, $sort=null, <strong>$order=null</strong> ) {
    
    	// init
    	$return = '';
    
    	// List the pages
    	$list_pages = '';
    
    	// define the way the pages should be displayed
    	$args = array();
    	$args['post_type'] = $post_type;
    	$args['posts_per_page'] = 999999;
    	$args['suppress_filters'] = 0;
    
    	// exclude some pages ?
    	if (!empty($wsp_exclude_pages)) {
    		$args['exclude'] = $wsp_exclude_pages;
    	}
    
    	// change the sort order
    	if ($sort!==null) {
    		$args['orderby'] = $sort;
    	}
    
    	<strong>if ($order!==null){
    		$args['order'] = $order;
    	}</strong>
    
    	// Query to get the current custom post type
    	$posts_cpt = get_posts( $args );
    
    	// display a nofollow attribute ?
    	$attr_nofollow = ($display_nofollow==true ? ' rel="nofollow"' : '');
    
    	// List all the results
    	if ( !empty($posts_cpt) ) {
    		foreach( $posts_cpt as $post_cpt ) {
    			$list_pages .= '<li><a href="'.get_permalink( $post_cpt->ID ).'"'.$attr_nofollow.'>'.$post_cpt->post_title.'</a></li>'."\n";
    		}
    	}
    
    	// Return the data (if it exists)
    	if (!empty($list_pages)) {
    		if ($is_title_displayed==true) {
    			$return .= '<h2 class="wsp-'.$post_type.'s-title">' . $cpt->label . '</h2>'."\n";
    		}
    		$return .= '<ul class="wsp-'.$post_type.'s-list">'."\n";
    		$return .= $list_pages;
    		$return .= '</ul>'."\n";
    	}
    
    	// return content
    	return apply_filters( 'wsp_cpts_return', $return );
    }

    Here is the sample output: https://visithillsboroughnc.aclients.com/site-map/

    The top Things to Do section is using the [wp_sitemap_page only=”things_to_do” sort=”post_title” order=”ASC”] shortcode.

    The bottom Things to Do section is using the [wp_sitemap_page only=”things_to_do” sort=”post_title” order=”DESC”] shortcode.

    Any help is greatly appreciated!
    Thanks!

    I’m having this same issue. I’ve tried the following shortcodes, and it displays the posts from Z -> A both ways.

    [wp_sitemap_page only=”things_to_do” sort=”post_title” order=”ASC”]
    [wp_sitemap_page only=”things_to_do” sort=”post_title” order=”DESC”]

    Here is the sample output: https://visithillsboroughnc.aclients.com/site-map/

    The top Things to Do section is using the [wp_sitemap_page only=”things_to_do” sort=”post_title” order=”ASC”] shortcode.

    The bottom Things to Do section is using the [wp_sitemap_page only=”things_to_do” sort=”post_title” order=”DESC”] shortcode.

    Any help is greatly appreciated!
    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)