URLs No Longer "Hackable?"

This topic contains 11 replies, has 2 voices, and was last updated by  Guust 6 years, 12 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #377277

    kairei
    Expired Member
    Post count: 78

    I have a site with a listing detail URL for my custom “classes” CPT like this:

    http://naked.yoga/classes/canada/alberta/calgary/naked-yoga-yyc/

    I thought I could “hack off” any segment and have the URLs still work, showing any listings in the resulting city/region/country, but it doesn’t work and I think it used to. The above URL shows a detail page of a listing but:

    /classes/canada/alberta/calgary/naked-yoga-yyc/ Works fine
    /classes/canada/alberta/calgary/ Get a 404
    /classes/canada/alberta/ Get a 404
    /classes/canada/ Get a 404
    /classes/calgary/ Works fine
    /classes/ Works fine

    Are all of these supposed to work? Is there some setting or something I could have messed up?

    The ones that work seem to match the breadcrumbs which just shows “Home > Classes > Calgary” (and ideally this would have a breadcrumb for every URL segment in the longer URL with full location included but not sure if that is possible).

    Thanks!

    #377278

    Guust
    Moderator
    Post count: 29970

    I am guessing that you have changed the permalinks at GD Permalinks to exclude country and region from the URLs.
    You should not exclude country unless you only have listings in your default country. Same for regions.
    You can exclude locations altogether if you like.
    Thanks

    #377279

    kairei
    Expired Member
    Post count: 78

    Thanks for the quick reply. That was the first thing I checked (see screenshot – I assume the “Add location slug in listing urls” and “Add full location info with country, region and city slug in listing urls” being checked is what you mean). I changed those settings and then changed them back to see if re-saving would help. I also re-saved permalinks from WP settings. I also went back to using just the plain old GeoDirectory Framework to make sure my theme wasn’t messing something up. Any ideas?

    #377285

    Guust
    Moderator
    Post count: 29970

    The only URLs that will work are those linked on your site, after you save WP Permalinks. If you change some settings, all links may change to new URLs.
    Add a few more widgets that provide links and the location switcher.
    Thanks

    #377314

    kairei
    Expired Member
    Post count: 78

    I don’t understand… I added the location switcher, saved WP permalinks, and the same URLs mentioned above work and don’t work. Questions:

    1. What “widgets that provide links” do you suggest?

    2. I thought all those location URLs were sort of dynamic, i.e. whatever country/region/city URL comes in, you find the listings within those geographic areas. Are you saying we need to have hard coded links to each and every country/region/city and then save permalinks?

    3. If 2 is true, what would happen when a new listing in a new city is added live on the site?

    4. Is there any GD way to create such a list of links (I’d actually love a widget that shows a complete listing of all countries, regions, and cities that have listings in them in a tree structure).

    #377316

    kairei
    Expired Member
    Post count: 78

    And now I’m even more confused… I added [geodir_location_tab_switcher autoredirect=”1″] which I found in your support somewhere. I added it to a text widget in my sidebar. At first it seemed like it wasn’t working but now it does except the URLs have /location/ at the beginning instead of /classes/.

    /location/united-states/new-york/new-york/
    /location/united-states/new-york/
    /location/united-states/
    /location/

    All these work but I wanted it to be /classes/ instead of /location/ at the beginning so it matches the full listing URL which still starts with /classes/. So, I manually try those /classes/ links again and THEY NOW WORK! And, the breadcrumb is now magically showing all locations (country, region, city) just like I want. That is GREAT. However, the language switcher itself will use /location/ so it isn’t good to have duplicate URLs for each location.

    I also tried adding the location switcher to my menu but couldn’t get it to work. Not sure if doing this triggered anything.

    So two new questions:

    1. Is there some time delay/caching that makes it take a while for the location switcher to work?

    2. Can I change the location switcher to use /classes/ links?

    #377331

    Guust
    Moderator
    Post count: 29970

    Please review https://wpgeodirectory.com/docs/layout/#directory for the difference between Location/Home pages and Listings [classes] pages:

    Follow these steps:

    1. Add the popular category widget to your GD Home sections.

    2. Create a WP page and post the following shortcode:

    [gd_location_switcher]

    https://wpgeodirectory.com/docs/location-manager-shortcodes/#switch

    3. Add this shortcode to the same page:

    [gd_cpt_categories]

    https://wpgeodirectory.com/docs/core-shortcodes/#ctp-cats

    4. Visit that page > select a city or region > you will go to the location page > once there, select a category from the popular category widget.

    5. To add the location switcher to your menu, you need to select a menu at GD > design > Navigation
    https://wpgeodirectory.com/docs/multilocations/#main

    Hopefully that clarifies things better.

    #377339

    kairei
    Expired Member
    Post count: 78

    I just posted a long reply and then edited it and it went away. Tried to repost and it said it was a duplicate. Tried to view in separate browser and there were only 3 posts instead of the 7 I see here… not sure what is happening but can you see my previous reply?

    #377340

    kairei
    Expired Member
    Post count: 78

    Will try one more time… Here is the post that went away:

    Ok, thanks. So, I think I get the location/listing difference. I assume if I had multiple CPTs they’d all show up on location pages but only one specific CPT will show up on a listing page, “classes” in my case. So, in my case where I only have one CPT and don’t use “Places” or “Events” it seems duplicative, but really they are two separate things. Right?

    I tried adding the widgets, etc. as mentioned above and it seems fine, but it still hasn’t clarified why it took a while after I originally added the location switcher for my /classes/[country]/[region]/[city]/ URLs and breadcrumbs to start working and why they are even related to a location switcher given locations and listings are different… So, I’m just uncomfortable in specifically what needed to happen to make it all work. I’m happy they are working now but scared they may revert back to how it was before since I don’t really understand why they didn’t work and why they do work now.

    So, I still have these questions:

    1. Is it expected that adding the location switcher would make my CPT’s listing URLs and breadcrumbs start working?

    2. Now that they are working, do I need to keep the switcher active on the site for them to keep working?

    3. Is there some time delay/caching that makes it take a while for the location switcher to work?

    4. Will the city URL for a new city work immediately when a new listing is added live on the site?

    5. Is there any GD way to create a list of CPT listing links (e.g. a widget that shows a complete list, for a specific CPT, of all countries, regions, and cities that currently have listings in them in a tree structure). I know we have the locations switcher, but I want this just for my CPT and for the links to go to /classes/ URLs, not /locations/ URLs. E.g.

    United States links to /classes/united-states/
    California links to /classes/united-states/california/
    Los Angeles links to /classes/united-states/california/los-angeles/
    Sand Diego -links to /classes/united-states/california/san-diego/
    New York links to etc.
    New York
    Arizona
    Tucson
    Canada
    Alberta
    Calgary

    Thanks!

    #377377

    Guust
    Moderator
    Post count: 29970

    URLs probably started working because you re-saved WP permalinks.

    1. Is it expected that adding the location switcher would make my CPT’s listing URLs and breadcrumbs start working?
    URLs probably started working because you re-saved WP permalinks, and or reset some caching.
    The main benefit of the location switcher is that is allows your visitors to find things easier.

    2. Now that they are working, do I need to keep the switcher active on the site for them to keep working?
    I cannot see the location switcher on your site for the moment but things seem to work just fine.

    3. Is there some time delay/caching that makes it take a while for the location switcher to work?
    No, there is not. But if you change how the URLs are constructed, you are best to resave WP permalinks.

    4. Will the city URL for a new city work immediately when a new listing is added live on the site?
    Yes

    5. Is there any GD way to create a list of CPT listing links (e.g. a widget that shows a complete list, for a specific CPT, of all countries, regions, and cities that currently have listings in them in a tree structure). I know we have the locations switcher, but I want this just for my CPT and for the links to go to /classes/ URLs, not /locations/ URLs.
    GD’s navigation is based on visitors normally navigating to a location first before looking for listings; or alternatively using the GD search. There is no widget that creates automatic links to pages for a specific CPT, of all countries, regions, and cities.

    Most widgets are explained here: https://wpgeodirectory.com/docs/widgets/
    To create a list of all locations: https://wpgeodirectory.com/docs/location-manager-shortcodes/#switch
    To create a list of all CPTs and categories: https://wpgeodirectory.com/docs/widgets/#cpt-cats

    #377651

    kairei
    Expired Member
    Post count: 78

    Ok, thanks. Re #2, I removed it from the main sidebar but have a page with all the widgets so hopefully it will be fine. Thanks for all the help.

    #377668

    Guust
    Moderator
    Post count: 29970

    You’re welcome 🙂

Viewing 12 posts - 1 through 12 (of 12 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket