updated theme GeneratePress version 3.0.4

This commit is contained in:
2021-07-25 23:25:29 +00:00
committed by Gitium
parent 0a73b21fab
commit 34065e1b59
56 changed files with 20547 additions and 20534 deletions

View File

@ -1,117 +1,117 @@
<?php
/**
* Archive elements.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! function_exists( 'generate_archive_title' ) ) {
add_action( 'generate_archive_title', 'generate_archive_title' );
/**
* Build the archive title
*
* @since 1.3.24
*/
function generate_archive_title() {
if ( ! function_exists( 'the_archive_title' ) ) {
return;
}
?>
<header class="page-header">
<?php
/**
* generate_before_archive_title hook.
*
* @since 0.1
*/
do_action( 'generate_before_archive_title' );
?>
<h1 class="page-title">
<?php the_archive_title(); ?>
</h1>
<?php
/**
* generate_after_archive_title hook.
*
* @since 0.1
*
* @hooked generate_do_archive_description - 10
*/
do_action( 'generate_after_archive_title' );
?>
</header>
<?php
}
}
if ( ! function_exists( 'generate_filter_the_archive_title' ) ) {
add_filter( 'get_the_archive_title', 'generate_filter_the_archive_title' );
/**
* Alter the_archive_title() function to match our original archive title function
*
* @since 1.3.45
*
* @param string $title The archive title.
* @return string The altered archive title
*/
function generate_filter_the_archive_title( $title ) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
/*
* Queue the first post, that way we know
* what author we're dealing with (if that is the case).
*/
the_post();
$title = sprintf(
'%1$s<span class="vcard">%2$s</span>',
get_avatar( get_the_author_meta( 'ID' ), 50 ),
get_the_author()
);
/*
* Since we called the_post() above, we need to
* rewind the loop back to the beginning that way
* we can run the loop properly, in full.
*/
rewind_posts();
}
return $title;
}
}
add_action( 'generate_after_archive_title', 'generate_do_archive_description' );
/**
* Output the archive description.
*
* @since 2.3
*/
function generate_do_archive_description() {
$term_description = term_description();
if ( ! empty( $term_description ) ) {
printf( '<div class="taxonomy-description">%s</div>', $term_description ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
if ( get_the_author_meta( 'description' ) && is_author() ) {
echo '<div class="author-info">' . get_the_author_meta( 'description' ) . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* generate_after_archive_description hook.
*
* @since 0.1
*/
do_action( 'generate_after_archive_description' );
}
<?php
/**
* Archive elements.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! function_exists( 'generate_archive_title' ) ) {
add_action( 'generate_archive_title', 'generate_archive_title' );
/**
* Build the archive title
*
* @since 1.3.24
*/
function generate_archive_title() {
if ( ! function_exists( 'the_archive_title' ) ) {
return;
}
?>
<header class="page-header">
<?php
/**
* generate_before_archive_title hook.
*
* @since 0.1
*/
do_action( 'generate_before_archive_title' );
?>
<h1 class="page-title">
<?php the_archive_title(); ?>
</h1>
<?php
/**
* generate_after_archive_title hook.
*
* @since 0.1
*
* @hooked generate_do_archive_description - 10
*/
do_action( 'generate_after_archive_title' );
?>
</header>
<?php
}
}
if ( ! function_exists( 'generate_filter_the_archive_title' ) ) {
add_filter( 'get_the_archive_title', 'generate_filter_the_archive_title' );
/**
* Alter the_archive_title() function to match our original archive title function
*
* @since 1.3.45
*
* @param string $title The archive title.
* @return string The altered archive title
*/
function generate_filter_the_archive_title( $title ) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
/*
* Queue the first post, that way we know
* what author we're dealing with (if that is the case).
*/
the_post();
$title = sprintf(
'%1$s<span class="vcard">%2$s</span>',
get_avatar( get_the_author_meta( 'ID' ), 50 ),
get_the_author()
);
/*
* Since we called the_post() above, we need to
* rewind the loop back to the beginning that way
* we can run the loop properly, in full.
*/
rewind_posts();
}
return $title;
}
}
add_action( 'generate_after_archive_title', 'generate_do_archive_description' );
/**
* Output the archive description.
*
* @since 2.3
*/
function generate_do_archive_description() {
$term_description = term_description();
if ( ! empty( $term_description ) ) {
printf( '<div class="taxonomy-description">%s</div>', $term_description ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
if ( get_the_author_meta( 'description' ) && is_author() ) {
echo '<div class="author-info">' . get_the_author_meta( 'description' ) . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* generate_after_archive_description hook.
*
* @since 0.1
*/
do_action( 'generate_after_archive_description' );
}

View File

@ -1,204 +1,204 @@
<?php
/**
* Comment structure.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! function_exists( 'generate_comment' ) ) {
/**
* Template for comments and pingbacks.
* Used as a callback by wp_list_comments() for displaying the comments.
*
* @param object $comment The comment object.
* @param array $args The existing args.
* @param int $depth The thread depth.
*/
function generate_comment( $comment, $args, $depth ) {
$args['avatar_size'] = apply_filters( 'generate_comment_avatar_size', 50 );
if ( 'pingback' === $comment->comment_type || 'trackback' === $comment->comment_type ) : ?>
<li id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
<div class="comment-body">
<?php esc_html_e( 'Pingback:', 'generatepress' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( 'Edit', 'generatepress' ), '<span class="edit-link">', '</span>' ); ?>
</div>
<?php else : ?>
<li id="comment-<?php comment_ID(); ?>" <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?>>
<article id="div-comment-<?php comment_ID(); ?>" <?php generate_do_element_classes( 'comment-body', 'comment-body' ); ?>>
<footer class="comment-meta">
<?php
if ( 0 != $args['avatar_size'] ) { // phpcs:ignore
echo get_avatar( $comment, $args['avatar_size'] );
}
?>
<div class="comment-author-info">
<div <?php generate_do_element_classes( 'comment-author' ); ?>>
<?php printf( '<cite itemprop="name" class="fn">%s</cite>', get_comment_author_link() ); ?>
</div>
<div class="entry-meta comment-metadata">
<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
<time datetime="<?php comment_time( 'c' ); ?>" itemprop="datePublished">
<?php
printf(
/* translators: 1: date, 2: time */
_x( '%1$s at %2$s', '1: date, 2: time', 'generatepress' ), // phpcs:ignore
get_comment_date(), // phpcs:ignore
get_comment_time() // phpcs:ignore
);
?>
</time>
</a>
<?php edit_comment_link( __( 'Edit', 'generatepress' ), '<span class="edit-link">| ', '</span>' ); ?>
</div>
</div>
<?php if ( '0' == $comment->comment_approved ) : // phpcs:ignore ?>
<p class="comment-awaiting-moderation"><?php esc_html_e( 'Your comment is awaiting moderation.', 'generatepress' ); ?></p>
<?php endif; ?>
</footer>
<div class="comment-content" itemprop="text">
<?php
/**
* generate_before_comment_content hook.
*
* @since 2.4
*/
do_action( 'generate_before_comment_text', $comment, $args, $depth );
comment_text();
/**
* generate_after_comment_content hook.
*
* @since 2.4
*/
do_action( 'generate_after_comment_text', $comment, $args, $depth );
?>
</div>
</article>
<?php
endif;
}
}
add_action( 'generate_after_comment_text', 'generate_do_comment_reply_link', 10, 3 );
/**
* Add our comment reply link after the comment text.
*
* @since 2.4
* @param object $comment The comment object.
* @param array $args The existing args.
* @param int $depth The thread depth.
*/
function generate_do_comment_reply_link( $comment, $args, $depth ) {
comment_reply_link(
array_merge(
$args,
array(
'add_below' => 'div-comment',
'depth' => $depth,
'max_depth' => $args['max_depth'],
'before' => '<span class="reply">',
'after' => '</span>',
)
)
);
}
add_filter( 'comment_form_defaults', 'generate_set_comment_form_defaults' );
/**
* Set the default settings for our comments.
*
* @since 2.3
*
* @param array $defaults The existing defaults.
* @return array
*/
function generate_set_comment_form_defaults( $defaults ) {
$defaults['comment_field'] = sprintf(
'<p class="comment-form-comment"><label for="comment" class="screen-reader-text">%1$s</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true" required></textarea></p>',
esc_html__( 'Comment', 'generatepress' )
);
$defaults['comment_notes_before'] = null;
$defaults['comment_notes_after'] = null;
$defaults['id_form'] = 'commentform';
$defaults['id_submit'] = 'submit';
$defaults['title_reply'] = apply_filters( 'generate_leave_comment', __( 'Leave a Comment', 'generatepress' ) );
$defaults['label_submit'] = apply_filters( 'generate_post_comment', __( 'Post Comment', 'generatepress' ) );
return $defaults;
}
add_filter( 'comment_form_default_fields', 'generate_filter_comment_fields' );
/**
* Customizes the existing comment fields.
*
* @since 2.1.2
* @param array $fields The existing fields.
* @return array
*/
function generate_filter_comment_fields( $fields ) {
$commenter = wp_get_current_commenter();
$required = get_option( 'require_name_email' );
$fields['author'] = sprintf(
'<label for="author" class="screen-reader-text">%1$s</label><input placeholder="%1$s%3$s" id="author" name="author" type="text" value="%2$s" size="30" />',
esc_html__( 'Name', 'generatepress' ),
esc_attr( $commenter['comment_author'] ),
$required ? ' *' : ''
);
$fields['email'] = sprintf(
'<label for="email" class="screen-reader-text">%1$s</label><input placeholder="%1$s%3$s" id="email" name="email" type="email" value="%2$s" size="30" />',
esc_html__( 'Email', 'generatepress' ),
esc_attr( $commenter['comment_author_email'] ),
$required ? ' *' : ''
);
$fields['url'] = sprintf(
'<label for="url" class="screen-reader-text">%1$s</label><input placeholder="%1$s" id="url" name="url" type="url" value="%2$s" size="30" />',
esc_html__( 'Website', 'generatepress' ),
esc_attr( $commenter['comment_author_url'] )
);
return $fields;
}
add_action( 'generate_after_do_template_part', 'generate_do_comments_template', 15 );
/**
* Add the comments template to pages and single posts.
*
* @since 3.0.0
* @param string $template The template we're targeting.
*/
function generate_do_comments_template( $template ) {
if ( 'single' === $template || 'page' === $template ) {
// If comments are open or we have at least one comment, load up the comment template.
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentionally loose.
if ( comments_open() || '0' != get_comments_number() ) :
/**
* generate_before_comments_container hook.
*
* @since 2.1
*/
do_action( 'generate_before_comments_container' );
?>
<div class="comments-area">
<?php comments_template(); ?>
</div>
<?php
endif;
}
}
<?php
/**
* Comment structure.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! function_exists( 'generate_comment' ) ) {
/**
* Template for comments and pingbacks.
* Used as a callback by wp_list_comments() for displaying the comments.
*
* @param object $comment The comment object.
* @param array $args The existing args.
* @param int $depth The thread depth.
*/
function generate_comment( $comment, $args, $depth ) {
$args['avatar_size'] = apply_filters( 'generate_comment_avatar_size', 50 );
if ( 'pingback' === $comment->comment_type || 'trackback' === $comment->comment_type ) : ?>
<li id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
<div class="comment-body">
<?php esc_html_e( 'Pingback:', 'generatepress' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( 'Edit', 'generatepress' ), '<span class="edit-link">', '</span>' ); ?>
</div>
<?php else : ?>
<li id="comment-<?php comment_ID(); ?>" <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?>>
<article id="div-comment-<?php comment_ID(); ?>" <?php generate_do_element_classes( 'comment-body', 'comment-body' ); ?>>
<footer class="comment-meta">
<?php
if ( 0 != $args['avatar_size'] ) { // phpcs:ignore
echo get_avatar( $comment, $args['avatar_size'] );
}
?>
<div class="comment-author-info">
<div <?php generate_do_element_classes( 'comment-author' ); ?>>
<?php printf( '<cite itemprop="name" class="fn">%s</cite>', get_comment_author_link() ); ?>
</div>
<div class="entry-meta comment-metadata">
<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
<time datetime="<?php comment_time( 'c' ); ?>" itemprop="datePublished">
<?php
printf(
/* translators: 1: date, 2: time */
_x( '%1$s at %2$s', '1: date, 2: time', 'generatepress' ), // phpcs:ignore
get_comment_date(), // phpcs:ignore
get_comment_time() // phpcs:ignore
);
?>
</time>
</a>
<?php edit_comment_link( __( 'Edit', 'generatepress' ), '<span class="edit-link">| ', '</span>' ); ?>
</div>
</div>
<?php if ( '0' == $comment->comment_approved ) : // phpcs:ignore ?>
<p class="comment-awaiting-moderation"><?php esc_html_e( 'Your comment is awaiting moderation.', 'generatepress' ); ?></p>
<?php endif; ?>
</footer>
<div class="comment-content" itemprop="text">
<?php
/**
* generate_before_comment_content hook.
*
* @since 2.4
*/
do_action( 'generate_before_comment_text', $comment, $args, $depth );
comment_text();
/**
* generate_after_comment_content hook.
*
* @since 2.4
*/
do_action( 'generate_after_comment_text', $comment, $args, $depth );
?>
</div>
</article>
<?php
endif;
}
}
add_action( 'generate_after_comment_text', 'generate_do_comment_reply_link', 10, 3 );
/**
* Add our comment reply link after the comment text.
*
* @since 2.4
* @param object $comment The comment object.
* @param array $args The existing args.
* @param int $depth The thread depth.
*/
function generate_do_comment_reply_link( $comment, $args, $depth ) {
comment_reply_link(
array_merge(
$args,
array(
'add_below' => 'div-comment',
'depth' => $depth,
'max_depth' => $args['max_depth'],
'before' => '<span class="reply">',
'after' => '</span>',
)
)
);
}
add_filter( 'comment_form_defaults', 'generate_set_comment_form_defaults' );
/**
* Set the default settings for our comments.
*
* @since 2.3
*
* @param array $defaults The existing defaults.
* @return array
*/
function generate_set_comment_form_defaults( $defaults ) {
$defaults['comment_field'] = sprintf(
'<p class="comment-form-comment"><label for="comment" class="screen-reader-text">%1$s</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true" required></textarea></p>',
esc_html__( 'Comment', 'generatepress' )
);
$defaults['comment_notes_before'] = null;
$defaults['comment_notes_after'] = null;
$defaults['id_form'] = 'commentform';
$defaults['id_submit'] = 'submit';
$defaults['title_reply'] = apply_filters( 'generate_leave_comment', __( 'Leave a Comment', 'generatepress' ) );
$defaults['label_submit'] = apply_filters( 'generate_post_comment', __( 'Post Comment', 'generatepress' ) );
return $defaults;
}
add_filter( 'comment_form_default_fields', 'generate_filter_comment_fields' );
/**
* Customizes the existing comment fields.
*
* @since 2.1.2
* @param array $fields The existing fields.
* @return array
*/
function generate_filter_comment_fields( $fields ) {
$commenter = wp_get_current_commenter();
$required = get_option( 'require_name_email' );
$fields['author'] = sprintf(
'<label for="author" class="screen-reader-text">%1$s</label><input placeholder="%1$s%3$s" id="author" name="author" type="text" value="%2$s" size="30" />',
esc_html__( 'Name', 'generatepress' ),
esc_attr( $commenter['comment_author'] ),
$required ? ' *' : ''
);
$fields['email'] = sprintf(
'<label for="email" class="screen-reader-text">%1$s</label><input placeholder="%1$s%3$s" id="email" name="email" type="email" value="%2$s" size="30" />',
esc_html__( 'Email', 'generatepress' ),
esc_attr( $commenter['comment_author_email'] ),
$required ? ' *' : ''
);
$fields['url'] = sprintf(
'<label for="url" class="screen-reader-text">%1$s</label><input placeholder="%1$s" id="url" name="url" type="url" value="%2$s" size="30" />',
esc_html__( 'Website', 'generatepress' ),
esc_attr( $commenter['comment_author_url'] )
);
return $fields;
}
add_action( 'generate_after_do_template_part', 'generate_do_comments_template', 15 );
/**
* Add the comments template to pages and single posts.
*
* @since 3.0.0
* @param string $template The template we're targeting.
*/
function generate_do_comments_template( $template ) {
if ( 'single' === $template || 'page' === $template ) {
// If comments are open or we have at least one comment, load up the comment template.
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentionally loose.
if ( comments_open() || '0' != get_comments_number() ) :
/**
* generate_before_comments_container hook.
*
* @since 2.1
*/
do_action( 'generate_before_comments_container' );
?>
<div class="comments-area">
<?php comments_template(); ?>
</div>
<?php
endif;
}
}

View File

@ -1,245 +1,245 @@
<?php
/**
* Footer elements.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! function_exists( 'generate_construct_footer' ) ) {
add_action( 'generate_footer', 'generate_construct_footer' );
/**
* Build our footer.
*
* @since 1.3.42
*/
function generate_construct_footer() {
$inside_site_info_class = '';
if ( 'full-width' !== generate_get_option( 'footer_inner_width' ) ) {
$inside_site_info_class = ' grid-container grid-parent';
if ( generate_is_using_flexbox() ) {
$inside_site_info_class = ' grid-container';
}
}
?>
<footer <?php generate_do_element_classes( 'site-info', 'site-info' ); ?>>
<div class="inside-site-info<?php echo $inside_site_info_class; // phpcs:ignore ?>">
<?php
/**
* generate_before_copyright hook.
*
* @since 0.1
*
* @hooked generate_footer_bar - 15
*/
do_action( 'generate_before_copyright' );
?>
<div class="copyright-bar">
<?php
/**
* generate_credits hook.
*
* @since 0.1
*
* @hooked generate_add_footer_info - 10
*/
do_action( 'generate_credits' );
?>
</div>
</div>
</footer>
<?php
}
}
if ( ! function_exists( 'generate_footer_bar' ) ) {
add_action( 'generate_before_copyright', 'generate_footer_bar', 15 );
/**
* Build our footer bar
*
* @since 1.3.42
*/
function generate_footer_bar() {
if ( ! is_active_sidebar( 'footer-bar' ) ) {
return;
}
?>
<div class="footer-bar">
<?php dynamic_sidebar( 'footer-bar' ); ?>
</div>
<?php
}
}
if ( ! function_exists( 'generate_add_footer_info' ) ) {
add_action( 'generate_credits', 'generate_add_footer_info' );
/**
* Add the copyright to the footer
*
* @since 0.1
*/
function generate_add_footer_info() {
$copyright = sprintf(
'<span class="copyright">&copy; %1$s %2$s</span> &bull; %4$s <a href="%3$s"%6$s>%5$s</a>',
date( 'Y' ), // phpcs:ignore
get_bloginfo( 'name' ),
esc_url( 'https://generatepress.com' ),
_x( 'Built with', 'GeneratePress', 'generatepress' ),
__( 'GeneratePress', 'generatepress' ),
'microdata' === generate_get_schema_type() ? ' itemprop="url"' : ''
);
echo apply_filters( 'generate_copyright', $copyright ); // phpcs:ignore
}
}
/**
* Build our individual footer widgets.
* Displays a sample widget if no widget is found in the area.
*
* @since 2.0
*
* @param int $widget_width The width class of our widget.
* @param int $widget The ID of our widget.
*/
function generate_do_footer_widget( $widget_width, $widget ) {
$widget_classes = sprintf(
'footer-widget-%s',
absint( $widget )
);
if ( ! generate_is_using_flexbox() ) {
$widget_width = apply_filters( "generate_footer_widget_{$widget}_width", $widget_width );
$tablet_widget_width = apply_filters( "generate_footer_widget_{$widget}_tablet_width", '50' );
$widget_classes = sprintf(
'footer-widget-%1$s grid-parent grid-%2$s tablet-grid-%3$s mobile-grid-100',
absint( $widget ),
absint( $widget_width ),
absint( $tablet_widget_width )
);
}
?>
<div class="<?php echo $widget_classes; // phpcs:ignore ?>">
<?php dynamic_sidebar( 'footer-' . absint( $widget ) ); ?>
</div>
<?php
}
if ( ! function_exists( 'generate_construct_footer_widgets' ) ) {
add_action( 'generate_footer', 'generate_construct_footer_widgets', 5 );
/**
* Build our footer widgets.
*
* @since 1.3.42
*/
function generate_construct_footer_widgets() {
// Get how many widgets to show.
$widgets = generate_get_footer_widgets();
if ( ! empty( $widgets ) && 0 !== $widgets ) :
// If no footer widgets exist, we don't need to continue.
if ( ! is_active_sidebar( 'footer-1' ) && ! is_active_sidebar( 'footer-2' ) && ! is_active_sidebar( 'footer-3' ) && ! is_active_sidebar( 'footer-4' ) && ! is_active_sidebar( 'footer-5' ) ) {
return;
}
// Set up the widget width.
$widget_width = '';
if ( 1 === (int) $widgets ) {
$widget_width = '100';
}
if ( 2 === (int) $widgets ) {
$widget_width = '50';
}
if ( 3 === (int) $widgets ) {
$widget_width = '33';
}
if ( 4 === (int) $widgets ) {
$widget_width = '25';
}
if ( 5 === (int) $widgets ) {
$widget_width = '20';
}
?>
<div id="footer-widgets" class="site footer-widgets">
<div <?php generate_do_element_classes( 'inside_footer' ); ?>>
<div class="inside-footer-widgets">
<?php
if ( $widgets >= 1 ) {
generate_do_footer_widget( $widget_width, 1 );
}
if ( $widgets >= 2 ) {
generate_do_footer_widget( $widget_width, 2 );
}
if ( $widgets >= 3 ) {
generate_do_footer_widget( $widget_width, 3 );
}
if ( $widgets >= 4 ) {
generate_do_footer_widget( $widget_width, 4 );
}
if ( $widgets >= 5 ) {
generate_do_footer_widget( $widget_width, 5 );
}
?>
</div>
</div>
</div>
<?php
endif;
/**
* generate_after_footer_widgets hook.
*
* @since 0.1
*/
do_action( 'generate_after_footer_widgets' );
}
}
if ( ! function_exists( 'generate_back_to_top' ) ) {
add_action( 'generate_after_footer', 'generate_back_to_top' );
/**
* Build the back to top button
*
* @since 1.3.24
*/
function generate_back_to_top() {
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
if ( 'enable' !== $generate_settings['back_to_top'] ) {
return;
}
echo apply_filters( // phpcs:ignore
'generate_back_to_top_output',
sprintf(
'<a title="%1$s" aria-label="%1$s" rel="nofollow" href="#" class="generate-back-to-top" style="opacity:0;visibility:hidden;" data-scroll-speed="%2$s" data-start-scroll="%3$s">
%5$s
</a>',
esc_attr__( 'Scroll back to top', 'generatepress' ),
absint( apply_filters( 'generate_back_to_top_scroll_speed', 400 ) ),
absint( apply_filters( 'generate_back_to_top_start_scroll', 300 ) ),
esc_attr( apply_filters( 'generate_back_to_top_icon', 'fa-angle-up' ) ),
generate_get_svg_icon( 'arrow-up' )
)
);
}
}
<?php
/**
* Footer elements.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! function_exists( 'generate_construct_footer' ) ) {
add_action( 'generate_footer', 'generate_construct_footer' );
/**
* Build our footer.
*
* @since 1.3.42
*/
function generate_construct_footer() {
$inside_site_info_class = '';
if ( 'full-width' !== generate_get_option( 'footer_inner_width' ) ) {
$inside_site_info_class = ' grid-container grid-parent';
if ( generate_is_using_flexbox() ) {
$inside_site_info_class = ' grid-container';
}
}
?>
<footer <?php generate_do_element_classes( 'site-info', 'site-info' ); ?>>
<div class="inside-site-info<?php echo $inside_site_info_class; // phpcs:ignore ?>">
<?php
/**
* generate_before_copyright hook.
*
* @since 0.1
*
* @hooked generate_footer_bar - 15
*/
do_action( 'generate_before_copyright' );
?>
<div class="copyright-bar">
<?php
/**
* generate_credits hook.
*
* @since 0.1
*
* @hooked generate_add_footer_info - 10
*/
do_action( 'generate_credits' );
?>
</div>
</div>
</footer>
<?php
}
}
if ( ! function_exists( 'generate_footer_bar' ) ) {
add_action( 'generate_before_copyright', 'generate_footer_bar', 15 );
/**
* Build our footer bar
*
* @since 1.3.42
*/
function generate_footer_bar() {
if ( ! is_active_sidebar( 'footer-bar' ) ) {
return;
}
?>
<div class="footer-bar">
<?php dynamic_sidebar( 'footer-bar' ); ?>
</div>
<?php
}
}
if ( ! function_exists( 'generate_add_footer_info' ) ) {
add_action( 'generate_credits', 'generate_add_footer_info' );
/**
* Add the copyright to the footer
*
* @since 0.1
*/
function generate_add_footer_info() {
$copyright = sprintf(
'<span class="copyright">&copy; %1$s %2$s</span> &bull; %4$s <a href="%3$s"%6$s>%5$s</a>',
date( 'Y' ), // phpcs:ignore
get_bloginfo( 'name' ),
esc_url( 'https://generatepress.com' ),
_x( 'Built with', 'GeneratePress', 'generatepress' ),
__( 'GeneratePress', 'generatepress' ),
'microdata' === generate_get_schema_type() ? ' itemprop="url"' : ''
);
echo apply_filters( 'generate_copyright', $copyright ); // phpcs:ignore
}
}
/**
* Build our individual footer widgets.
* Displays a sample widget if no widget is found in the area.
*
* @since 2.0
*
* @param int $widget_width The width class of our widget.
* @param int $widget The ID of our widget.
*/
function generate_do_footer_widget( $widget_width, $widget ) {
$widget_classes = sprintf(
'footer-widget-%s',
absint( $widget )
);
if ( ! generate_is_using_flexbox() ) {
$widget_width = apply_filters( "generate_footer_widget_{$widget}_width", $widget_width );
$tablet_widget_width = apply_filters( "generate_footer_widget_{$widget}_tablet_width", '50' );
$widget_classes = sprintf(
'footer-widget-%1$s grid-parent grid-%2$s tablet-grid-%3$s mobile-grid-100',
absint( $widget ),
absint( $widget_width ),
absint( $tablet_widget_width )
);
}
?>
<div class="<?php echo $widget_classes; // phpcs:ignore ?>">
<?php dynamic_sidebar( 'footer-' . absint( $widget ) ); ?>
</div>
<?php
}
if ( ! function_exists( 'generate_construct_footer_widgets' ) ) {
add_action( 'generate_footer', 'generate_construct_footer_widgets', 5 );
/**
* Build our footer widgets.
*
* @since 1.3.42
*/
function generate_construct_footer_widgets() {
// Get how many widgets to show.
$widgets = generate_get_footer_widgets();
if ( ! empty( $widgets ) && 0 !== $widgets ) :
// If no footer widgets exist, we don't need to continue.
if ( ! is_active_sidebar( 'footer-1' ) && ! is_active_sidebar( 'footer-2' ) && ! is_active_sidebar( 'footer-3' ) && ! is_active_sidebar( 'footer-4' ) && ! is_active_sidebar( 'footer-5' ) ) {
return;
}
// Set up the widget width.
$widget_width = '';
if ( 1 === (int) $widgets ) {
$widget_width = '100';
}
if ( 2 === (int) $widgets ) {
$widget_width = '50';
}
if ( 3 === (int) $widgets ) {
$widget_width = '33';
}
if ( 4 === (int) $widgets ) {
$widget_width = '25';
}
if ( 5 === (int) $widgets ) {
$widget_width = '20';
}
?>
<div id="footer-widgets" class="site footer-widgets">
<div <?php generate_do_element_classes( 'inside_footer' ); ?>>
<div class="inside-footer-widgets">
<?php
if ( $widgets >= 1 ) {
generate_do_footer_widget( $widget_width, 1 );
}
if ( $widgets >= 2 ) {
generate_do_footer_widget( $widget_width, 2 );
}
if ( $widgets >= 3 ) {
generate_do_footer_widget( $widget_width, 3 );
}
if ( $widgets >= 4 ) {
generate_do_footer_widget( $widget_width, 4 );
}
if ( $widgets >= 5 ) {
generate_do_footer_widget( $widget_width, 5 );
}
?>
</div>
</div>
</div>
<?php
endif;
/**
* generate_after_footer_widgets hook.
*
* @since 0.1
*/
do_action( 'generate_after_footer_widgets' );
}
}
if ( ! function_exists( 'generate_back_to_top' ) ) {
add_action( 'generate_after_footer', 'generate_back_to_top' );
/**
* Build the back to top button
*
* @since 1.3.24
*/
function generate_back_to_top() {
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
if ( 'enable' !== $generate_settings['back_to_top'] ) {
return;
}
echo apply_filters( // phpcs:ignore
'generate_back_to_top_output',
sprintf(
'<a title="%1$s" aria-label="%1$s" rel="nofollow" href="#" class="generate-back-to-top" style="opacity:0;visibility:hidden;" data-scroll-speed="%2$s" data-start-scroll="%3$s">
%5$s
</a>',
esc_attr__( 'Scroll back to top', 'generatepress' ),
absint( apply_filters( 'generate_back_to_top_scroll_speed', 400 ) ),
absint( apply_filters( 'generate_back_to_top_start_scroll', 300 ) ),
esc_attr( apply_filters( 'generate_back_to_top_icon', 'fa-angle-up' ) ),
generate_get_svg_icon( 'arrow-up' )
)
);
}
}

View File

@ -1,404 +1,404 @@
<?php
/**
* Header elements.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! function_exists( 'generate_construct_header' ) ) {
add_action( 'generate_header', 'generate_construct_header' );
/**
* Build the header.
*
* @since 1.3.42
*/
function generate_construct_header() {
?>
<header id="masthead" <?php generate_do_element_classes( 'header' ); ?>>
<div <?php generate_do_element_classes( 'inside_header' ); ?>>
<?php
/**
* generate_before_header_content hook.
*
* @since 0.1
*/
do_action( 'generate_before_header_content' );
if ( ! generate_is_using_flexbox() ) {
// Add our main header items.
generate_header_items();
}
/**
* generate_after_header_content hook.
*
* @since 0.1
*
* @hooked generate_add_navigation_float_right - 5
*/
do_action( 'generate_after_header_content' );
?>
</div>
</header>
<?php
}
}
if ( ! function_exists( 'generate_header_items' ) ) {
/**
* Build the header contents.
* Wrapping this into a function allows us to customize the order.
*
* @since 1.2.9.7
*/
function generate_header_items() {
$order = apply_filters(
'generate_header_items_order',
array(
'header-widget',
'site-branding',
'logo',
)
);
foreach ( $order as $item ) {
if ( 'header-widget' === $item ) {
generate_construct_header_widget();
}
if ( 'site-branding' === $item ) {
generate_construct_site_title();
}
if ( 'logo' === $item ) {
generate_construct_logo();
}
}
}
}
if ( ! function_exists( 'generate_construct_logo' ) ) {
/**
* Build the logo
*
* @since 1.3.28
*/
function generate_construct_logo() {
$logo_url = ( function_exists( 'the_custom_logo' ) && get_theme_mod( 'custom_logo' ) ) ? wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'full' ) : false;
$logo_url = ( $logo_url ) ? $logo_url[0] : generate_get_option( 'logo' );
$logo_url = esc_url( apply_filters( 'generate_logo', $logo_url ) );
$retina_logo_url = esc_url( apply_filters( 'generate_retina_logo', generate_get_option( 'retina_logo' ) ) );
// If we don't have a logo, bail.
if ( empty( $logo_url ) ) {
return;
}
/**
* generate_before_logo hook.
*
* @since 0.1
*/
do_action( 'generate_before_logo' );
$attr = apply_filters(
'generate_logo_attributes',
array(
'class' => 'header-image is-logo-image',
'alt' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
'src' => $logo_url,
'title' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
)
);
if ( '' !== $retina_logo_url ) {
$attr['srcset'] = $logo_url . ' 1x, ' . $retina_logo_url . ' 2x';
// Add dimensions to image if retina is set. This fixes a container width bug in Firefox.
if ( function_exists( 'the_custom_logo' ) && get_theme_mod( 'custom_logo' ) ) {
$data = wp_get_attachment_metadata( get_theme_mod( 'custom_logo' ) );
if ( ! empty( $data ) ) {
$attr['width'] = $data['width'];
$attr['height'] = $data['height'];
}
}
} elseif ( generate_is_using_flexbox() ) {
// Add this to flexbox version only until we can verify it won't conflict with existing installs.
if ( function_exists( 'the_custom_logo' ) && get_theme_mod( 'custom_logo' ) ) {
$data = wp_get_attachment_metadata( get_theme_mod( 'custom_logo' ) );
if ( ! empty( $data ) ) {
$attr['width'] = $data['width'];
$attr['height'] = $data['height'];
}
}
}
$attr = array_map( 'esc_attr', $attr );
$html_attr = '';
foreach ( $attr as $name => $value ) {
$html_attr .= " $name=" . '"' . $value . '"';
}
// Print our HTML.
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
'generate_logo_output',
sprintf(
'<div class="site-logo">
<a href="%1$s" title="%2$s" rel="home">
<img %3$s />
</a>
</div>',
esc_url( apply_filters( 'generate_logo_href', home_url( '/' ) ) ),
esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
$html_attr
),
$logo_url,
$html_attr
);
/**
* generate_after_logo hook.
*
* @since 0.1
*/
do_action( 'generate_after_logo' );
}
}
if ( ! function_exists( 'generate_construct_site_title' ) ) {
/**
* Build the site title and tagline.
*
* @since 1.3.28
*/
function generate_construct_site_title() {
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
// Get the title and tagline.
$title = get_bloginfo( 'title' );
$tagline = get_bloginfo( 'description' );
// If the disable title checkbox is checked, or the title field is empty, return true.
$disable_title = ( '1' == $generate_settings['hide_title'] || '' == $title ) ? true : false; // phpcs:ignore
// If the disable tagline checkbox is checked, or the tagline field is empty, return true.
$disable_tagline = ( '1' == $generate_settings['hide_tagline'] || '' == $tagline ) ? true : false; // phpcs:ignore
$schema_type = generate_get_schema_type();
// Build our site title.
$site_title = apply_filters(
'generate_site_title_output',
sprintf(
'<%1$s class="main-title"%4$s>
<a href="%2$s" rel="home">
%3$s
</a>
</%1$s>',
( is_front_page() && is_home() ) ? 'h1' : 'p',
esc_url( apply_filters( 'generate_site_title_href', home_url( '/' ) ) ),
get_bloginfo( 'name' ),
'microdata' === generate_get_schema_type() ? ' itemprop="headline"' : ''
)
);
// Build our tagline.
$site_tagline = apply_filters(
'generate_site_description_output',
sprintf(
'<p class="site-description"%2$s>
%1$s
</p>',
html_entity_decode( get_bloginfo( 'description', 'display' ) ), // phpcs:ignore
'microdata' === generate_get_schema_type() ? ' itemprop="description"' : ''
)
);
// Site title and tagline.
if ( false === $disable_title || false === $disable_tagline ) {
if ( generate_needs_site_branding_container() ) {
echo '<div class="site-branding-container">';
generate_construct_logo();
}
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- outputting site title and tagline. False positive.
echo apply_filters(
'generate_site_branding_output',
sprintf(
'<div class="site-branding">
%1$s
%2$s
</div>',
( ! $disable_title ) ? $site_title : '',
( ! $disable_tagline ) ? $site_tagline : ''
)
);
if ( generate_needs_site_branding_container() ) {
echo '</div>';
}
}
}
}
add_filter( 'generate_header_items_order', 'generate_reorder_inline_site_branding' );
/**
* Remove the logo from it's usual position.
*
* @since 2.3
* @param array $order Order of the header items.
*/
function generate_reorder_inline_site_branding( $order ) {
if ( ! generate_get_option( 'inline_logo_site_branding' ) || ! generate_has_logo_site_branding() ) {
return $order;
}
return array(
'header-widget',
'site-branding',
);
}
if ( ! function_exists( 'generate_construct_header_widget' ) ) {
/**
* Build the header widget.
*
* @since 1.3.28
*/
function generate_construct_header_widget() {
if ( is_active_sidebar( 'header' ) ) :
?>
<div class="header-widget">
<?php dynamic_sidebar( 'header' ); ?>
</div>
<?php
endif;
}
}
add_action( 'generate_before_header_content', 'generate_do_site_logo', 5 );
/**
* Add the site logo to our header.
* Only added if we aren't using floats to preserve backwards compatibility.
*
* @since 3.0.0
*/
function generate_do_site_logo() {
if ( ! generate_is_using_flexbox() || generate_needs_site_branding_container() ) {
return;
}
generate_construct_logo();
}
add_action( 'generate_before_header_content', 'generate_do_site_branding' );
/**
* Add the site branding to our header.
* Only added if we aren't using floats to preserve backwards compatibility.
*
* @since 3.0.0
*/
function generate_do_site_branding() {
if ( ! generate_is_using_flexbox() ) {
return;
}
generate_construct_site_title();
}
add_action( 'generate_after_header_content', 'generate_do_header_widget' );
/**
* Add the header widget to our header.
* Only used when grid isn't using floats to preserve backwards compatibility.
*
* @since 3.0.0
*/
function generate_do_header_widget() {
if ( ! generate_is_using_flexbox() ) {
return;
}
generate_construct_header_widget();
}
if ( ! function_exists( 'generate_top_bar' ) ) {
add_action( 'generate_before_header', 'generate_top_bar', 5 );
/**
* Build our top bar.
*
* @since 1.3.45
*/
function generate_top_bar() {
if ( ! is_active_sidebar( 'top-bar' ) ) {
return;
}
$inside_top_bar_class = '';
if ( 'contained' === generate_get_option( 'top_bar_inner_width' ) ) {
$inside_top_bar_class = ' grid-container grid-parent';
if ( generate_is_using_flexbox() ) {
$inside_top_bar_class = ' grid-container';
}
}
?>
<div <?php generate_do_element_classes( 'top_bar' ); ?>>
<div class="inside-top-bar<?php echo $inside_top_bar_class; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- False positive. ?>">
<?php dynamic_sidebar( 'top-bar' ); ?>
</div>
</div>
<?php
}
}
if ( ! function_exists( 'generate_pingback_header' ) ) {
add_action( 'wp_head', 'generate_pingback_header' );
/**
* Add a pingback url auto-discovery header for singularly identifiable articles.
*
* @since 1.3.42
*/
function generate_pingback_header() {
if ( is_singular() && pings_open() ) {
printf( '<link rel="pingback" href="%s">' . "\n", esc_url( get_bloginfo( 'pingback_url' ) ) );
}
}
}
if ( ! function_exists( 'generate_add_viewport' ) ) {
add_action( 'wp_head', 'generate_add_viewport' );
/**
* Add viewport to wp_head.
*
* @since 1.1.0
*/
function generate_add_viewport() {
echo apply_filters( 'generate_meta_viewport', '<meta name="viewport" content="width=device-width, initial-scale=1">' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
add_action( 'generate_before_header', 'generate_do_skip_to_content_link', 2 );
/**
* Add skip to content link before the header.
*
* @since 2.0
*/
function generate_do_skip_to_content_link() {
printf(
'<a class="screen-reader-text skip-link" href="#content" title="%1$s">%2$s</a>',
esc_attr__( 'Skip to content', 'generatepress' ),
esc_html__( 'Skip to content', 'generatepress' )
);
}
<?php
/**
* Header elements.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! function_exists( 'generate_construct_header' ) ) {
add_action( 'generate_header', 'generate_construct_header' );
/**
* Build the header.
*
* @since 1.3.42
*/
function generate_construct_header() {
?>
<header id="masthead" <?php generate_do_element_classes( 'header' ); ?>>
<div <?php generate_do_element_classes( 'inside_header' ); ?>>
<?php
/**
* generate_before_header_content hook.
*
* @since 0.1
*/
do_action( 'generate_before_header_content' );
if ( ! generate_is_using_flexbox() ) {
// Add our main header items.
generate_header_items();
}
/**
* generate_after_header_content hook.
*
* @since 0.1
*
* @hooked generate_add_navigation_float_right - 5
*/
do_action( 'generate_after_header_content' );
?>
</div>
</header>
<?php
}
}
if ( ! function_exists( 'generate_header_items' ) ) {
/**
* Build the header contents.
* Wrapping this into a function allows us to customize the order.
*
* @since 1.2.9.7
*/
function generate_header_items() {
$order = apply_filters(
'generate_header_items_order',
array(
'header-widget',
'site-branding',
'logo',
)
);
foreach ( $order as $item ) {
if ( 'header-widget' === $item ) {
generate_construct_header_widget();
}
if ( 'site-branding' === $item ) {
generate_construct_site_title();
}
if ( 'logo' === $item ) {
generate_construct_logo();
}
}
}
}
if ( ! function_exists( 'generate_construct_logo' ) ) {
/**
* Build the logo
*
* @since 1.3.28
*/
function generate_construct_logo() {
$logo_url = ( function_exists( 'the_custom_logo' ) && get_theme_mod( 'custom_logo' ) ) ? wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'full' ) : false;
$logo_url = ( $logo_url ) ? $logo_url[0] : generate_get_option( 'logo' );
$logo_url = esc_url( apply_filters( 'generate_logo', $logo_url ) );
$retina_logo_url = esc_url( apply_filters( 'generate_retina_logo', generate_get_option( 'retina_logo' ) ) );
// If we don't have a logo, bail.
if ( empty( $logo_url ) ) {
return;
}
/**
* generate_before_logo hook.
*
* @since 0.1
*/
do_action( 'generate_before_logo' );
$attr = apply_filters(
'generate_logo_attributes',
array(
'class' => 'header-image is-logo-image',
'alt' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
'src' => $logo_url,
'title' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
)
);
if ( '' !== $retina_logo_url ) {
$attr['srcset'] = $logo_url . ' 1x, ' . $retina_logo_url . ' 2x';
// Add dimensions to image if retina is set. This fixes a container width bug in Firefox.
if ( function_exists( 'the_custom_logo' ) && get_theme_mod( 'custom_logo' ) ) {
$data = wp_get_attachment_metadata( get_theme_mod( 'custom_logo' ) );
if ( ! empty( $data ) ) {
$attr['width'] = $data['width'];
$attr['height'] = $data['height'];
}
}
} elseif ( generate_is_using_flexbox() ) {
// Add this to flexbox version only until we can verify it won't conflict with existing installs.
if ( function_exists( 'the_custom_logo' ) && get_theme_mod( 'custom_logo' ) ) {
$data = wp_get_attachment_metadata( get_theme_mod( 'custom_logo' ) );
if ( ! empty( $data ) ) {
$attr['width'] = $data['width'];
$attr['height'] = $data['height'];
}
}
}
$attr = array_map( 'esc_attr', $attr );
$html_attr = '';
foreach ( $attr as $name => $value ) {
$html_attr .= " $name=" . '"' . $value . '"';
}
// Print our HTML.
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
'generate_logo_output',
sprintf(
'<div class="site-logo">
<a href="%1$s" title="%2$s" rel="home">
<img %3$s />
</a>
</div>',
esc_url( apply_filters( 'generate_logo_href', home_url( '/' ) ) ),
esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
$html_attr
),
$logo_url,
$html_attr
);
/**
* generate_after_logo hook.
*
* @since 0.1
*/
do_action( 'generate_after_logo' );
}
}
if ( ! function_exists( 'generate_construct_site_title' ) ) {
/**
* Build the site title and tagline.
*
* @since 1.3.28
*/
function generate_construct_site_title() {
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
// Get the title and tagline.
$title = get_bloginfo( 'title' );
$tagline = get_bloginfo( 'description' );
// If the disable title checkbox is checked, or the title field is empty, return true.
$disable_title = ( '1' == $generate_settings['hide_title'] || '' == $title ) ? true : false; // phpcs:ignore
// If the disable tagline checkbox is checked, or the tagline field is empty, return true.
$disable_tagline = ( '1' == $generate_settings['hide_tagline'] || '' == $tagline ) ? true : false; // phpcs:ignore
$schema_type = generate_get_schema_type();
// Build our site title.
$site_title = apply_filters(
'generate_site_title_output',
sprintf(
'<%1$s class="main-title"%4$s>
<a href="%2$s" rel="home">
%3$s
</a>
</%1$s>',
( is_front_page() && is_home() ) ? 'h1' : 'p',
esc_url( apply_filters( 'generate_site_title_href', home_url( '/' ) ) ),
get_bloginfo( 'name' ),
'microdata' === generate_get_schema_type() ? ' itemprop="headline"' : ''
)
);
// Build our tagline.
$site_tagline = apply_filters(
'generate_site_description_output',
sprintf(
'<p class="site-description"%2$s>
%1$s
</p>',
html_entity_decode( get_bloginfo( 'description', 'display' ) ), // phpcs:ignore
'microdata' === generate_get_schema_type() ? ' itemprop="description"' : ''
)
);
// Site title and tagline.
if ( false === $disable_title || false === $disable_tagline ) {
if ( generate_needs_site_branding_container() ) {
echo '<div class="site-branding-container">';
generate_construct_logo();
}
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- outputting site title and tagline. False positive.
echo apply_filters(
'generate_site_branding_output',
sprintf(
'<div class="site-branding">
%1$s
%2$s
</div>',
( ! $disable_title ) ? $site_title : '',
( ! $disable_tagline ) ? $site_tagline : ''
)
);
if ( generate_needs_site_branding_container() ) {
echo '</div>';
}
}
}
}
add_filter( 'generate_header_items_order', 'generate_reorder_inline_site_branding' );
/**
* Remove the logo from it's usual position.
*
* @since 2.3
* @param array $order Order of the header items.
*/
function generate_reorder_inline_site_branding( $order ) {
if ( ! generate_get_option( 'inline_logo_site_branding' ) || ! generate_has_logo_site_branding() ) {
return $order;
}
return array(
'header-widget',
'site-branding',
);
}
if ( ! function_exists( 'generate_construct_header_widget' ) ) {
/**
* Build the header widget.
*
* @since 1.3.28
*/
function generate_construct_header_widget() {
if ( is_active_sidebar( 'header' ) ) :
?>
<div class="header-widget">
<?php dynamic_sidebar( 'header' ); ?>
</div>
<?php
endif;
}
}
add_action( 'generate_before_header_content', 'generate_do_site_logo', 5 );
/**
* Add the site logo to our header.
* Only added if we aren't using floats to preserve backwards compatibility.
*
* @since 3.0.0
*/
function generate_do_site_logo() {
if ( ! generate_is_using_flexbox() || generate_needs_site_branding_container() ) {
return;
}
generate_construct_logo();
}
add_action( 'generate_before_header_content', 'generate_do_site_branding' );
/**
* Add the site branding to our header.
* Only added if we aren't using floats to preserve backwards compatibility.
*
* @since 3.0.0
*/
function generate_do_site_branding() {
if ( ! generate_is_using_flexbox() ) {
return;
}
generate_construct_site_title();
}
add_action( 'generate_after_header_content', 'generate_do_header_widget' );
/**
* Add the header widget to our header.
* Only used when grid isn't using floats to preserve backwards compatibility.
*
* @since 3.0.0
*/
function generate_do_header_widget() {
if ( ! generate_is_using_flexbox() ) {
return;
}
generate_construct_header_widget();
}
if ( ! function_exists( 'generate_top_bar' ) ) {
add_action( 'generate_before_header', 'generate_top_bar', 5 );
/**
* Build our top bar.
*
* @since 1.3.45
*/
function generate_top_bar() {
if ( ! is_active_sidebar( 'top-bar' ) ) {
return;
}
$inside_top_bar_class = '';
if ( 'contained' === generate_get_option( 'top_bar_inner_width' ) ) {
$inside_top_bar_class = ' grid-container grid-parent';
if ( generate_is_using_flexbox() ) {
$inside_top_bar_class = ' grid-container';
}
}
?>
<div <?php generate_do_element_classes( 'top_bar' ); ?>>
<div class="inside-top-bar<?php echo $inside_top_bar_class; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- False positive. ?>">
<?php dynamic_sidebar( 'top-bar' ); ?>
</div>
</div>
<?php
}
}
if ( ! function_exists( 'generate_pingback_header' ) ) {
add_action( 'wp_head', 'generate_pingback_header' );
/**
* Add a pingback url auto-discovery header for singularly identifiable articles.
*
* @since 1.3.42
*/
function generate_pingback_header() {
if ( is_singular() && pings_open() ) {
printf( '<link rel="pingback" href="%s">' . "\n", esc_url( get_bloginfo( 'pingback_url' ) ) );
}
}
}
if ( ! function_exists( 'generate_add_viewport' ) ) {
add_action( 'wp_head', 'generate_add_viewport' );
/**
* Add viewport to wp_head.
*
* @since 1.1.0
*/
function generate_add_viewport() {
echo apply_filters( 'generate_meta_viewport', '<meta name="viewport" content="width=device-width, initial-scale=1">' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
add_action( 'generate_before_header', 'generate_do_skip_to_content_link', 2 );
/**
* Add skip to content link before the header.
*
* @since 2.0
*/
function generate_do_skip_to_content_link() {
printf(
'<a class="screen-reader-text skip-link" href="#content" title="%1$s">%2$s</a>',
esc_attr__( 'Skip to content', 'generatepress' ),
esc_html__( 'Skip to content', 'generatepress' )
);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff