• Resolved hagentertainment

    (@hagentertainment)


    I’m using a multi-directory setup. I have two directories at the moment, I will call them Apple and Orange. On the directory homepage, I see the tabs for the two directories. When I click on one, the URL looks similar to domain.com/directory/?directory_type=apples. I would like the URL to be domain.com/directory/apple. When I manually navigate to the second URL by typing it directly in my browser, I’m taken to an archive page that just shows the various excerpts from my listings in a stylized display and without any preview images or other labels/badges like Featured, New, etc. It doesn’t show the normal grid or list display.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @hagentertainment,

    I’m sorry, we’re unable to change that particular parameter, it is very important to have that parameter in the URL for dynamically loading contents.

    Regards,
    Mahdi.

    Thread Starter hagentertainment

    (@hagentertainment)

    Hello. I wanted to follow up because this is similar to another issue I have. I understand that the parameter is needed, but is there a way to get the URL to read in a prettier way. For instance, I’m sure something could be done by editing the htaccess modrewrite rules I’m just not sure how to set that up.

    Similarly, the related issue I am having is that my directory is located at domain.com/directory. I would like my submission page to be a child of that page and for the url to be domain.com/directory/submit. I create a page for the submission form and drop the appropriate shortcode in it and set the appropriate page in the Directorist plugin settings. However, if I set my directory base page as the parent page to the submission page, which produces the url I desire (domain.com/directory/submit), I receive a 404 error when trying to access the submission page. This is because Directorist is thinking that “submit” is the slug for one of my directories.

    Basically, the plugin needs to allow for some exceptions to the modrewrite rules to allow for more elegant and sensible URLs.

    Thread Starter hagentertainment

    (@hagentertainment)

    Hello. I think I am close to finding a way around the permalink issue.

    I’ve added the following code to my theme functions file.

    add_action( 'init', 'hag_rewrites_init' );
    function hag_rewrites_init(){
        add_rewrite_rule(
            'directory\/(podcasts|communities|shops)(\/?)$',
            'index.php?page_id=396102&directory_type=$matches[1]',
            'top' );
    }

    396102 is my directory page ID. Currently when someone goes to domain.com/podcasts they are shown my entire directory, which is nice- it’s a step above them seeing the unformated archive page. The issue is the page isn’t showing the listings for JUST the listing type I have specified (in this case “podcasts”). This is because the
    &directory_type=$matches[1]
    part of the string is incorrect. I believe I am using the wrong query variable. Maybe it should be something else instead of “directory_type”. It’s also possible that instead of passing the text slug of the listing type “podcasts”, I need to pass it’s numeric ID.

    Do you have any insight on how I can resolve this? I’m almost there.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Archive Page and Multi-Directory Permalink’ is closed to new replies.