-
Notifications
You must be signed in to change notification settings - Fork 34
/
author.php
executable file
·40 lines (33 loc) · 1.07 KB
/
author.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* The template for displaying Author Archive pages
*
* Methods for TimberHelper can be found in the /lib sub-directory
*
* @package WordPress
* @subpackage Timber
* @since Timber 0.1
*/
use P4\MasterTheme\User;
use P4\MasterTheme\Post;
use P4\MasterTheme\ListingPage;
use Timber\Timber;
$context = Timber::get_context();
if (isset($wp_query->query_vars['author'])) {
$author = new User($wp_query->query_vars['author']);
$context['author'] = $author;
$context['title'] = 'Author Archives: ' . $author->name();
$context['page_category'] = 'Author Page';
$context['social_accounts'] = Post::filter_social_accounts(
$context['footer_social_menu'] ?: []
);
$context['og_title'] = $author->name;
$context['og_description'] = get_the_author_meta('description', $author->ID);
$context['og_image_data'] = [
'url' => get_avatar_url($author->ID, [ 'size' => 300 ]),
'width' => '300',
'height' => '300',
];
}
$templates = ['author.twig', 'archive.twig'];
$page = new ListingPage($templates, $context);