March 14, 2017 at 1:39 AM #45455March 15, 2017 at 10:29 AM #45475
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.March 15, 2017 at 11:53 AM #45476
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.
You must be logged in to reply to this topic.