-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchive-speakers.php
159 lines (118 loc) · 3.71 KB
/
archive-speakers.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<?php
get_header();
// Don't print the meta.
remove_action( 'wpcampus_2017_after_article_heading', 'wpcampus_2017_print_article_meta' );
// Print speaker meta.
function wpcampus_2017_archive_speaker_meta() {
// Get the speaker meta.
$speaker_id = get_the_ID();
$speaker_position = get_post_meta( $speaker_id, 'conf_sch_speaker_position', true );
$speaker_company = get_post_meta( $speaker_id, 'conf_sch_speaker_company', true );
// Get the speaker social media.
$speaker_twitter = get_post_meta( $speaker_id, 'conf_sch_speaker_twitter', true );
$speaker_linkedin = get_post_meta( $speaker_id, 'conf_sch_speaker_linkedin', true );
?>
<div class="article-speaker">
<?php
// Print speaker meta.
if ( $speaker_position || $speaker_company ) :
?>
<div class="article-speaker-meta">
<?php
// Print the speaker position.
if ( $speaker_position ) :
?><span class="speaker-position"><?php echo $speaker_position; ?></span><?php
endif;
// Print the speaker company.
if ( $speaker_company ) :
if ( $speaker_position ) {
echo ', ';
}
// Add the company URL.
$speaker_company_url = get_post_meta( $speaker_id, 'speaker_company_url', true );
if ( $speaker_company_url ) {
$speaker_company = '<a href="' . $speaker_company_url . '">' . $speaker_company . '</a>';
}
?><span class="speaker-company"><?php echo $speaker_company; ?></span><?php
endif;
?>
</div>
<?php
endif;
if ( $speaker_twitter || $speaker_linkedin ) :
?>
<ul class="article-speaker-social-media">
<?php
foreach ( array( 'twitter', 'linkedin' ) as $social ) :
// Build social media URL and label.
$social_url = '';
$social_label = '';
if ( 'twitter' == $social ) {
if ( $speaker_twitter ) {
$social_url = "https://twitter.com/{$speaker_twitter}";
$social_label = '@' . str_replace( '@', '', $speaker_twitter );
}
} elseif ( 'linkedin' == $social ) {
if ( $speaker_linkedin ) {
$social_url = $speaker_linkedin;
$social_label = 'LinkedIn';
}
}
if ( $social_label ) :
?>
<li class="social-media <?php echo $social; ?>"><a href="<?php echo $social_url; ?>"><i class="conf-sch-icon conf-sch-icon-<?php echo $social; ?>"></i> <span class="icon-label"><?php echo $social_label; ?></span></a></li>
<?php
endif;
endforeach;
?>
</ul>
<?php
endif;
?>
</div>
<?php
}
add_action( 'wpcampus_2017_before_article_content', 'wpcampus_2017_archive_speaker_meta' );
function wpcampus_2017_archive_speaker_events() {
if ( ! class_exists( 'Conference_Schedule_Speaker' ) ) {
return;
}
// Get speaker.
$speaker = new Conference_Schedule_Speaker( get_the_ID() );
// Get the events
$events = $speaker->get_events();
if ( ! $events ) {
return;
}
// Build events with links.
$event_links = array();
foreach ( $events as $event ) {
$event_links[] = '<a href="' . get_permalink( $event->ID ) . '">' . $event->post_title . '</a>';
}
// Print events, separated by comma.
?>
<div class="article-speaker-sessions">
<span class="article-speaker-session-label"><?php echo _n( 'Session:', 'Sessions:', count( $event_links ), 'wpcampus' ); ?></span>
<span class="article-speaker-session-events"><?php echo implode( ',', $event_links ); ?></span>
</div>
<?php
}
add_action( 'wpcampus_2017_after_article_content', 'wpcampus_2017_archive_speaker_events' );
if ( have_posts() ) :
?>
<div class="wpc-articles">
<?php
// Setup article args.
$args = array(
'link_to_post' => false,
'print_content' => true,
);
while ( have_posts() ) :
the_post();
wpcampus_2017_print_article( $args );
endwhile;
?>
</div>
<?php
endif;
get_footer();