Hi: I am trying to figure out how to ‘dynamically insert’ (if that is the right term!) a category name into the pagination code below:
Currently I am hard coding ‘home’ so that all pages with this category go from previous to next - and all works well - and other listed pages are not included in the pagination.
However I was wondering if there was a way to replace ‘home’ with the current category of the listed pages so I wouldn’t have to create separate templates, etc.
Sorry, let me explain a bit! An artwork portfolio site where I have categories created which can be checked off in the panel - that allow certain artworks to show up. So let’s say five artworks have the ‘home’ checkbox checked, and another five have ‘private view’ checked.
The following code grabs all the pages in the ‘home’ category.
<?php foreach ($privatePages = $pages->children()->filterby('categories', 'home', ',') as $artwork): ?>
And this is fine to have the category inserted manually.
This is the blueprint:
label: Visibility Section
privateview: private view
So on the front end - when someone clicks on the artwork link to the ‘detail page’, I want the ‘NEXT | PREVIOUS’ links (on the detail pages) to only show the pages listed within a certain category. I have it working if I hard code the category ‘home’ (for example) in this template code: