|
@@ 212-230 (lines=19) @@
|
| 209 |
|
* |
| 210 |
|
* @return string Full path to category template file. |
| 211 |
|
*/ |
| 212 |
|
function get_category_template() { |
| 213 |
|
$category = get_queried_object(); |
| 214 |
|
|
| 215 |
|
$templates = array(); |
| 216 |
|
|
| 217 |
|
if ( ! empty( $category->slug ) ) { |
| 218 |
|
|
| 219 |
|
$slug_decoded = urldecode( $category->slug ); |
| 220 |
|
if ( $slug_decoded !== $category->slug ) { |
| 221 |
|
$templates[] = "category-{$slug_decoded}.php"; |
| 222 |
|
} |
| 223 |
|
|
| 224 |
|
$templates[] = "category-{$category->slug}.php"; |
| 225 |
|
$templates[] = "category-{$category->term_id}.php"; |
| 226 |
|
} |
| 227 |
|
$templates[] = 'category.php'; |
| 228 |
|
|
| 229 |
|
return get_query_template( 'category', $templates ); |
| 230 |
|
} |
| 231 |
|
|
| 232 |
|
/** |
| 233 |
|
* Retrieve path of tag template in current or parent template. |
|
@@ 258-276 (lines=19) @@
|
| 255 |
|
* |
| 256 |
|
* @return string Full path to tag template file. |
| 257 |
|
*/ |
| 258 |
|
function get_tag_template() { |
| 259 |
|
$tag = get_queried_object(); |
| 260 |
|
|
| 261 |
|
$templates = array(); |
| 262 |
|
|
| 263 |
|
if ( ! empty( $tag->slug ) ) { |
| 264 |
|
|
| 265 |
|
$slug_decoded = urldecode( $tag->slug ); |
| 266 |
|
if ( $slug_decoded !== $tag->slug ) { |
| 267 |
|
$templates[] = "tag-{$slug_decoded}.php"; |
| 268 |
|
} |
| 269 |
|
|
| 270 |
|
$templates[] = "tag-{$tag->slug}.php"; |
| 271 |
|
$templates[] = "tag-{$tag->term_id}.php"; |
| 272 |
|
} |
| 273 |
|
$templates[] = 'tag.php'; |
| 274 |
|
|
| 275 |
|
return get_query_template( 'tag', $templates ); |
| 276 |
|
} |
| 277 |
|
|
| 278 |
|
/** |
| 279 |
|
* Retrieve path of custom taxonomy term template in current or parent template. |