Created
November 4, 2018 04:25
-
-
Save juanpasolano/03d9fb37049a41e9d0f992a799cd5547 to your computer and use it in GitHub Desktop.
Add custom url to sage 9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<php | |
add_filter('template_include', function ($template) { | |
$data = collect(get_body_class())->reduce(function ($data, $class) use ($template) { | |
return apply_filters("sage/template/{$class}/data", $data, $template); | |
}, []); | |
$url_path = trim(parse_url(add_query_arg(array()), PHP_URL_PATH), '/'); | |
if(strpos($url_path, "inventory/category/") !== false){ | |
$template = get_stylesheet_directory().'/views/virtual-category.blade.php'; | |
echo template($template, $data); | |
return get_stylesheet_directory().'/index.php'; | |
exit(); | |
} | |
if ($template) { | |
echo template($template, $data); | |
return get_stylesheet_directory().'/index.php'; | |
} | |
return $template; | |
}, PHP_INT_MAX); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment