Forum Replies Created

Viewing 5 replies - 16 through 20 (of 20 total)
  • Thread Starter resqonline

    (@resqonline)

    thanks so much for your help, I am having another go at this in the next days and hopefully will find a way to get this working

    Thread Starter resqonline

    (@resqonline)

    This is really weird… now I managed to rewrite the Apartment URL with

    add_rewrite_rule('^all-locations/([^/]*)/([^/]*)/([^/]*)$', 'index.php?apartment=$matches[3]', 'top');

    the important part is the ^ at the beginning, otherwise this doesn’t work. Also I only matched the 3rd part and removed all other matching rules because it woulnd’t work.

    However, the link for the property post type now doesn’t get created correctly, the weird thing is, with the intended url /all-locations/locationname/propertyname I actually get the correct template, but the permalinks apparently don’t get the term slug… this worked before, no idea why it doesn’t work now…

    the rewrite rule for the property is now:
    add_rewrite_rule('^all-locations/([^/]*)/([^/]*)$','index.php?property=$matches[2]','top');
    once again with ^ at the beginning. When I remove this ^ then the apartment link (see above) doesn’t work.

    This is really frustrating!

    • This reply was modified 7 years, 7 months ago by resqonline.
    Thread Starter resqonline

    (@resqonline)

    Of course I have a index.php file, I meant in the url, when I set it to standard permalinks there is no index.php in my urls.

    Okay so I have to add query vars inside the templates itself… was hoping it would work without that, makes everything so much more complicated ??

    Thread Starter resqonline

    (@resqonline)

    I am actually not sure about the rewrite rules. For ugly permalinks it’s okay if there is only /?property=something or /?apartment=something. It’s only the nice urls that don’t work correctly, and I don’t have any index.php as in all the examples…
    It’s pretty confusing… all explanations that I found so far were different, so no idea how to actually set this up correctly

    I used the Query Monitor plugin to figure out the rewrite rules and have added the following rewrite rules:

    add_rewrite_rule('all-locations/([^/]+)/?$', 'property-location=$matches[1]', 'top');
        add_rewrite_rule('all-locations/([^&]+)/([^&]+)/?$','location=$matches[1]&property=$matches[2]','top');
        add_rewrite_rule('all-locations/([^&]+)/([^&]+)/([^/]+)/?$','location=$matches[1]&property=$matches[2]&apartment=$matches[3]','top');

    I tried both top and bottom, no difference.

    The first one for the location rewrites the url but the taxonomy template (taxonomy-property-location.php) is not used, instead the blog page is shown.
    The second one for the property works, it gets the correct single-property.php template file.
    The third for apartment rewrites the url, but once again wrong template file. is_single() and is_singluar() both are true, but it doesn’t get the template single-apartment.php but the single-property.php

    Not sure how to proceed from here…

    For all the email messages it would be better to use esc_textarea instead of sanitize_text_field – this way the emails look nice

    I am using WP Better Emails on my sites and now the messages sent from the BP Registration Options plugin are displayed nicely in the email template ??

Viewing 5 replies - 16 through 20 (of 20 total)