| 1 |
<?php |
| 2 |
/** |
| 3 |
* This template contains the header for the main feed on /friends/. |
| 4 |
* |
| 5 |
* @package Friends |
| 6 |
*/ |
| 7 |
|
| 8 |
$data = $args['friends']->get_main_header_data(); |
| 9 |
$hidden_post_count = 0; |
| 10 |
if ( isset( $data['post_count_by_post_status']->trash ) ) { |
| 11 |
$hidden_post_count = $data['post_count_by_post_status']->trash; |
| 12 |
} |
| 13 |
?><div id="main-header" class="mb-2"> |
| 14 |
<h2 id="page-title"><a href="<?php echo esc_url( home_url( '/friends/' ) ); ?>"> |
| 15 |
<?php |
| 16 |
$title = __( 'Main Feed', 'friends' ); |
| 17 |
switch ( $args['friends']->frontend->post_format ) { |
| 18 |
case 'standard': |
| 19 |
$title = _x( 'Post feed', 'Post format', 'friends' ); |
| 20 |
break; |
| 21 |
case 'aside': |
| 22 |
$title = _x( 'Aside feed', 'Post format', 'friends' ); |
| 23 |
break; |
| 24 |
case 'chat': |
| 25 |
$title = _x( 'Chat feed', 'Post format', 'friends' ); |
| 26 |
break; |
| 27 |
case 'gallery': |
| 28 |
$title = _x( 'Gallery feed', 'Post format', 'friends' ); |
| 29 |
break; |
| 30 |
case 'link': |
| 31 |
$title = _x( 'Link feed', 'Post format', 'friends' ); |
| 32 |
break; |
| 33 |
case 'image': |
| 34 |
$title = _x( 'Image feed', 'Post format', 'friends' ); |
| 35 |
break; |
| 36 |
case 'quote': |
| 37 |
$title = _x( 'Quote feed', 'Post format', 'friends' ); |
| 38 |
break; |
| 39 |
case 'status': |
| 40 |
$title = _x( 'Status feed', 'Post format', 'friends' ); |
| 41 |
break; |
| 42 |
case 'video': |
| 43 |
$title = _x( 'Video feed', 'Post format', 'friends' ); |
| 44 |
break; |
| 45 |
case 'audio': |
| 46 |
$title = _x( 'Audio feed', 'Post format', 'friends' ); |
| 47 |
break; |
| 48 |
} |
| 49 |
|
| 50 |
if ( $args['friends']->frontend->reaction ) { |
| 51 |
echo esc_html( |
| 52 |
sprintf( |
| 53 |
// translators: %1$s is an emoji reaction, %2$s is a type of feed, e.g. "Main Feed". |
| 54 |
__( 'My %1$s reactions on %2$s', 'friends' ), |
| 55 |
$args['friends']->frontend->reaction, |
| 56 |
$title |
| 57 |
) |
| 58 |
); |
| 59 |
} else { |
| 60 |
echo esc_html( $title ); |
| 61 |
} |
| 62 |
|
| 63 |
?> |
| 64 |
</a></h2> |
| 65 |
|
| 66 |
<?php if ( $data['description'] ) : ?> |
| 67 |
<p> |
| 68 |
<?php |
| 69 |
echo wp_kses( $data['description'], array( 'a' => array( 'href' => array() ) ) ); |
| 70 |
?> |
| 71 |
</p> |
| 72 |
<?php endif; ?> |
| 73 |
|
| 74 |
<?php foreach ( $data['post_count_by_post_format'] as $post_format => $count ) : ?> |
| 75 |
<a class="chip" href="<?php echo esc_url( home_url( '/friends/type/' . $post_format . '/' ) ); ?>"><?php echo esc_html( $args['friends']->get_post_format_plural_string( $post_format, $count ) ); ?></a> |
| 76 |
<?php endforeach; ?> |
| 77 |
|
| 78 |
<?php if ( isset( $_GET['show-hidden'] ) ) : ?> |
| 79 |
<a class="chip" href="<?php echo esc_attr( remove_query_arg( 'show-hidden' ) ); ?>"> |
| 80 |
<?php echo esc_html__( 'Hide hidden items', 'friends' ); ?> |
| 81 |
</a> |
| 82 |
<?php elseif ( $hidden_post_count > 0 ) : ?> |
| 83 |
<a class="chip" href="<?php echo esc_attr( add_query_arg( 'show-hidden', 1 ) ); ?>"> |
| 84 |
<?php echo esc_html( sprintf( /* translators: %s is the number of hidden posts */_n( '%s hidden items', '%s hidden items', $hidden_post_count, 'friends' ), number_format_i18n( $hidden_post_count ) ) ); ?> |
| 85 |
</a> |
| 86 |
<?php endif; ?> |
| 87 |
|
| 88 |
|
| 89 |
<?php foreach ( Friends\Reactions::get_available_emojis() as $slug => $reaction ) : ?> |
| 90 |
<a class="chip" href="<?php echo esc_url( home_url( '/friends/reaction' . $slug . '/' ) ); ?>"> |
| 91 |
<?php |
| 92 |
echo esc_html( |
| 93 |
sprintf( |
| 94 |
// translators: %s is an emoji. |
| 95 |
__( 'Reacted with %s', 'friends' ), |
| 96 |
$reaction->char |
| 97 |
) |
| 98 |
); |
| 99 |
?> |
| 100 |
</a> |
| 101 |
<?php endforeach; ?> |
| 102 |
|
| 103 |
<a class="chip" href="<?php echo esc_attr( self_admin_url( 'admin.php?page=add-friend' ) ); ?>"><?php esc_html_e( 'Add New Friend', 'friends' ); ?></a> |
| 104 |
<a class="chip" href="<?php echo esc_attr( self_admin_url( 'admin.php?page=friends-settings' ) ); ?>"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Settings' ); ?></a> |
| 105 |
|
| 106 |
<?php if ( 'status' === $args['friends']->frontend->post_format ) : ?> |
| 107 |
<a class="chip quick-post-panel-toggle" href="#"><?php esc_html_e( 'Quick Post Panel', 'friends' ); ?></a> |
| 108 |
<?php endif; ?> |
| 109 |
|
| 110 |
<?php do_action( 'friends_main_feed_header', $args ); ?> |
| 111 |
</div> |
| 112 |
|