| 1 |
<?php |
| 2 |
/** |
| 3 |
* The /friends/ header |
| 4 |
* |
| 5 |
* @version 1.0 |
| 6 |
* @package Friends |
| 7 |
*/ |
| 8 |
|
| 9 |
$_search = ''; |
| 10 |
if ( isset( $_GET['s'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 11 |
$_search = sanitize_text_field( wp_unslash( $_GET['s'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 12 |
} |
| 13 |
|
| 14 |
add_filter( |
| 15 |
'document_title_parts', |
| 16 |
function ( $title ) use ( $args ) { |
| 17 |
if ( isset( $args['title'] ) ) { |
| 18 |
$title['title'] = $args['title']; |
| 19 |
} |
| 20 |
return $title; |
| 21 |
} |
| 22 |
); |
| 23 |
|
| 24 |
?><!DOCTYPE html> |
| 25 |
<html <?php language_attributes(); ?> class="no-js no-svg"> |
| 26 |
<head> |
| 27 |
<meta charset="<?php bloginfo( 'charset' ); ?>"> |
| 28 |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
| 29 |
<meta name="color-scheme" content="light dark"> |
| 30 |
<?php wp_head(); ?> |
| 31 |
</head> |
| 32 |
|
| 33 |
<body <?php body_class( 'off-canvas off-canvas-sidebar-show' ); ?>> |
| 34 |
<div id="friends-sidebar" class="off-canvas-sidebar"> |
| 35 |
<div class="friends-brand"> |
| 36 |
<a class="friends-logo" href="<?php echo esc_url( home_url( '/friends/' ) ); ?>"><h2><?php esc_html_e( 'Friends', 'friends' ); ?></h2></a> |
| 37 |
|
| 38 |
<a class="friends-sidebar-customize" href="<?php echo esc_url( add_query_arg( 'url', home_url( '/friends/' ), admin_url( 'customize.php?autofocus[section]=sidebar-widgets-friends-sidebar' ) ) ); ?>"><?php esc_html_e( 'customize sidebar', 'friends' ); ?></a> |
| 39 |
</div> |
| 40 |
<div class="friends-nav accordion-container"> |
| 41 |
<?php dynamic_sidebar( 'friends-sidebar' ); ?> |
| 42 |
</div> |
| 43 |
</div> |
| 44 |
|
| 45 |
<a class="off-canvas-overlay" href="#close"></a> |
| 46 |
|
| 47 |
<div class="off-canvas-content"> |
| 48 |
<header class="<?php echo is_single() ? '' : 'navbar'; ?><?php echo ( isset( $args['no-bottom-margin'] ) && $args['no-bottom-margin'] ) ? ' no-bottom-margin' : ''; ?>"> |
| 49 |
<section class="navbar-section author"> |
| 50 |
<a class="off-canvas-toggle btn btn-primary bt-action" href="#friends-sidebar"> |
| 51 |
<span class="ab-icon dashicons dashicons-menu-alt2"></span> |
| 52 |
</a> |
| 53 |
<?php |
| 54 |
if ( $args['friend_user'] && $args['friend_user'] instanceof Friends\User && is_singular() ) { |
| 55 |
Friends\Friends::template_loader()->get_template_part( |
| 56 |
'frontend/single-header', |
| 57 |
$args['post_format'], |
| 58 |
$args |
| 59 |
); |
| 60 |
} elseif ( $args['friend_user'] && $args['friend_user'] instanceof Friends\User ) { |
| 61 |
Friends\Friends::template_loader()->get_template_part( |
| 62 |
'frontend/author-header', |
| 63 |
$args['post_format'], |
| 64 |
$args |
| 65 |
); |
| 66 |
} elseif ( isset( $args['title'] ) ) { |
| 67 |
?> |
| 68 |
<div id="main-header" class="mb-2"> |
| 69 |
<h2 id="page-title"><a href="<?php echo esc_url( home_url( '/friends/' ) ); ?>"> |
| 70 |
<?php echo esc_html( $args['title'] ); ?> |
| 71 |
</a></h2> |
| 72 |
</div> |
| 73 |
<?php |
| 74 |
} else { |
| 75 |
Friends\Friends::template_loader()->get_template_part( |
| 76 |
'frontend/main-feed-header', |
| 77 |
$args['post_format'], |
| 78 |
$args |
| 79 |
); |
| 80 |
} |
| 81 |
?> |
| 82 |
|
| 83 |
</section> |
| 84 |
|
| 85 |
<dialog class="search-dialog"> |
| 86 |
</dialog> |
| 87 |
|
| 88 |
|
| 89 |
<section class="navbar-section search<?php echo esc_attr( is_singular() ? ' d-hide' : '' ); ?><?php echo esc_attr( ! empty( $args['hide-mobile-search'] ) ? ' hide-mobile-search' : '' ); ?>"> |
| 90 |
<form class="input-group input-inline form-autocomplete" action="<?php echo esc_url( home_url( '/friends/' ) ); ?>"> |
| 91 |
<div class="form-autocomplete-input form-input"> |
| 92 |
<div class="has-icon-right"> |
| 93 |
<input class="form-input" type="text" tabindex="2" name="s" placeholder="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_attr_e( 'Search or paste URL' ); ?>" value="<?php echo esc_attr( $_search ); ?>" id="master-search" autocomplete="off" data-nonce="<?php echo esc_attr( wp_create_nonce( 'friends-autocomplete' ) ); ?>" /> |
| 94 |
<i class="form-icon"></i> |
| 95 |
</div> |
| 96 |
</div> |
| 97 |
<ul class="menu" style="display: none"> |
| 98 |
</ul> |
| 99 |
<button class="btn btn-primary input-group-btn"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Search' ); ?></button> |
| 100 |
</form> |
| 101 |
</section> |
| 102 |
</header> |
| 103 |
<?php |
| 104 |
do_action( 'friends_after_header', $args ); |
| 105 |
|