Store Locator Plus® for WordPress Forums Premier Support Change store_page URL structure to store page category slug

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #45455
    Wolfram
    Participant

    Hi, I posted this already in the free forum, but unfortunately this doesn’t seem to get solved there, so I’m, forced to use paid support ….. how does this work? I ordered 3-day support, a few days doesnt really matter for us, I only want to get this solved eventually….

    See my post below (https://wp.storelocatorplus.com/forums/topic/change-permalink-of-pages-to-category-name/#post-45452):

    I only want to change the permalink for Store Page – nothing else. I’m very familiar with how permalinks work in WordPress, but as mentioned above… my aim is to cahnge the STORE PAGE url structure (which is set under Store Locator Plus -> Pages -> Permalink starts with) – if you leave this field empty, then a default “store_page” is inserted in between the domain name and location name, i.e.

    http://www.myurl.xy/store_page/location_name    —- here, location_name is taken from sl_store – so far so good.

    I want:

    http://www.myurl.xy/name-of-the-STORE-PAGE-category/location_name

    so this has nothing to do with normal WordPress categories but the categories set under the Power plugin features.

    So, the default

    http://www.myurl.xy/store_page/location_name

    is set in

    wp-content/plugins/slp-power/include/pages/class.admin.pages.php
    line 338 or line 480 (or both) – this is HARDCODED.

    So, I’d really appreciate help here what to change here to it takes the category slugs of the STORE PAGE categories…………

    P.S.: This doesn’t seem a request too far off, so I’m a little concerned to have to use paid support for this (since the Power and Experience plugins are quite a few bucks of money….) – I can wait a few days, but I’ve seen much more advanced topics being answered here in the forum……. and this might surely be of interest to everyone who uses store pages and store page categories.

    #45475
    Lance Cleveland
    Keymaster

    You are asking for help in hacking the production code of Store Locator Plus, so yes, this is way outside of normal support channels.    For Premier Members we do give some latitude on what we answer and helping “bend the product”.      I’ll take a look at the code in question but keep in mind that when you change this you will NOT be able to perform updates of the Power add on in the future and that there may be versions of the base plugin that will not be compatible with the current 4.7.6 release of Power.  You’ll need to decide if you want to take this on.

     

    Also , since you know about Permalinks, you also know you will need to flush the entire permalinks table every time you update, change, or delete a category.  You’ll also risk having issues with caching plugins and web crawlers if you do not flush the permalinks table every time you update locations in a way that impacts categories in any way (add a location to a category, remove one from a category, etc.).   Since Permalinks are cached and they impact the entire site this flush and rebuilding of the index can be a major performance impact on the site during the time the rebuild is going on.

    Just some things to keep in mind.

    I’ll take a look at the code soon and provide some hints, but if the site you are deploying is planning to stay on production cycle Store Locator Plus this is something  you should consider having customized and added as a production feature as part of our Premier plugin.

    #45476
    Lance Cleveland
    Keymaster

    Those two lines you cited have NOTHING to do with the permalink URL.

    Those settings are based on the custom page type we use to register locations with WordPress.  In fact we should probably change those lines to use the SLPlus::locationPostType constant but since it is not broken, not reason to modify it.

    The SLPPower_Pages class in SLPPower_Pages.php is what determines the permalink structure via the modify_storepage_attributes method. You can set it to any fixed string using the Pages admin tab “Permalink Starts With” setting.

    This is hooked to Store Locator Plus via the SLP slp_storepage_attributes filter. That filter changes the page attributes registered to WordPress core when the SLPlus::locationPostType (store_page) custom page type is registered. It does this by modifying the page attributes array.

    This changes the permalink in WordPress by changing the page attributes before it is registered to WordPress core with the register_post_type() function. That function is part of WordPress core and sets up custom page types and determines how they interact with the rest of the WordPress architecture.

    What you are asking is to change a core attribute of a registered WordPress post type on a per-page basis. You CANNOT do this by manipulating the register_post_type attribute array. The proper way to handle this is by intercepting the rewrite rules built into WordPress OR by going “higher up the chain” and creating your own URL rewrite rules either via Apache mod_rewrite or the equivalent in other web servers such as nginx.

    Getting into how to modify the WordPress Permalink interfaces or how to configure and modify the web server rewrite rules is out of the scope of support for Store Locator Plus. It is possible but it is an extensive topic that requires in-depth coding knowledge and is an entire instructional lesson in-and-of-itself.

    You need to be looking outside of the Store Locator Plus application stack and start looking at building your own plugin with Permalink interfaces. Without spending a day or two digging into this I can only come up with some theory on architecture options. I’d start by using the custom taxonomy for Store Locator Plus registered as SLPlus::locationPostType and use WP Core functions to query for all categories registered to that post type. Then run through that array and register permalinks for all those post types and link directly to the WordPress URL for displaying that category list. By doing this you can let the WordPress theme take over from there and avoid building custom pages in code and let the WordPress template system handle it.

    This is not a feature built into Store Locator Plus by default and I strongly advise either crafting your own plugin to do this or hiring us to lay out the customization and make it a standard product. In essence we’d be doing the same thing but extending an existing plugin to provide that code.

    To give you an idea on cost, this is likely a 3 or 4 code-day project with a $1500-$2000 budget.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.