Skip to content

Commit 20663cf

Browse files
author
Alex Perfilov
committed
Tailing slash at the end of category-header link
1 parent 9cd47f7 commit 20663cf

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

roots-nextdatagov/lib/titles.php

+19-19
Original file line numberDiff line numberDiff line change
@@ -70,31 +70,31 @@ function roots_title()
7070

7171
$title .= '<span class="category-header topic-' . $term->slug . '"><a href="' . home_url(
7272
'/' . $parent->slug . '/' . $term->slug
73-
) . '"><div><i></i></div><span>' . $term->name . '</span></a></span>';
73+
) . '/"><div><i></i></div><span>' . $term->name . '</span></a></span>';
7474

75-
// try to get the post's parent/child category/term in case the post url has been customized
76-
// through custom_permalinks
77-
if (get_post_meta($post->ID, 'custom_permalink', true ) && $parent->slug == "" && $child_slug == "") {
75+
// try to get the post's parent/child category/term in case the post url has been customized
76+
// through custom_permalinks
77+
if (get_post_meta($post->ID, 'custom_permalink', true) && $parent->slug == "" && $child_slug == "") {
7878

79-
$custom_permalink = str_replace(home_url() . '/', '', get_permalink($post->ID));
80-
$custom_permalink = explode('/', $custom_permalink);
81-
$custom_permalink_category = $custom_permalink[0];
82-
$custom_permalink_term = $custom_permalink[1];
79+
$custom_permalink = str_replace(home_url() . '/', '', get_permalink($post->ID));
80+
$custom_permalink = explode('/', $custom_permalink);
81+
$custom_permalink_category = $custom_permalink[0];
82+
$custom_permalink_term = $custom_permalink[1];
8383

84-
$category_exists = (term_exists($custom_permalink_category, 'category') != 0)
85-
&& term_exists($custom_permalink_category, 'category') != null;
84+
$category_exists = (term_exists($custom_permalink_category, 'category') != 0)
85+
&& term_exists($custom_permalink_category, 'category') != null;
8686

87-
$term_exists = (term_exists($custom_permalink_term, '', 'category') != 0)
88-
&& term_exists($custom_permalink_term, '', 'category') != null;
87+
$term_exists = (term_exists($custom_permalink_term, '', 'category') != 0)
88+
&& term_exists($custom_permalink_term, '', 'category') != null;
8989

90-
if ($category_exists && $term_exists) {
91-
$title .= ' &nbsp; &mdash; &nbsp; <span class="category-header topic-' .
92-
$custom_permalink_child . '"><a href="' . home_url(
93-
'/' . $custom_permalink_category . '/' . $custom_permalink_term
94-
) . '"><div><i></i></div><span>' . $custom_permalink_term . '</span></a></span>';
95-
}
90+
if ($category_exists && $term_exists) {
91+
$title .= ' &nbsp; &mdash; &nbsp; <span class="category-header topic-' .
92+
(isset($custom_permalink_child) ? $custom_permalink_child : '') . '"><a href="' . home_url(
93+
'/' . $custom_permalink_category . '/' . $custom_permalink_term
94+
) . '"><div><i></i></div><span>' . $custom_permalink_term . '</span></a></span>';
95+
}
9696

97-
}
97+
}
9898

9999
return apply_filters('single_term_title', $title);
100100
} elseif (is_post_type_archive()) {

0 commit comments

Comments
 (0)