Jump to content

Chris FP

Starter
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Chris FP

  1. Hi all, new to the forum and to ProcessWire. I've been spending some time looking into documentation and the available forum questions previously posted 

    but I cannot seem to get it to work. I suspect it's probably a combination of the template not living off the root and that the child is 2 levels down.

    Below is code I've added to _init.php

    wire()->addHookBefore('Page::path', function($event) {
      $page = $event->object;
      if($page->template == 'portfolio-single-page') {
        // ensure that pages with template 'post' live off the root rather than '/posts/'
        $event->replace = true;
        $event->return = "/$page->name/";
      }
    });

    The structure of my page is as follows

    FULL PAGE URL - /our-projects/video-commercials/aerial-photography-videography/

    /our-projects/ - portfolio-page.php

    /our-projects/video-commercials/ - portfolio-category-page.php

    /our-projects/video-commercials/aerial-photography-videography/ - portfolio-single-page.php

     

    Right now I want to simply remove the parents from the child url and have /our-projects/video-commercials/aerial-photography-videography/ go to /aerial-photography-videography/ (unique)

    Is this possible?

×
×
  • Create New...