| 1 |
<?php |
| 2 |
/** |
| 3 |
* This is the main /friends/ template. |
| 4 |
* |
| 5 |
* @version 1.0 |
| 6 |
* @package Friends |
| 7 |
*/ |
| 8 |
|
| 9 |
Friends\Friends::template_loader()->get_template_part( |
| 10 |
'frontend/header', |
| 11 |
$args['post_format'], |
| 12 |
$args |
| 13 |
); |
| 14 |
|
| 15 |
?> |
| 16 |
<section class="posts columns <?php echo 'collapsed' === $args['frontend_default_view'] ? ' all-collapsed' : ''; ?>"> |
| 17 |
<?php |
| 18 |
if ( ! have_posts() ) { |
| 19 |
?> |
| 20 |
<div class="card columns col-12"> |
| 21 |
<div class="card-body"> |
| 22 |
<?php |
| 23 |
if ( $args['friends']->frontend->post_format ) { |
| 24 |
$post_formats = get_post_format_strings(); |
| 25 |
|
| 26 |
if ( $args['friend_user'] ) { |
| 27 |
echo esc_html( |
| 28 |
sprintf( |
| 29 |
// translators: %s is the name of an author. |
| 30 |
__( '%1$s hasn\'t posted anything with the post format %2$s yet!', 'friends' ), |
| 31 |
get_the_author(), |
| 32 |
$post_formats[ $args['friends']->frontend->post_format ] |
| 33 |
) |
| 34 |
); |
| 35 |
?> |
| 36 |
<a href="<?php echo esc_url( $args['friend_user']->get_local_friends_page_url() ); ?>"><?php esc_html_e( 'Remove post format filter', 'friends' ); ?></a> |
| 37 |
<?php |
| 38 |
} else { |
| 39 |
echo esc_html( |
| 40 |
sprintf( |
| 41 |
// translators: %s is a post format title. |
| 42 |
__( "Your friends haven't posted anything with the post format %s yet!", 'friends' ), |
| 43 |
$post_formats[ $args['friends']->frontend->post_format ] |
| 44 |
) |
| 45 |
); |
| 46 |
?> |
| 47 |
<a href="<?php echo esc_url( home_url( '/friends/' ) ); ?>"><?php esc_html_e( 'Remove post format filter', 'friends' ); ?></a> |
| 48 |
<?php |
| 49 |
} |
| 50 |
} else { |
| 51 |
$any_friends = Friends\User_Query::all_associated_users(); |
| 52 |
if ( $any_friends->get_total() > 0 ) { |
| 53 |
Friends\Friends::template_loader()->get_template_part( 'frontend/no-posts', $args['post_format'], $args ); |
| 54 |
} else { |
| 55 |
Friends\Friends::template_loader()->get_template_part( 'frontend/no-friends', $args['post_format'], $args ); |
| 56 |
} |
| 57 |
} |
| 58 |
?> |
| 59 |
</div> |
| 60 |
</div> |
| 61 |
<?php |
| 62 |
} else { |
| 63 |
Friends\Frontend::have_posts(); |
| 64 |
the_posts_navigation(); |
| 65 |
} |
| 66 |
?> |
| 67 |
</section> |
| 68 |
<?php |
| 69 |
Friends\Friends::template_loader()->get_template_part( |
| 70 |
'frontend/footer', |
| 71 |
$args['post_format'], |
| 72 |
$args |
| 73 |
); |
| 74 |
|