Filter page with content_custom

  • So I've used this to filter out the currently displayed post when showing other blog post thumbs at the bottom of a blog post page.



    On my portfolio site, I've set it up so I can create new pages which include a content template to fill in project details. At the bottom, I want to show 'more projects' thumbs, similar to the above, filtering out the currently displayed project. Since I can't use perch_get('s'), is there another way to grab an ID value from the template being pulled in further up the page?


    I'm trying to do something like this:

  • Hello Lee,


    On my portfolio site, I've set it up so I can create new pages which include a content template to fill in project details


    You may want to consider using a multiple-item region instead of pages.


    To create the region:

    PHP
    1. perch_content_create('Projects', [
    2. 'template' => 'project.html',
    3. 'multiple' => true,
    4. 'edit-mode' => 'listdetail',
    5. ]);


    Displaying a list of the projects would be similar to what you're used to in the Blog app:


    PHP
    1. perch_content_custom('Projects', [
    2. 'template' => 'projects_list.html',
    3. ]);


    And you can filter the list to exclude what you don't want:


    PHP
    1. perch_content_custom('Projects', [
    2. 'template' => 'projects_list.html',
    3. 'filter' => 'slug',
    4. 'match' => 'neq',
    5. 'value' => perch_get('s')
    6. ]);