Stencil_Hierarchy_Author::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 18
Code Lines 11

Duplication

Lines 18
Ratio 100 %
Metric Value
dl 18
loc 18
rs 9.4286
cc 2
eloc 11
nc 2
nop 0
1
<?php
2
/**
3
 * Author hierarchy tree
4
 *
5
 * @package Stencil\Hierarchy
6
 */
7
8
/**
9
 * Class Stencil_Hierarchy_Author
10
 */
11 View Code Duplication
class Stencil_Hierarchy_Author extends Stencil_Abstract_Hierarchy {
12
	/**
13
	 * Stencil_Hierarchy_Author constructor.
14
	 */
15
	public function __construct() {
16
		$options = array();
17
18
		$author = get_queried_object();
19
20
		if ( is_a( $author, 'WP_User' ) ) {
21
			$options[] = 'single/author' . $author->user_nicename;
22
			$options[] = 'author-' . $author->user_nicename;
23
24
			$options[] = 'single/author' . $author->ID;
25
			$options[] = 'author-' . $author->ID;
26
		}
27
28
		$options[] = 'archive/author';
29
		$options[] = 'author';
30
31
		$this->set_options( $options );
32
	}
33
}
34