Action executed after each directory in a directory page.
The {-name}
tag allows the hook to run on the specified directory name without having to write conditions. You can find the directory name in the JReviews Directories Manager. The following variations are allowed:
-
template_directory:after-directory
- runs for all directories
-
template_directory:after-directory-city-guide
- runs on the city-guide directory
Parameters
$directory
$instance
(MyView) instance of current view class
You need to have a working knowledge of Hooks before you get started.
Boilerplate Code
Use the boilerplate code to start using the filter, and add your own logic to modify the first argument and return it.
Clickfwd\Hook\Action::add('template_directory:after-directory{-name}', function($directory, $instance)
{
// Execute action or echo output
});
Development & Support
Customizations are not included with support. We provide this information to make it easier for developers to extend the functionality. From time to time we may have some availability for custom work. Get in touch to see if there's an opportunity to work together.
Examples
Most recent listings below directory page using shortcodes
Clickfwd\Hook\Action::add('template_directory:after-directory', function($directory)
{
$dirId = $directory['Directory']['dir_id'];
$title = $directory['Directory']['title'];
?>
<h2>Most recent in <?php echo $title; ?></h2>
[jreviews type="listings"
dir="<?php echo $dirId; ?>"
listing_order="rdate"
themelayout="postcard"
orientation="native-scroll"
limit="10"
]
<?php
}, 10);
Source
-
/views/themes/default/directories/directory.thtml