Store Locator Plus® for WordPress › Forums › Store Locator Plus › Change permalink of pages to category name
- This topic has 9 replies, 2 voices, and was last updated 7 years, 9 months ago by Cici.
-
AuthorPosts
-
February 28, 2017 at 11:17 AM #45261WolframParticipant
Hi!
I would like to change pages permalink to contain the category a page is in, which is set under “Store Locator Plus” -> Pages -> Permalinks start withI’d also like to know if it is possible to set this to the category a page is sorted to, i.e.
http://www.myurl.xy/name-of-category-of-location/store-name
as a default it is set to
http://www.myurl.xy/(blog)/store-page/storename
Can any shortcode be used in field “Permalinks start with” …..? Or do I have to edit core files?
Thanks!
March 6, 2017 at 1:12 PM #45358March 7, 2017 at 3:04 AM #45382WolframParticipantHi Cici,
hmm this link is for the store page display/layout only, I’d like to know how to edit admin under
“Store Locator Plus” -> Pages -> “Permalinks start with”
field to output the name of the category a store page is sorted to….. so the final storepage url would be:
http://www.myurl.xy/name-of-category-of-location/location_name
March 9, 2017 at 4:58 PM #45426CiciKeymasterHow to change Permalinks , first you cannot have a conditional”ifset” or shortcode reference in a permalink. You can read about changing permalinks and how to customize them in WordPress
https://codex.wordpress.org/Settings_Permalinks_Screen
March 13, 2017 at 3:08 AM #45443WolframParticipanttest
March 13, 2017 at 3:11 AM #45444WolframParticipantYes, so maybe I can somehow hardcode it? But I need help here – I think it must be somewhere done in
…wp-content/plugins/slp-power/include/pages/class.admin.pages.php
line 338 or line 480 (sorry the editor here won’t let me paste code, your Sucuri firewall pops up….)
since here the default “store_page” is set if you don’t enter anything in backend settings for “permalinks start with” field (i.e. if you leave it empty).
Any help here how/where to replace this so it gets the category (slug) by default?
Thanks!
March 13, 2017 at 2:35 PM #45450March 13, 2017 at 2:59 PM #45452CiciKeymasterhttps://docs.storelocatorplus.com/blog/seo-pages/
The [storepage] shortcode works for STORE Pages only. It allows any field from the base Store Locator Plus locations table to be output on the page. You must specify a field to output by using the field attribute. For example [storepage field=”sl_store”].
As far as “HardCODE” a permalink, my understanding of how the permalink works (link I provided you to the WordPress permalinks section), you can do that if you follow their instructions and the SEO Pages instructions.
P.S. Premier customers are answered first in the Premier forums by the developer, schedule permitting. If you cannot find the answer in the WP support about permalinks or SLP documentation and/or you are not sure about how to code for your particular specifications, I am afraid I cannot help you in this particular forum. The SLP forum is for general questions. Most answers are in the documentation or in the You Tube tutorials. Otherwise, if you need one- on- one help from the developer sooner then you may wish to opt for PAID SUPPORT.
March 14, 2017 at 1:30 AM #45453WolframParticipantI only want to change the permalink for Store Page – nothing else. I’m ver y 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.
March 16, 2017 at 1:30 PM #45487CiciKeymasterYou were helped by the developer, and this is a much more advanced topic then what is considered regular support in this forum. I will post the developers answer here for you so that we can close out this support post.
“You are asking for help in hacking the production code of Store Locator Plus, so yes, this is ….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…
(continuance of Lances explanation for others who may be curious about a feature or customization build….)
“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 budge”
-
AuthorPosts
- The topic ‘Change permalink of pages to category name’ is closed to new replies.