Listing Category Showing Default on Sitemaps

Listing & Directory WordPress Theme
https://listgo.wiloke.com/
User avatar
pirateS
Site Admin
Posts: 6820
Joined: Wed Nov 05, 2014 11:49 am
Contact:

Re: Listing Category Showing Default on Sitemaps

Postby pirateS » Fri Jan 12, 2018 5:23 am

Hi
Did you replace the old code with my new code?

CodeColon Select All Code

function listgo_wpseo_sitemap_entry($url, $type, $oTerm){
   global $wiloke;

   if ( $type == 'term' ){
      if ( is_array($url) ){
         $realUrl = $url['loc'];
      }else{
         $realUrl = $url;
      }

      if ( strpos($realUrl, 'listing-location') !== false ){
         if ( !empty($wiloke->aThemeOptions['custom_listing_location_slug']) ){
            $replace = trim($wiloke->aThemeOptions['custom_listing_location_slug']);
            $target = '/listing-location/';
         }
      }elseif (strpos($realUrl, 'listing-cat') !== false) {
         if ( !empty($wiloke->aThemeOptions['custom_listing_cat_slug']) ){
            $replace = trim($wiloke->aThemeOptions['custom_listing_cat_slug']);
            $target = '/listing-cat/';
         }
      }elseif ( strpos($realUrl, 'listing-tag') !== false ) {
         if ( !empty($wiloke->aThemeOptions['custom_listing_tag_slug']) ){
            $replace = trim($wiloke->aThemeOptions['custom_listing_tag_slug']);
            $target = '/listing-tag/';
         }
      }
   }elseif($type == 'post'){
      if ( is_array($url) ){
         $realUrl = $url['loc'];
      }else{
         $realUrl = $url;
      }
     
      if ( strpos($realUrl, '/listing/') !== false ){
         if ( !empty($wiloke->aThemeOptions['custom_listing_single_slug']) ){
            $replace = trim($wiloke->aThemeOptions['custom_listing_single_slug']);
            $target = '/listing/';
         }
      }
   }

   if ( isset($replace) ){
      $realUrl = str_replace($target, '/'.$replace.'/', $realUrl);
      if ( is_array($url) ){
         $url['loc'] = $realUrl;
      }else{
         $url = $realUrl;
      }
   }

   return $url;
}


Don't forget to click Settings -> Permalinks -> Save Changes as well.

kandersen
Posts: 173
Joined: Tue Nov 07, 2017 5:55 pm
Contact:

Re: Listing Category Showing Default on Sitemaps

Postby kandersen » Fri Jan 12, 2018 5:15 pm Supported Until: Tue May 08 16:12:21 +1000 2018

@pirateS, my mistake. It is working indeed. My apologies for the confusion. Thank you for fixing this!

Image

User avatar
pirateS
Site Admin
Posts: 6820
Joined: Wed Nov 05, 2014 11:49 am
Contact:

Re: Listing Category Showing Default on Sitemaps

Postby pirateS » Sat Jan 13, 2018 10:23 am

Glad to help!

t347s
Posts: 183
Joined: Tue Aug 29, 2017 2:46 am
Contact:

Re: Listing Category Showing Default on Sitemaps

Postby t347s » Mon Jan 15, 2018 7:45 pm

Hi,
Tested with the last version of ListGo (1.6.2) and it's working! Hurray! Finally!

Proposal: implement the possibility to modify/change the slug also to "event".

Thank you!

User avatar
pirateS
Site Admin
Posts: 6820
Joined: Wed Nov 05, 2014 11:49 am
Contact:

Re: Listing Category Showing Default on Sitemaps

Postby pirateS » Tue Jan 16, 2018 10:19 pm

Okay, I will do that.


Return to “ListGo”

Who is online

Users browsing this forum: No registered users and 3 guests