Can Map Page have same permalink as Store Pages?

Home Forums Store Locator Plus Can Map Page have same permalink as Store Pages?

This topic contains 7 replies, has 3 voices, and was last updated by  Cici 1 year, 1 month ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #35139

    Nathan
    Participant

    I’ve got the store pages permalink setup to be start with “locations”. So the URLs are working fine like:

    /locations/store-1/, /locations/store-2/, etc/

    I tried creating a page with a permalink of /locations/ and added the [SLPLUS] shortcode. However my map page 404s after I save and load it.

    #35141

    Nathan
    Participant

    Like it works if I change the page slug to “test-page”, but I’d like the URL hierarchy to make sense if I can. I understand development, so if it’s not a feature of the plugin UI but can be done, that would be helpful.

    #35158

    Nathan
    Participant

    Also I was wrong. It doesn’t throw a 404. It returns status 200, however it’s loading my index.php and not my page.php file. The have_posts()  method returns false in the index.php, which is why I get the Page not found warning.

    #35167

    Piani
    Participant

    Hi Nathan

    You need to provide information abut your SLP environment to get a correct answer. You find it under SLP > Info > Plugin Environment tab. Read more on the forum guide.

    I had a similar problem when setting up Pages and the short answer is “no you cant have the same name” as you describe. I had a conflict with the URL hierarchy so I needed to change this to another.

    #35183

    Nathan
    Participant

    Thanks Piani.

    I am actually able to get the same /locations/ permalink working for the map page that matches the Store Pages as well. The only problem I am trying to figure out now is why the meta data from Yoast (title & meta desc aren’t loading properly). From what I can tell, on page load, WordPress thinks the page is an archive, even though it’s post_type in the DB and on query is = ‘page’. Some weird piece of meta data is labeling it as an archive page, so my meta description doesn’t show up, and the title is “Pages – My Test Domain”

    #35184

    Piani
    Participant

    Yes, this is the behaviours that is happening for me too when trying using the same. Maby Lance can explain in more detail what is happening “under the hood” to use this properly. I just changed it to a similar but different name to solve it quick so I cant help you more for now.

    #35191

    Nathan
    Participant

    So this is what I did to get it to work. Keep in mind, I haven’t tested this 100% to make sure it didn’t mess up any other pages on my site.

    I hooked into these two plugin filters:

    add_filter(‘slp_storepage_attributes’, array($this, ‘remove_rewrite_slug’));

    add_filter(‘slp_results_marker_data’, array($this, ‘modify_store_page_url’));

    On the first, I removed the rewrite parameter from the array. On the second, I do a string replace on any array element that is a URL from store_page to locations.

    Then finally I implemented two new rewrite rules to handle the map page and store page requests. So far, it looks like it works. But again, this is not fully tested that it doesn’t break anything else or accepts URL parameters, etc.

    $rules = array(

    ‘locations/(.+?)/?$’                                => ‘index.php?store_page=$matches[1]’,

    ‘locations/?$’                                      => ‘index.php?pagename=locations’,

    );

    #35335

    Cici
    Keymaster

    @nathan

    @piani

     

    There is a page user who posted in the forums, I have tried to give him suggestions, I am not sure if his issues are with Pages or WPML translations or Templates or all. I mentioned searching the forums for answers. Also his posted screenshot of his page template doesnt look right to me, but what do I know…

    If either of you have suggestions , or the time , to help him could you?

    His post is here

    /forums/topic/short-code-not-working-after-updating-the-store-pages-plugin/

     

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

You must be logged in to reply to this topic.