You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @param string $taxonomy - the name of the taxonomy to be filtered
* @param string $slug
*/
functioncompose_url(string$taxonomy, string$slug)
{
$slug = esc_attr($slug);
$url = "?{$taxonomy}[]=" . esc_attr($slug);
foreach (get_request_params() as$get_by => $args)
{
// allows selection of both: several or one (brand/engines)
//
if (in_array($slug, $args))
{
continue;
}
foreach ($argsas$arg)
{
if ($arg == $slug)
{
continue;
}
$url .= "&{$get_by}[]=" . esc_attr($arg);
}
}
echo$url;
}
The compose_url() function should not be defined in the archive.php file - all the template files defined in the WordPress Template Hierarchy should be used only for templating purposes.
Also, can you clarify the double filtering of the $args for $slug and the actual conditions, they seem reversed.
The text was updated successfully, but these errors were encountered:
CarBlogTheme/archive.php
Lines 67 to 97 in 29593b1
The
compose_url()
function should not be defined in thearchive.php
file - all the template files defined in the WordPress Template Hierarchy should be used only for templating purposes.Also, can you clarify the double filtering of the
$args
for$slug
and the actual conditions, they seem reversed.The text was updated successfully, but these errors were encountered: