updated theme `GeneratePress` version 3.0.4

This commit is contained in:
KawaiiPunk 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,46 +1,46 @@
<?php <?php
/** /**
* The template for displaying 404 pages (Not Found). * The template for displaying 404 pages (Not Found).
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
get_header(); ?> get_header(); ?>
<div id="primary" <?php generate_do_element_classes( 'content' ); ?>> <div id="primary" <?php generate_do_element_classes( 'content' ); ?>>
<main id="main" <?php generate_do_element_classes( 'main' ); ?>> <main id="main" <?php generate_do_element_classes( 'main' ); ?>>
<?php <?php
/** /**
* generate_before_main_content hook. * generate_before_main_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_before_main_content' ); do_action( 'generate_before_main_content' );
generate_do_template_part( '404' ); generate_do_template_part( '404' );
/** /**
* generate_after_main_content hook. * generate_after_main_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_after_main_content' ); do_action( 'generate_after_main_content' );
?> ?>
</main> </main>
</div> </div>
<?php <?php
/** /**
* generate_after_primary_content_area hook. * generate_after_primary_content_area hook.
* *
* @since 2.0 * @since 2.0
*/ */
do_action( 'generate_after_primary_content_area' ); do_action( 'generate_after_primary_content_area' );
generate_construct_sidebars(); generate_construct_sidebars();
get_footer(); get_footer();

View File

@ -1,78 +1,78 @@
<?php <?php
/** /**
* The template for displaying Archive pages. * The template for displaying Archive pages.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
get_header(); ?> get_header(); ?>
<div id="primary" <?php generate_do_element_classes( 'content' ); ?>> <div id="primary" <?php generate_do_element_classes( 'content' ); ?>>
<main id="main" <?php generate_do_element_classes( 'main' ); ?>> <main id="main" <?php generate_do_element_classes( 'main' ); ?>>
<?php <?php
/** /**
* generate_before_main_content hook. * generate_before_main_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_before_main_content' ); do_action( 'generate_before_main_content' );
if ( generate_has_default_loop() ) { if ( generate_has_default_loop() ) {
if ( have_posts() ) : if ( have_posts() ) :
/** /**
* generate_archive_title hook. * generate_archive_title hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_archive_title - 10 * @hooked generate_archive_title - 10
*/ */
do_action( 'generate_archive_title' ); do_action( 'generate_archive_title' );
while ( have_posts() ) : while ( have_posts() ) :
the_post(); the_post();
generate_do_template_part( 'archive' ); generate_do_template_part( 'archive' );
endwhile; endwhile;
/** /**
* generate_after_loop hook. * generate_after_loop hook.
* *
* @since 2.3 * @since 2.3
*/ */
do_action( 'generate_after_loop', 'archive' ); do_action( 'generate_after_loop', 'archive' );
else : else :
generate_do_template_part( 'none' ); generate_do_template_part( 'none' );
endif; endif;
} }
/** /**
* generate_after_main_content hook. * generate_after_main_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_after_main_content' ); do_action( 'generate_after_main_content' );
?> ?>
</main> </main>
</div> </div>
<?php <?php
/** /**
* generate_after_primary_content_area hook. * generate_after_primary_content_area hook.
* *
* @since 2.0 * @since 2.0
*/ */
do_action( 'generate_after_primary_content_area' ); do_action( 'generate_after_primary_content_area' );
generate_construct_sidebars(); generate_construct_sidebars();
get_footer(); get_footer();

View File

@ -1,165 +1,165 @@
.block-editor-block-list__block a, .block-editor-block-list__block a,
.block-editor-block-list__block a:visited, .block-editor-block-list__block a:visited,
.block-editor-block-list__block a:hover, .block-editor-block-list__block a:hover,
.block-editor-block-list__block a:focus { .block-editor-block-list__block a:focus {
text-decoration: none; text-decoration: none;
} }
.block-editor-block-list__layout pre { .block-editor-block-list__layout pre {
background: rgba(0, 0, 0, 0.05); background: rgba(0, 0, 0, 0.05);
font-family: inherit; font-family: inherit;
font-size: inherit; font-size: inherit;
line-height: normal; line-height: normal;
margin-bottom: 1.5em; margin-bottom: 1.5em;
padding: 20px; padding: 20px;
overflow: auto; overflow: auto;
max-width: 100%; max-width: 100%;
color: inherit; /* editor only */ color: inherit; /* editor only */
} }
body .block-editor-block-list__block blockquote { body .block-editor-block-list__block blockquote {
border-left: 5px solid rgba(0, 0, 0, 0.05); border-left: 5px solid rgba(0, 0, 0, 0.05);
padding: 20px; padding: 20px;
font-size: 1.2em; font-size: 1.2em;
font-style:italic; font-style:italic;
margin: 0 0 1.5em; margin: 0 0 1.5em;
position: relative; position: relative;
color: inherit; /* editor only */ color: inherit; /* editor only */
} }
body .wp-block-quote:not(.is-large):not(.is-style-large) { body .wp-block-quote:not(.is-large):not(.is-style-large) {
border-left: 5px solid rgba(0, 0, 0, 0.05); border-left: 5px solid rgba(0, 0, 0, 0.05);
padding: 20px; padding: 20px;
} }
body .block-editor-block-list__block blockquote p:last-child { body .block-editor-block-list__block blockquote p:last-child {
margin: 0; margin: 0;
} }
.block-editor-block-list__layout table, .block-editor-block-list__layout table,
.block-editor-block-list__layout th, .block-editor-block-list__layout th,
.block-editor-block-list__layout td { .block-editor-block-list__layout td {
border: 1px solid rgba(0, 0, 0, 0.1); border: 1px solid rgba(0, 0, 0, 0.1);
} }
body .block-editor-block-list__block table { body .block-editor-block-list__block table {
border-collapse: separate; border-collapse: separate;
border-spacing: 0; border-spacing: 0;
border-width: 1px 0 0 1px; border-width: 1px 0 0 1px;
margin: 0 0 1.5em; margin: 0 0 1.5em;
width: 100%; width: 100%;
} }
.block-editor-block-list__layout th, .block-editor-block-list__layout th,
.block-editor-block-list__layout td { .block-editor-block-list__layout td {
padding: 8px; padding: 8px;
} }
.block-editor-block-list__layout th { .block-editor-block-list__layout th {
border-width: 0 1px 1px 0; border-width: 0 1px 1px 0;
} }
.block-editor-block-list__layout td { .block-editor-block-list__layout td {
border-width: 0 1px 1px 0; border-width: 0 1px 1px 0;
} }
body .block-editor-block-list__block hr { body .block-editor-block-list__block hr {
background-color: rgba(0, 0, 0, 0.1); background-color: rgba(0, 0, 0, 0.1);
border: 0; border: 0;
height: 1px; height: 1px;
margin-bottom: 40px; margin-bottom: 40px;
margin-top: 40px; margin-top: 40px;
width: auto; width: auto;
} }
body .block-editor-block-list__block, body .block-editor-block-list__block,
body .block-editor-block-list__block p { body .block-editor-block-list__block p {
font-size: inherit; font-size: inherit;
} }
body .block-editor-default-block-appender input[type=text].editor-default-block-appender__content, body .block-editor-default-block-appender input[type=text].editor-default-block-appender__content,
body .block-editor-default-block-appender textarea.editor-default-block-appender__content { body .block-editor-default-block-appender textarea.editor-default-block-appender__content {
font-family: inherit; font-family: inherit;
font-size: inherit; font-size: inherit;
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
## Gallery ## Gallery
--------------------------------------------------------------*/ --------------------------------------------------------------*/
.block-editor-block-list__layout .wp-block-gallery li figcaption { .block-editor-block-list__layout .wp-block-gallery li figcaption {
background: rgba(255, 255, 255, 0.7); background: rgba(255, 255, 255, 0.7);
color: #000; color: #000;
padding: 10px; padding: 10px;
box-sizing: border-box; box-sizing: border-box;
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
# Button # Button
--------------------------------------------------------------*/ --------------------------------------------------------------*/
.block-editor-block-list__layout .wp-block-button .wp-block-button__link { .block-editor-block-list__layout .wp-block-button .wp-block-button__link {
font-size: inherit; font-size: inherit;
padding: 10px 15px; padding: 10px 15px;
line-height: normal; line-height: normal;
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
# Content Title # Content Title
--------------------------------------------------------------*/ --------------------------------------------------------------*/
button.content-title-visibility { button.content-title-visibility {
position: absolute; position: absolute;
right: 0; right: 0;
font-size: 30px; font-size: 30px;
line-height: 30px; line-height: 30px;
top: calc(50% - 15px); top: calc(50% - 15px);
opacity: 0.4; opacity: 0.4;
background: none; background: none;
border: none; border: none;
cursor: pointer; cursor: pointer;
display: none; display: none;
} }
button.show-content-title:before { button.show-content-title:before {
content: "\f530"; content: "\f530";
} }
button.disable-content-title:before { button.disable-content-title:before {
content: "\f177"; content: "\f177";
} }
body:not(.content-title-hidden) .editor-post-title__block:hover button.disable-content-title, body:not(.content-title-hidden) .editor-post-title__block:hover button.disable-content-title,
.content-title-hidden .editor-post-title__block:hover button.show-content-title { .content-title-hidden .editor-post-title__block:hover button.show-content-title {
display: block; display: block;
} }
button.content-title-visibility:before { button.content-title-visibility:before {
font-family: dashicons; font-family: dashicons;
} }
.content-title-hidden .editor-post-title textarea { .content-title-hidden .editor-post-title textarea {
opacity: 0.4; opacity: 0.4;
} }
.edit-post-text-editor .editor-post-title__block .editor-post-title__input { .edit-post-text-editor .editor-post-title__block .editor-post-title__input {
color: initial; color: initial;
opacity: 1; opacity: 1;
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
# Columns # Columns
--------------------------------------------------------------*/ --------------------------------------------------------------*/
.block-editor-block-list__block .wp-block-columns .wp-block-column { .block-editor-block-list__block .wp-block-columns .wp-block-column {
margin-bottom: 0; margin-bottom: 0;
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
# Fix shortcode block label color # Fix shortcode block label color
--------------------------------------------------------------*/ --------------------------------------------------------------*/
.wp-block-shortcode label, .wp-block-shortcode label,
.wp-block-shortcode .block-editor-plain-text { .wp-block-shortcode .block-editor-plain-text {
color: initial; color: initial;
} }

View File

@ -1,232 +1,232 @@
.js .generate-metabox.postbox .hndle { .js .generate-metabox.postbox .hndle {
cursor: inherit; cursor: inherit;
} }
.generate-metabox .clear { .generate-metabox .clear {
padding-top: 10px; padding-top: 10px;
margin-bottom: 10px; margin-bottom: 10px;
border-bottom: 1px solid #DDD; border-bottom: 1px solid #DDD;
} }
.generate-metabox .clear:after { .generate-metabox .clear:after {
content: ""; content: "";
display: table; display: table;
clear: both; clear: both;
} }
.customize-button a.button, .customize-button a.button,
.customize-button a.button:visited { .customize-button a.button:visited {
font-size: 25px; font-size: 25px;
padding: 10px 20px; padding: 10px 20px;
line-height: normal; line-height: normal;
height: auto; height: auto;
width: 100%; width: 100%;
text-align: center; text-align: center;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
} }
.customize-button { .customize-button {
margin-bottom: 40px; margin-bottom: 40px;
} }
.addon-container:before, .addon-container:before,
.addon-container:after { .addon-container:after {
content: "."; content: ".";
display: block; display: block;
overflow: hidden; overflow: hidden;
visibility: hidden; visibility: hidden;
font-size: 0; font-size: 0;
line-height: 0; line-height: 0;
width: 0; width: 0;
height: 0; height: 0;
} }
.addon-container:after { .addon-container:after {
clear: both; clear: both;
} }
.premium-addons .gp-clear { .premium-addons .gp-clear {
margin: 0 !important; margin: 0 !important;
border: 0; border: 0;
padding: 0 !important; padding: 0 !important;
} }
.premium-addons .add-on.gp-clear { .premium-addons .add-on.gp-clear {
padding: 15px !important; padding: 15px !important;
margin: 0 !important; margin: 0 !important;
-moz-box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1) inset; -moz-box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1) inset;
-webkit-box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1) inset; -webkit-box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1) inset;
box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1) inset; box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1) inset;
} }
.premium-addons .add-on:last-child { .premium-addons .add-on:last-child {
border: 0 !important; border: 0 !important;
} }
.addon-action { .addon-action {
float: right; float: right;
clear: right; clear: right;
} }
.addon-name { .addon-name {
float: left; float: left;
} }
.addon-name a { .addon-name a {
text-decoration: none; text-decoration: none;
font-weight: bold; font-weight: bold;
} }
/* New admin */ /* New admin */
.clearfix:after, .clearfix:after,
.clearfix:before { .clearfix:before {
content: "."; content: ".";
display: block; display: block;
overflow: hidden; overflow: hidden;
visibility: hidden; visibility: hidden;
font-size: 0; font-size: 0;
line-height: 0; line-height: 0;
width: 0; width: 0;
height: 0; height: 0;
} }
.clearfix:after { .clearfix:after {
clear: both; clear: both;
} }
.gp-container { .gp-container {
max-width: 1200px; max-width: 1200px;
margin: 0 auto; margin: 0 auto;
padding: 0 20px; padding: 0 20px;
box-sizing: border-box; box-sizing: border-box;
} }
.gp-container a { .gp-container a {
text-decoration: none; text-decoration: none;
} }
.appearance_page_generate-options #wpcontent, .appearance_page_generate-options #wpcontent,
.appearance_page_generate-options #wpbody-content .metabox-holder { .appearance_page_generate-options #wpbody-content .metabox-holder {
padding: 0; padding: 0;
} }
.appearance_page_generate-options .wrap { .appearance_page_generate-options .wrap {
margin-top: 0; margin-top: 0;
margin-left: 0; margin-left: 0;
margin-right: 0; margin-right: 0;
} }
.gp-masthead { .gp-masthead {
background-color: #fff; background-color: #fff;
text-align: center; text-align: center;
box-shadow: 0 1px 0 rgba(200,215,225,0.5), 0 1px 2px #DDD; box-shadow: 0 1px 0 rgba(200,215,225,0.5), 0 1px 2px #DDD;
margin-bottom: 40px; margin-bottom: 40px;
padding: 20px; padding: 20px;
} }
.gp-container .postbox { .gp-container .postbox {
box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #DDD; box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #DDD;
border: 0; border: 0;
min-width: initial; min-width: initial;
margin-bottom: 40px; margin-bottom: 40px;
} }
.gp-masthead .gp-title { .gp-masthead .gp-title {
float: left; float: left;
} }
.gp-masthead .gp-title a { .gp-masthead .gp-title a {
font-size: 20px; font-size: 20px;
color: #000; color: #000;
font-weight: 500; font-weight: 500;
} }
.gp-masthead .gp-masthead-links { .gp-masthead .gp-masthead-links {
float: right; float: right;
} }
.gp-masthead-links a { .gp-masthead-links a {
display: inline-block; display: inline-block;
margin: 0 10px; margin: 0 10px;
} }
.gp-masthead .gp-version { .gp-masthead .gp-version {
display: inline-block; display: inline-block;
background: #EFEFEF; background: #EFEFEF;
padding: 1px 3px; padding: 1px 3px;
border-radius: 2px; border-radius: 2px;
font-size: 11px; font-size: 11px;
vertical-align: top; vertical-align: top;
margin-left: 5px; margin-left: 5px;
} }
.gp-options-footer { .gp-options-footer {
text-align: center; text-align: center;
} }
.popular-articles ul { .popular-articles ul {
list-style-type: disc; list-style-type: disc;
margin-left: 20px; margin-left: 20px;
margin-bottom: 0; margin-bottom: 0;
} }
.popular-articles .hndle a { .popular-articles .hndle a {
float:right; float:right;
font-size:13px; font-size:13px;
} }
#gen-delete p:last-child { #gen-delete p:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
.start-customizing li { .start-customizing li {
margin-bottom: 15px; margin-bottom: 15px;
} }
.start-customizing li span { .start-customizing li span {
padding-right: 5px; padding-right: 5px;
} }
.start-customizing ul { .start-customizing ul {
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
} }
.gp-container .postbox > h3.hndle { .gp-container .postbox > h3.hndle {
padding-top: 12px; padding-top: 12px;
padding-bottom: 12px; padding-bottom: 12px;
} }
@media (min-width: 768px) { @media (min-width: 768px) {
.hide-on-desktop { .hide-on-desktop {
display: none; display: none;
} }
.grid-70 { .grid-70 {
float: left; float: left;
width: 70%; width: 70%;
box-sizing: border-box; box-sizing: border-box;
padding-right: 20px; padding-right: 20px;
} }
.grid-30 { .grid-30 {
float: left; float: left;
width: 30%; width: 30%;
box-sizing: border-box; box-sizing: border-box;
padding-left: 20px; padding-left: 20px;
} }
.grid-parent { .grid-parent {
padding-left: 0; padding-left: 0;
padding-right: 0; padding-right: 0;
} }
} }
@media (max-width: 767px) { @media (max-width: 767px) {
.hide-on-mobile { .hide-on-mobile {
display: none; display: none;
} }
.gp-masthead .gp-masthead-links, .gp-masthead .gp-masthead-links,
.gp-masthead .gp-title { .gp-masthead .gp-title {
float: none; float: none;
text-align: center; text-align: center;
} }
.gp-masthead .gp-title { .gp-masthead .gp-title {
margin-bottom: 20px; margin-bottom: 20px;
} }
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,125 +1,125 @@
.comment-content a { .comment-content a {
word-wrap: break-word; word-wrap: break-word;
} }
.bypostauthor { .bypostauthor {
display: block; display: block;
} }
.comment, .comment,
.comment-list { .comment-list {
list-style-type: none; list-style-type: none;
padding: 0; padding: 0;
margin: 0; margin: 0;
} }
.comment-author-info { .comment-author-info {
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
} }
.comment-meta .avatar { .comment-meta .avatar {
float: left; float: left;
margin-right: 10px; margin-right: 10px;
border-radius: 50%; border-radius: 50%;
} }
.comment-author cite { .comment-author cite {
font-style: normal; font-style: normal;
font-weight: bold; font-weight: bold;
} }
.entry-meta.comment-metadata { .entry-meta.comment-metadata {
margin-top: 0; margin-top: 0;
} }
.comment-content { .comment-content {
margin-top: 1.5em; margin-top: 1.5em;
} }
.comment-respond { .comment-respond {
margin-top: 0; margin-top: 0;
} }
.comment-form > .form-submit { .comment-form > .form-submit {
margin-bottom: 0; margin-bottom: 0;
} }
.comment-form input, .comment-form input,
.comment-form-comment { .comment-form-comment {
margin-bottom: 10px; margin-bottom: 10px;
} }
.comment-form #author, .comment-form #author,
.comment-form #email, .comment-form #email,
.comment-form #url { .comment-form #url {
display: block; display: block;
} }
.comment-metadata .edit-link:before { .comment-metadata .edit-link:before {
display: none; display: none;
} }
.comment-body { .comment-body {
padding: 30px 0; padding: 30px 0;
} }
.comment-content { .comment-content {
padding: 30px; padding: 30px;
border: 1px solid rgba(0, 0, 0, 0.05); border: 1px solid rgba(0, 0, 0, 0.05);
} }
.depth-1.parent > .children { .depth-1.parent > .children {
border-bottom: 1px solid rgba(0, 0, 0, 0.05); border-bottom: 1px solid rgba(0, 0, 0, 0.05);
} }
.comment .children { .comment .children {
padding-left: 30px; padding-left: 30px;
margin-top: -30px; margin-top: -30px;
border-left: 1px solid rgba(0, 0, 0, 0.05); border-left: 1px solid rgba(0, 0, 0, 0.05);
} }
.pingback .comment-body, .pingback .comment-body,
.trackback .comment-body { .trackback .comment-body {
border-bottom: 1px solid rgba(0, 0, 0, 0.05); border-bottom: 1px solid rgba(0, 0, 0, 0.05);
} }
.pingback .edit-link { .pingback .edit-link {
font-size: 13px; font-size: 13px;
} }
.comment-content p:last-child { .comment-content p:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
.comment-list > .comment:first-child { .comment-list > .comment:first-child {
padding-top: 0; padding-top: 0;
margin-top: 0; margin-top: 0;
border-top: 0; border-top: 0;
} }
ol.comment-list { ol.comment-list {
margin-bottom: 1.5em; margin-bottom: 1.5em;
} }
.comment-form-cookies-consent { .comment-form-cookies-consent {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.comment-form-cookies-consent input { .comment-form-cookies-consent input {
margin-right: 0.5em; margin-right: 0.5em;
margin-bottom: 0; margin-bottom: 0;
} }
.one-container .comments-area { .one-container .comments-area {
margin-top: 1.5em; margin-top: 1.5em;
} }
.comment-content .reply { .comment-content .reply {
font-size: 85%; font-size: 85%;
} }
#cancel-comment-reply-link { #cancel-comment-reply-link {
padding-left: 10px; padding-left: 10px;
} }

View File

@ -1,162 +1,162 @@
@font-face { @font-face {
font-family: "GeneratePress"; font-family: "GeneratePress";
src: url("../../fonts/generatepress.eot"); src: url("../../fonts/generatepress.eot");
src: url("../../fonts/generatepress.eot#iefix") format("embedded-opentype"), url("../../fonts/generatepress.woff2") format("woff2"), url("../../fonts/generatepress.woff") format("woff"), url("../../fonts/generatepress.ttf") format("truetype"), url("../../fonts/generatepress.svg#GeneratePress") format("svg"); src: url("../../fonts/generatepress.eot#iefix") format("embedded-opentype"), url("../../fonts/generatepress.woff2") format("woff2"), url("../../fonts/generatepress.woff") format("woff"), url("../../fonts/generatepress.ttf") format("truetype"), url("../../fonts/generatepress.svg#GeneratePress") format("svg");
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
.menu-toggle:before, .menu-toggle:before,
.search-item a:before, .search-item a:before,
.dropdown-menu-toggle:before, .dropdown-menu-toggle:before,
.cat-links:before, .cat-links:before,
.tags-links:before, .tags-links:before,
.comments-link:before, .comments-link:before,
.nav-previous .prev:before, .nav-previous .prev:before,
.nav-next .next:before, .nav-next .next:before,
.generate-back-to-top:before { .generate-back-to-top:before {
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
font-style: normal; font-style: normal;
font-variant: normal; font-variant: normal;
text-rendering: auto; text-rendering: auto;
line-height: 1; line-height: 1;
} }
.cat-links:before, .cat-links:before,
.tags-links:before, .tags-links:before,
.comments-link:before, .comments-link:before,
.nav-previous .prev:before, .nav-previous .prev:before,
.nav-next .next:before { .nav-next .next:before {
opacity: 0.7; opacity: 0.7;
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
# Mobile Menu # Mobile Menu
--------------------------------------------------------------*/ --------------------------------------------------------------*/
.menu-toggle:before { .menu-toggle:before {
content: "\f0c9"; content: "\f0c9";
font-family: GeneratePress; font-family: GeneratePress;
width: 1.28571429em; width: 1.28571429em;
text-align: center; text-align: center;
display: inline-block; display: inline-block;
} }
.toggled .menu-toggle:before { .toggled .menu-toggle:before {
content: "\f00d"; content: "\f00d";
} }
.main-navigation.toggled .sfHover > a .dropdown-menu-toggle:before { .main-navigation.toggled .sfHover > a .dropdown-menu-toggle:before {
content: "\f106"; content: "\f106";
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
# Navigation Search # Navigation Search
--------------------------------------------------------------*/ --------------------------------------------------------------*/
.search-item a:before { .search-item a:before {
content: "\f002"; content: "\f002";
font-family: GeneratePress; font-family: GeneratePress;
width: 1.28571429em; width: 1.28571429em;
text-align: center; text-align: center;
display: inline-block; display: inline-block;
} }
.search-item.close-search a:before { .search-item.close-search a:before {
content: "\f00d"; content: "\f00d";
} }
.widget .search-form button:before { .widget .search-form button:before {
content: "\f002"; content: "\f002";
font-family: GeneratePress; font-family: GeneratePress;
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
# Navigation Dropdowns # Navigation Dropdowns
--------------------------------------------------------------*/ --------------------------------------------------------------*/
.dropdown-menu-toggle:before { .dropdown-menu-toggle:before {
content: "\f107"; content: "\f107";
font-family: GeneratePress; font-family: GeneratePress;
display: inline-block; display: inline-block;
width: 0.8em; width: 0.8em;
text-align: left; text-align: left;
} }
nav:not(.toggled) ul ul .dropdown-menu-toggle:before { nav:not(.toggled) ul ul .dropdown-menu-toggle:before {
text-align: right; text-align: right;
} }
.dropdown-hover .sub-menu-left:not(.toggled) ul ul .dropdown-menu-toggle:before { .dropdown-hover .sub-menu-left:not(.toggled) ul ul .dropdown-menu-toggle:before {
transform: rotate(180deg); transform: rotate(180deg);
} }
.dropdown-click .menu-item-has-children.sfHover > a .dropdown-menu-toggle:before { .dropdown-click .menu-item-has-children.sfHover > a .dropdown-menu-toggle:before {
content: "\f106"; content: "\f106";
} }
.dropdown-hover nav:not(.toggled) ul ul .dropdown-menu-toggle:before { .dropdown-hover nav:not(.toggled) ul ul .dropdown-menu-toggle:before {
content: "\f105"; content: "\f105";
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
# Post Content # Post Content
--------------------------------------------------------------*/ --------------------------------------------------------------*/
.entry-header .cat-links:before, .entry-header .cat-links:before,
.entry-header .tags-links:before, .entry-header .tags-links:before,
.entry-header .comments-link:before { .entry-header .comments-link:before {
display: none; display: none;
} }
.cat-links:before, .cat-links:before,
.tags-links:before, .tags-links:before,
.comments-link:before, .comments-link:before,
.nav-previous .prev:before, .nav-previous .prev:before,
.nav-next .next:before { .nav-next .next:before {
font-family: GeneratePress; font-family: GeneratePress;
text-decoration: inherit; text-decoration: inherit;
position: relative; position: relative;
margin-right: 0.6em; margin-right: 0.6em;
width: 13px; width: 13px;
text-align: center; text-align: center;
display: inline-block; display: inline-block;
} }
.cat-links:before { .cat-links:before {
content: "\f07b"; content: "\f07b";
} }
.tags-links:before { .tags-links:before {
content: "\f02c"; content: "\f02c";
} }
.comments-link:before { .comments-link:before {
content: "\f086"; content: "\f086";
} }
.nav-previous .prev:before { .nav-previous .prev:before {
content: "\f104"; content: "\f104";
} }
.nav-next .next:before { .nav-next .next:before {
content: "\f105"; content: "\f105";
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
# Sidebar Navigation # Sidebar Navigation
--------------------------------------------------------------*/ --------------------------------------------------------------*/
.dropdown-hover.both-right .inside-left-sidebar .dropdown-menu-toggle:before, .dropdown-hover.both-right .inside-left-sidebar .dropdown-menu-toggle:before,
.dropdown-hover .inside-right-sidebar .dropdown-menu-toggle:before { .dropdown-hover .inside-right-sidebar .dropdown-menu-toggle:before {
content: "\f104"; content: "\f104";
} }
.dropdown-hover.both-left .inside-right-sidebar .dropdown-menu-toggle:before, .dropdown-hover.both-left .inside-right-sidebar .dropdown-menu-toggle:before,
.dropdown-hover .inside-left-sidebar .dropdown-menu-toggle:before { .dropdown-hover .inside-left-sidebar .dropdown-menu-toggle:before {
content: "\f105"; content: "\f105";
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
# Back to Top Button # Back to Top Button
--------------------------------------------------------------*/ --------------------------------------------------------------*/
.generate-back-to-top:before { .generate-back-to-top:before {
content: "\f106"; content: "\f106";
font-family: GeneratePress; font-family: GeneratePress;
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,258 +1,258 @@
/*-------------------------------------------------------------- /*--------------------------------------------------------------
# Mobile Menu # Mobile Menu
--------------------------------------------------------------*/ --------------------------------------------------------------*/
.menu-toggle, .menu-toggle,
.mobile-bar-items, .mobile-bar-items,
.sidebar-nav-mobile { .sidebar-nav-mobile {
display: none; display: none;
} }
.menu-toggle { .menu-toggle {
padding: 0 20px; padding: 0 20px;
line-height: 60px; line-height: 60px;
margin: 0; margin: 0;
font-weight: normal; font-weight: normal;
text-transform: none; text-transform: none;
font-size: 15px; font-size: 15px;
cursor: pointer; cursor: pointer;
} }
button.menu-toggle { button.menu-toggle {
background-color: transparent; background-color: transparent;
width: 100%; width: 100%;
border: 0; border: 0;
text-align: center; text-align: center;
} }
button.menu-toggle:hover, button.menu-toggle:hover,
button.menu-toggle:active, button.menu-toggle:active,
button.menu-toggle:focus { button.menu-toggle:focus {
background-color: transparent; background-color: transparent;
} }
.menu-toggle .mobile-menu { .menu-toggle .mobile-menu {
padding-left: 3px; padding-left: 3px;
} }
.menu-toggle .gp-icon + .mobile-menu { .menu-toggle .gp-icon + .mobile-menu {
padding-left: 9px; padding-left: 9px;
} }
.menu-toggle .mobile-menu:empty { .menu-toggle .mobile-menu:empty {
display: none; display: none;
} }
.nav-search-enabled .main-navigation .menu-toggle { .nav-search-enabled .main-navigation .menu-toggle {
text-align: left; text-align: left;
} }
.mobile-bar-items { .mobile-bar-items {
display: none; display: none;
position: absolute; position: absolute;
right: 0; right: 0;
top: 0; top: 0;
z-index: 21; z-index: 21;
list-style-type: none; list-style-type: none;
} }
.mobile-bar-items a { .mobile-bar-items a {
display: inline-block; display: inline-block;
} }
nav.toggled ul ul.sub-menu { nav.toggled ul ul.sub-menu {
width: 100%; width: 100%;
} }
.dropdown-hover .main-navigation.toggled ul li:hover > ul, .dropdown-hover .main-navigation.toggled ul li:hover > ul,
.dropdown-hover .main-navigation.toggled ul li.sfHover > ul { .dropdown-hover .main-navigation.toggled ul li.sfHover > ul {
transition-delay: 0s; transition-delay: 0s;
} }
.toggled .menu-item-has-children .dropdown-menu-toggle { .toggled .menu-item-has-children .dropdown-menu-toggle {
padding-left: 20px; padding-left: 20px;
} }
.main-navigation.toggled ul ul { .main-navigation.toggled ul ul {
transition: 0s; transition: 0s;
visibility: hidden; visibility: hidden;
} }
.main-navigation.toggled .main-nav > ul { .main-navigation.toggled .main-nav > ul {
display: block; display: block;
} }
.main-navigation.toggled .main-nav ul ul.toggled-on { .main-navigation.toggled .main-nav ul ul.toggled-on {
position: relative; position: relative;
top: 0; top: 0;
left: auto !important; left: auto !important;
right: auto !important; right: auto !important;
width: 100%; width: 100%;
pointer-events: auto; pointer-events: auto;
height: auto; height: auto;
opacity: 1; opacity: 1;
display: block; display: block;
visibility: visible; visibility: visible;
float: none; float: none;
} }
.main-navigation.toggled .main-nav li { .main-navigation.toggled .main-nav li {
float: none; float: none;
clear: both; clear: both;
display: block; display: block;
text-align: left; text-align: left;
} }
.main-navigation.toggled .main-nav li.hide-on-mobile { .main-navigation.toggled .main-nav li.hide-on-mobile {
display: none !important; display: none !important;
} }
.main-navigation.toggled .menu-item-has-children .dropdown-menu-toggle { .main-navigation.toggled .menu-item-has-children .dropdown-menu-toggle {
float: right; float: right;
} }
.main-navigation.toggled .menu li.search-item { .main-navigation.toggled .menu li.search-item {
display: none !important; display: none !important;
} }
.main-navigation.toggled .sf-menu > li.menu-item-float-right { .main-navigation.toggled .sf-menu > li.menu-item-float-right {
float: none; float: none;
display: inline-block; display: inline-block;
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
# Breakpoint (768px) # Breakpoint (768px)
--------------------------------------------------------------*/ --------------------------------------------------------------*/
@media (max-width: 768px) { @media (max-width: 768px) {
/*-------------------------------------------------------------- /*--------------------------------------------------------------
## Links ## Links
--------------------------------------------------------------*/ --------------------------------------------------------------*/
a, body, button, input, select, textarea { a, body, button, input, select, textarea {
transition: all 0s ease-in-out; transition: all 0s ease-in-out;
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
## Top Bar ## Top Bar
--------------------------------------------------------------*/ --------------------------------------------------------------*/
.top-bar.top-bar-align-left, .top-bar.top-bar-align-left,
.top-bar.top-bar-align-right { .top-bar.top-bar-align-right {
text-align: center; text-align: center;
} }
.top-bar .widget { .top-bar .widget {
float: none !important; float: none !important;
margin: 0 10px !important; margin: 0 10px !important;
} }
.top-bar .widget_nav_menu li { .top-bar .widget_nav_menu li {
float: none; float: none;
display: inline-block; display: inline-block;
padding: 5px 0; padding: 5px 0;
} }
.footer-bar .widget_nav_menu li:first-child { .footer-bar .widget_nav_menu li:first-child {
margin-left: 10px; margin-left: 10px;
} }
.footer-bar .widget_nav_menu li:last-child { .footer-bar .widget_nav_menu li:last-child {
margin-right: 10px; margin-right: 10px;
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
## Header ## Header
--------------------------------------------------------------*/ --------------------------------------------------------------*/
.inside-header > *:not(:last-child):not(.main-navigation) { .inside-header > *:not(:last-child):not(.main-navigation) {
margin-bottom: 20px; margin-bottom: 20px;
} }
.site-header, .site-header,
.header-aligned-right .site-header { .header-aligned-right .site-header {
text-align: center; text-align: center;
} }
.header-widget { .header-widget {
float: none; float: none;
max-width: 100%; max-width: 100%;
text-align: center; text-align: center;
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
## Content Area ## Content Area
--------------------------------------------------------------*/ --------------------------------------------------------------*/
.sidebar, .sidebar,
.content-area, .content-area,
.inside-footer-widgets > div { .inside-footer-widgets > div {
float: none; float: none;
width: 100%; width: 100%;
left: 0; left: 0;
right: 0; right: 0;
} }
.site-main { .site-main {
margin-left: 0 !important; margin-left: 0 !important;
margin-right: 0 !important; margin-right: 0 !important;
} }
body:not(.no-sidebar) .site-main { body:not(.no-sidebar) .site-main {
margin-bottom: 0 !important; margin-bottom: 0 !important;
} }
.one-container .sidebar { .one-container .sidebar {
margin-top: 40px; margin-top: 40px;
} }
.separate-containers #left-sidebar + #right-sidebar .inside-right-sidebar { .separate-containers #left-sidebar + #right-sidebar .inside-right-sidebar {
margin-top: 0; margin-top: 0;
} }
.both-right.separate-containers .inside-left-sidebar, .both-right.separate-containers .inside-left-sidebar,
.both-left.separate-containers .inside-left-sidebar, .both-left.separate-containers .inside-left-sidebar,
.both-right.separate-containers .inside-right-sidebar, .both-right.separate-containers .inside-right-sidebar,
.both-left.separate-containers .inside-right-sidebar { .both-left.separate-containers .inside-right-sidebar {
margin-right: 0; margin-right: 0;
margin-left: 0; margin-left: 0;
} }
.alignleft, .alignleft,
.alignright { .alignright {
float: none; float: none;
display: block; display: block;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
} }
.post-image-aligned-left .post-image, .post-image-aligned-left .post-image,
.post-image-aligned-right .post-image { .post-image-aligned-right .post-image {
float: none; float: none;
margin: 2em 0; margin: 2em 0;
text-align: center; text-align: center;
} }
.comment .children { .comment .children {
padding-left: 10px; padding-left: 10px;
margin-left: 0; margin-left: 0;
} }
.edd_download { .edd_download {
display: block; display: block;
float: none !important; float: none !important;
margin-bottom: 1.5em; margin-bottom: 1.5em;
width: 100% !important; width: 100% !important;
} }
.entry-meta { .entry-meta {
font-size: inherit; font-size: inherit;
} }
.entry-meta a { .entry-meta a {
line-height: 1.8em; line-height: 1.8em;
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
## Footer ## Footer
--------------------------------------------------------------*/ --------------------------------------------------------------*/
.site-info { .site-info {
text-align: center; text-align: center;
} }
.copyright-bar { .copyright-bar {
float: none !important; float: none !important;
text-align: center !important; text-align: center !important;
} }
.footer-bar { .footer-bar {
float: none !important; float: none !important;
text-align: center !important; text-align: center !important;
margin-bottom: 20px; margin-bottom: 20px;
} }
.footer-bar .widget_nav_menu li { .footer-bar .widget_nav_menu li {
float: none; float: none;
display: inline-block; display: inline-block;
padding: 5px 0; padding: 5px 0;
} }
.inside-footer-widgets > div:not(:last-child) { .inside-footer-widgets > div:not(:last-child) {
margin-bottom: 40px; margin-bottom: 40px;
} }
.site-footer .footer-widgets .footer-widgets-container .inside-footer-widgets { .site-footer .footer-widgets .footer-widgets-container .inside-footer-widgets {
margin: 0; margin: 0;
} }
.site-footer .footer-widgets .footer-widgets-container .inner-padding { .site-footer .footer-widgets .footer-widgets-container .inner-padding {
padding: 0; padding: 0;
} }
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,127 +1,127 @@
( function() { ( function() {
'use strict'; 'use strict';
if ( 'querySelector' in document && 'addEventListener' in window ) { if ( 'querySelector' in document && 'addEventListener' in window ) {
var body = document.body; var body = document.body;
body.addEventListener( 'mousedown', function() { body.addEventListener( 'mousedown', function() {
body.classList.add( 'using-mouse' ); body.classList.add( 'using-mouse' );
} ); } );
body.addEventListener( 'keydown', function() { body.addEventListener( 'keydown', function() {
body.classList.remove( 'using-mouse' ); body.classList.remove( 'using-mouse' );
} ); } );
if ( body.classList.contains( 'dropdown-hover' ) ) { if ( body.classList.contains( 'dropdown-hover' ) ) {
var navLinks = document.querySelectorAll( 'nav .main-nav ul a' ), var navLinks = document.querySelectorAll( 'nav .main-nav ul a' ),
menuBarItems = document.querySelectorAll( '.menu-bar-items .menu-bar-item > a' ); menuBarItems = document.querySelectorAll( '.menu-bar-items .menu-bar-item > a' );
/** /**
* Make menu items tab accessible when using the hover dropdown type * Make menu items tab accessible when using the hover dropdown type
*/ */
var toggleFocus = function() { var toggleFocus = function() {
if ( this.closest( 'nav' ).classList.contains( 'toggled' ) || this.closest( 'nav' ).classList.contains( 'slideout-navigation' ) ) { if ( this.closest( 'nav' ).classList.contains( 'toggled' ) || this.closest( 'nav' ).classList.contains( 'slideout-navigation' ) ) {
return; return;
} }
var self = this; var self = this;
while ( -1 === self.className.indexOf( 'main-nav' ) ) { while ( -1 === self.className.indexOf( 'main-nav' ) ) {
if ( 'li' === self.tagName.toLowerCase() ) { if ( 'li' === self.tagName.toLowerCase() ) {
self.classList.toggle( 'sfHover' ); self.classList.toggle( 'sfHover' );
} }
self = self.parentElement; self = self.parentElement;
} }
} }
/** /**
* Make our menu bar items tab accessible. * Make our menu bar items tab accessible.
*/ */
var toggleMenuBarItemFocus = function() { var toggleMenuBarItemFocus = function() {
if ( this.closest( 'nav' ).classList.contains( 'toggled' ) || this.closest( 'nav' ).classList.contains( 'slideout-navigation' ) ) { if ( this.closest( 'nav' ).classList.contains( 'toggled' ) || this.closest( 'nav' ).classList.contains( 'slideout-navigation' ) ) {
return; return;
} }
var self = this; var self = this;
while ( -1 === self.className.indexOf( 'menu-bar-items' ) ) { while ( -1 === self.className.indexOf( 'menu-bar-items' ) ) {
if ( self.classList.contains( 'menu-bar-item' ) ) { if ( self.classList.contains( 'menu-bar-item' ) ) {
self.classList.toggle( 'sfHover' ); self.classList.toggle( 'sfHover' );
} }
self = self.parentElement; self = self.parentElement;
} }
} }
for ( var i = 0; i < navLinks.length; i++ ) { for ( var i = 0; i < navLinks.length; i++ ) {
navLinks[i].addEventListener( 'focus', toggleFocus ); navLinks[i].addEventListener( 'focus', toggleFocus );
navLinks[i].addEventListener( 'blur', toggleFocus ); navLinks[i].addEventListener( 'blur', toggleFocus );
} }
for ( var i = 0; i < menuBarItems.length; i++ ) { for ( var i = 0; i < menuBarItems.length; i++ ) {
menuBarItems[i].addEventListener( 'focus', toggleMenuBarItemFocus ); menuBarItems[i].addEventListener( 'focus', toggleMenuBarItemFocus );
menuBarItems[i].addEventListener( 'blur', toggleMenuBarItemFocus ); menuBarItems[i].addEventListener( 'blur', toggleMenuBarItemFocus );
} }
} }
} }
/** /**
* Make hover dropdown touch-friendly. * Make hover dropdown touch-friendly.
*/ */
if ( 'ontouchend' in document.documentElement && document.body.classList.contains( 'dropdown-hover' ) ) { if ( 'ontouchend' in document.documentElement && document.body.classList.contains( 'dropdown-hover' ) ) {
var parentElements = document.querySelectorAll( '.sf-menu .menu-item-has-children' ); var parentElements = document.querySelectorAll( '.sf-menu .menu-item-has-children' );
for ( var i = 0; i < parentElements.length; i++ ) { for ( var i = 0; i < parentElements.length; i++ ) {
parentElements[i].addEventListener( 'touchend', function( e ) { parentElements[i].addEventListener( 'touchend', function( e ) {
// Bail on mobile // Bail on mobile
if ( this.closest( 'nav' ).classList.contains( 'toggled' ) ) { if ( this.closest( 'nav' ).classList.contains( 'toggled' ) ) {
return; return;
} }
if ( e.touches.length === 1 || e.touches.length === 0 ) { if ( e.touches.length === 1 || e.touches.length === 0 ) {
// Prevent touch events within dropdown bubbling down to document // Prevent touch events within dropdown bubbling down to document
e.stopPropagation(); e.stopPropagation();
// Toggle hover // Toggle hover
if ( ! this.classList.contains( 'sfHover' ) ) { if ( ! this.classList.contains( 'sfHover' ) ) {
// Prevent link on first touch // Prevent link on first touch
if ( e.target === this || e.target.parentNode === this || e.target.parentNode.parentNode ) { if ( e.target === this || e.target.parentNode === this || e.target.parentNode.parentNode ) {
e.preventDefault(); e.preventDefault();
} }
var getSiblings = function( elem ) { var getSiblings = function( elem ) {
return Array.prototype.filter.call( elem.parentNode.children, function( sibling ) { return Array.prototype.filter.call( elem.parentNode.children, function( sibling ) {
return sibling !== elem; return sibling !== elem;
} ); } );
}; };
// Close other sub-menus. // Close other sub-menus.
var closestLi = this.closest( 'li' ), var closestLi = this.closest( 'li' ),
siblings = getSiblings( closestLi ); siblings = getSiblings( closestLi );
for ( var i = 0; i < siblings.length; i++ ) { for ( var i = 0; i < siblings.length; i++ ) {
if ( siblings[i].classList.contains( 'sfHover' ) ) { if ( siblings[i].classList.contains( 'sfHover' ) ) {
siblings[i].classList.remove( 'sfHover' ); siblings[i].classList.remove( 'sfHover' );
} }
} }
this.classList.add( 'sfHover' ); this.classList.add( 'sfHover' );
// Hide dropdown on touch outside // Hide dropdown on touch outside
var closeDropdown, var closeDropdown,
thisItem = this; thisItem = this;
document.addEventListener( 'touchend', closeDropdown = function(e) { document.addEventListener( 'touchend', closeDropdown = function(e) {
e.stopPropagation(); e.stopPropagation();
thisItem.classList.remove( 'sfHover' ); thisItem.classList.remove( 'sfHover' );
document.removeEventListener( 'touchend', closeDropdown ); document.removeEventListener( 'touchend', closeDropdown );
} ); } );
} }
} }
} ); } );
} }
} }
} )(); } )();

View File

@ -1,65 +1,65 @@
( function() { ( function() {
'use strict'; 'use strict';
// Feature Test // Feature Test
if ( 'querySelector' in document && 'addEventListener' in window ) { if ( 'querySelector' in document && 'addEventListener' in window ) {
var goTopBtn = document.querySelector( '.generate-back-to-top' ); var goTopBtn = document.querySelector( '.generate-back-to-top' );
var trackScroll = function() { var trackScroll = function() {
var scrolled = window.pageYOffset; var scrolled = window.pageYOffset;
var coords = goTopBtn.getAttribute( 'data-start-scroll' ) ; var coords = goTopBtn.getAttribute( 'data-start-scroll' ) ;
if ( scrolled > coords ) { if ( scrolled > coords ) {
goTopBtn.style.opacity = '1'; goTopBtn.style.opacity = '1';
goTopBtn.style.visibility = 'visible'; goTopBtn.style.visibility = 'visible';
} }
if (scrolled < coords) { if (scrolled < coords) {
goTopBtn.style.opacity = '0'; goTopBtn.style.opacity = '0';
goTopBtn.style.visibility = 'hidden'; goTopBtn.style.visibility = 'hidden';
} }
}; };
// Function to animate the scroll // Function to animate the scroll
var smoothScroll = function (anchor, duration) { var smoothScroll = function (anchor, duration) {
// Calculate how far and how fast to scroll // Calculate how far and how fast to scroll
var startLocation = window.pageYOffset; var startLocation = window.pageYOffset;
var endLocation = document.body.offsetTop; var endLocation = document.body.offsetTop;
var distance = endLocation - startLocation; var distance = endLocation - startLocation;
var increments = distance/(duration/16); var increments = distance/(duration/16);
var stopAnimation; var stopAnimation;
// Scroll the page by an increment, and check if it's time to stop // Scroll the page by an increment, and check if it's time to stop
var animateScroll = function () { var animateScroll = function () {
window.scrollBy(0, increments); window.scrollBy(0, increments);
stopAnimation(); stopAnimation();
}; };
// Stop animation when you reach the anchor OR the top of the page // Stop animation when you reach the anchor OR the top of the page
stopAnimation = function () { stopAnimation = function () {
var travelled = window.pageYOffset; var travelled = window.pageYOffset;
if ( travelled <= (endLocation || 0) ) { if ( travelled <= (endLocation || 0) ) {
clearInterval(runAnimation); clearInterval(runAnimation);
document.activeElement.blur(); document.activeElement.blur();
} }
}; };
// Loop the animation function // Loop the animation function
var runAnimation = setInterval(animateScroll, 16); var runAnimation = setInterval(animateScroll, 16);
}; };
if ( goTopBtn ) { if ( goTopBtn ) {
// Show the button when scrolling down. // Show the button when scrolling down.
window.addEventListener( 'scroll', trackScroll ); window.addEventListener( 'scroll', trackScroll );
// Scroll back to top when clicked. // Scroll back to top when clicked.
goTopBtn.addEventListener( 'click', function( e ) { goTopBtn.addEventListener( 'click', function( e ) {
e.preventDefault(); e.preventDefault();
smoothScroll( document.body, goTopBtn.getAttribute( 'data-scroll-speed' ) || 400 ); smoothScroll( document.body, goTopBtn.getAttribute( 'data-scroll-speed' ) || 400 );
}, false ); }, false );
} }
} }
} )(); } )();

View File

@ -1,124 +1,124 @@
( function() { ( function() {
'use strict'; 'use strict';
if ( 'querySelector' in document && 'addEventListener' in window ) { if ( 'querySelector' in document && 'addEventListener' in window ) {
var body = document.body; var body = document.body;
/** /**
* Dropdown click * Dropdown click
* *
* @param e The event. * @param e The event.
* @param _this The clicked item. * @param _this The clicked item.
*/ */
var dropdownClick = function( e, _this ) { var dropdownClick = function( e, _this ) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
if ( ! _this ) { if ( ! _this ) {
var _this = this; var _this = this;
} }
var closestLi = _this.closest( 'li' ); var closestLi = _this.closest( 'li' );
// Close other sub-menus // Close other sub-menus
var openedSubMenus = _this.closest( 'nav' ).querySelectorAll( 'ul.toggled-on' ); var openedSubMenus = _this.closest( 'nav' ).querySelectorAll( 'ul.toggled-on' );
if ( openedSubMenus && ! _this.closest( 'ul' ).classList.contains( 'toggled-on' ) && ! _this.closest( 'li' ).classList.contains( 'sfHover' ) ) { if ( openedSubMenus && ! _this.closest( 'ul' ).classList.contains( 'toggled-on' ) && ! _this.closest( 'li' ).classList.contains( 'sfHover' ) ) {
for ( var o = 0; o < openedSubMenus.length; o++ ) { for ( var o = 0; o < openedSubMenus.length; o++ ) {
openedSubMenus[o].classList.remove( 'toggled-on' ); openedSubMenus[o].classList.remove( 'toggled-on' );
openedSubMenus[o].closest( 'li' ).classList.remove( 'sfHover' ); openedSubMenus[o].closest( 'li' ).classList.remove( 'sfHover' );
} }
} }
// Add sfHover class to parent li // Add sfHover class to parent li
closestLi.classList.toggle( 'sfHover' ); closestLi.classList.toggle( 'sfHover' );
// Set aria-expanded on arrow // Set aria-expanded on arrow
var dropdownToggle = closestLi.querySelector( '.dropdown-menu-toggle' ); var dropdownToggle = closestLi.querySelector( '.dropdown-menu-toggle' );
if ( 'false' === dropdownToggle.getAttribute( 'aria-expanded' ) || ! dropdownToggle.getAttribute( 'aria-expanded' ) ) { if ( 'false' === dropdownToggle.getAttribute( 'aria-expanded' ) || ! dropdownToggle.getAttribute( 'aria-expanded' ) ) {
dropdownToggle.setAttribute( 'aria-expanded', 'true' ); dropdownToggle.setAttribute( 'aria-expanded', 'true' );
} else { } else {
dropdownToggle.setAttribute( 'aria-expanded', 'false' ); dropdownToggle.setAttribute( 'aria-expanded', 'false' );
} }
if ( closestLi.querySelector( '.sub-menu' ) ) { if ( closestLi.querySelector( '.sub-menu' ) ) {
var subMenuSelector = '.sub-menu'; var subMenuSelector = '.sub-menu';
} else { } else {
var subMenuSelector = '.children'; var subMenuSelector = '.children';
} }
// Open the sub-menu // Open the sub-menu
if ( body.classList.contains( 'dropdown-click-menu-item' ) ) { if ( body.classList.contains( 'dropdown-click-menu-item' ) ) {
_this.parentNode.querySelector( subMenuSelector ).classList.toggle( 'toggled-on' ); _this.parentNode.querySelector( subMenuSelector ).classList.toggle( 'toggled-on' );
} else if ( body.classList.contains( 'dropdown-click-arrow' ) ) { } else if ( body.classList.contains( 'dropdown-click-arrow' ) ) {
closestLi.querySelector( subMenuSelector ).classList.toggle( 'toggled-on' ); closestLi.querySelector( subMenuSelector ).classList.toggle( 'toggled-on' );
} }
} }
// Do stuff if click dropdown if enabled // Do stuff if click dropdown if enabled
var parentElementLinks = document.querySelectorAll( '.main-nav .menu-item-has-children > a' ); var parentElementLinks = document.querySelectorAll( '.main-nav .menu-item-has-children > a' );
// Open the sub-menu by clicking on the entire link element // Open the sub-menu by clicking on the entire link element
if ( body.classList.contains( 'dropdown-click-menu-item' ) ) { if ( body.classList.contains( 'dropdown-click-menu-item' ) ) {
for ( var i = 0; i < parentElementLinks.length; i++ ) { for ( var i = 0; i < parentElementLinks.length; i++ ) {
parentElementLinks[i].addEventListener( 'click', dropdownClick, true ); parentElementLinks[i].addEventListener( 'click', dropdownClick, true );
} }
} }
// Open the sub-menu by clicking on a dropdown arrow // Open the sub-menu by clicking on a dropdown arrow
if ( body.classList.contains( 'dropdown-click-arrow' ) ) { if ( body.classList.contains( 'dropdown-click-arrow' ) ) {
// Add a class to sub-menu items that are set to # // Add a class to sub-menu items that are set to #
for ( var i = 0; i < document.querySelectorAll( '.main-nav .menu-item-has-children > a' ).length; i++ ) { for ( var i = 0; i < document.querySelectorAll( '.main-nav .menu-item-has-children > a' ).length; i++ ) {
if ( '#' == document.querySelectorAll( '.main-nav .menu-item-has-children > a' )[i].getAttribute( 'href' ) ) { if ( '#' == document.querySelectorAll( '.main-nav .menu-item-has-children > a' )[i].getAttribute( 'href' ) ) {
document.querySelectorAll( '.main-nav .menu-item-has-children > a' )[i].classList.add( 'menu-item-dropdown-click' ); document.querySelectorAll( '.main-nav .menu-item-has-children > a' )[i].classList.add( 'menu-item-dropdown-click' );
} }
} }
var dropdownToggleLinks = document.querySelectorAll( '.main-nav .menu-item-has-children > a .dropdown-menu-toggle' ); var dropdownToggleLinks = document.querySelectorAll( '.main-nav .menu-item-has-children > a .dropdown-menu-toggle' );
for ( var i = 0; i < dropdownToggleLinks.length; i++ ) { for ( var i = 0; i < dropdownToggleLinks.length; i++ ) {
dropdownToggleLinks[i].addEventListener( 'click', dropdownClick, false ); dropdownToggleLinks[i].addEventListener( 'click', dropdownClick, false );
dropdownToggleLinks[i].addEventListener( 'keydown', function( e ) { dropdownToggleLinks[i].addEventListener( 'keydown', function( e ) {
var _this = this; var _this = this;
var key = e.which || e.keyCode; var key = e.which || e.keyCode;
if ( key === 13 ) { // 13 is enter if ( key === 13 ) { // 13 is enter
dropdownClick( e, _this ); dropdownClick( e, _this );
} }
}, false ); }, false );
} }
for ( var i = 0; i < document.querySelectorAll( '.main-nav .menu-item-has-children > a.menu-item-dropdown-click' ).length; i++ ) { for ( var i = 0; i < document.querySelectorAll( '.main-nav .menu-item-has-children > a.menu-item-dropdown-click' ).length; i++ ) {
document.querySelectorAll( '.main-nav .menu-item-has-children > a.menu-item-dropdown-click' )[i].addEventListener( 'click', dropdownClick, false ); document.querySelectorAll( '.main-nav .menu-item-has-children > a.menu-item-dropdown-click' )[i].addEventListener( 'click', dropdownClick, false );
} }
} }
var closeSubMenus = function() { var closeSubMenus = function() {
if ( document.querySelector( 'nav ul .toggled-on' ) ) { if ( document.querySelector( 'nav ul .toggled-on' ) ) {
var activeSubMenus = document.querySelectorAll( 'nav ul .toggled-on' ); var activeSubMenus = document.querySelectorAll( 'nav ul .toggled-on' );
var activeDropdownToggles = document.querySelectorAll( 'nav .dropdown-menu-toggle' ); var activeDropdownToggles = document.querySelectorAll( 'nav .dropdown-menu-toggle' );
for ( var i = 0; i < activeSubMenus.length; i++ ) { for ( var i = 0; i < activeSubMenus.length; i++ ) {
activeSubMenus[i].classList.remove( 'toggled-on' ); activeSubMenus[i].classList.remove( 'toggled-on' );
activeSubMenus[i].closest( '.sfHover' ).classList.remove( 'sfHover' ); activeSubMenus[i].closest( '.sfHover' ).classList.remove( 'sfHover' );
} }
for ( var i = 0; i < activeDropdownToggles.length; i++ ) { for ( var i = 0; i < activeDropdownToggles.length; i++ ) {
activeDropdownToggles[i].setAttribute( 'aria-expanded', 'false' ); activeDropdownToggles[i].setAttribute( 'aria-expanded', 'false' );
} }
} }
} }
// Close sub-menus when clicking elsewhere // Close sub-menus when clicking elsewhere
document.addEventListener( 'click', function ( event ) { document.addEventListener( 'click', function ( event ) {
if ( ! event.target.closest( '.sfHover' ) ) { if ( ! event.target.closest( '.sfHover' ) ) {
closeSubMenus(); closeSubMenus();
} }
}, false); }, false);
// Close sub-menus on escape key // Close sub-menus on escape key
document.addEventListener( 'keydown', function( e ) { document.addEventListener( 'keydown', function( e ) {
var key = e.which || e.keyCode; var key = e.which || e.keyCode;
if ( key === 27 ) { // 27 is esc if ( key === 27 ) { // 27 is esc
closeSubMenus(); closeSubMenus();
} }
}, false ); }, false );
} }
})(); })();

View File

@ -1,430 +1,430 @@
( function() { ( function() {
'use strict'; 'use strict';
if ( 'querySelector' in document && 'addEventListener' in window ) { if ( 'querySelector' in document && 'addEventListener' in window ) {
/** /**
* matches() pollyfil * matches() pollyfil
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Browser_compatibility * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Browser_compatibility
*/ */
if ( ! Element.prototype.matches ) { if ( ! Element.prototype.matches ) {
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
} }
/** /**
* closest() pollyfil * closest() pollyfil
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Browser_compatibility * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Browser_compatibility
*/ */
if ( ! Element.prototype.closest ) { if ( ! Element.prototype.closest ) {
Element.prototype.closest = function( s ) { Element.prototype.closest = function( s ) {
var el = this; var el = this;
var ancestor = this; var ancestor = this;
if ( ! document.documentElement.contains( el ) ) { if ( ! document.documentElement.contains( el ) ) {
return null; return null;
} }
do { do {
if ( ancestor.matches( s ) ) { if ( ancestor.matches( s ) ) {
return ancestor; return ancestor;
} }
ancestor = ancestor.parentElement; ancestor = ancestor.parentElement;
} while ( ancestor !== null ); } while ( ancestor !== null );
return null; return null;
}; };
} }
var getSiblings = function( elem ) { var getSiblings = function( elem ) {
return Array.prototype.filter.call( elem.parentNode.children, function( sibling ) { return Array.prototype.filter.call( elem.parentNode.children, function( sibling ) {
return sibling !== elem; return sibling !== elem;
} ); } );
}; };
var allNavToggles = document.querySelectorAll( '.menu-toggle' ), var allNavToggles = document.querySelectorAll( '.menu-toggle' ),
dropdownToggle = document.querySelectorAll( 'nav .dropdown-menu-toggle' ), dropdownToggle = document.querySelectorAll( 'nav .dropdown-menu-toggle' ),
navLinks = document.querySelectorAll( 'nav ul a' ), navLinks = document.querySelectorAll( 'nav ul a' ),
mobileMenuControls = document.querySelector( '.mobile-menu-control-wrapper' ), mobileMenuControls = document.querySelector( '.mobile-menu-control-wrapper' ),
body = document.body, body = document.body,
htmlEl = document.documentElement; htmlEl = document.documentElement;
var enableDropdownArrows = function( nav ) { var enableDropdownArrows = function( nav ) {
if ( body.classList.contains( 'dropdown-hover' ) ) { if ( body.classList.contains( 'dropdown-hover' ) ) {
var dropdownItems = nav.querySelectorAll( 'li.menu-item-has-children' ); var dropdownItems = nav.querySelectorAll( 'li.menu-item-has-children' );
for ( var i = 0; i < dropdownItems.length; i++ ) { for ( var i = 0; i < dropdownItems.length; i++ ) {
dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'tabindex', '0' ); dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'tabindex', '0' );
dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'role', 'button' ); dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'role', 'button' );
dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'aria-expanded', 'false' ); dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'aria-expanded', 'false' );
dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'aria-label', generatepressMenu.openSubMenuLabel ); dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'aria-label', generatepressMenu.openSubMenuLabel );
} }
} }
}; };
var disableDropdownArrows = function( nav ) { var disableDropdownArrows = function( nav ) {
if ( body.classList.contains( 'dropdown-hover' ) ) { if ( body.classList.contains( 'dropdown-hover' ) ) {
var dropdownItems = nav.querySelectorAll( 'li.menu-item-has-children' ); var dropdownItems = nav.querySelectorAll( 'li.menu-item-has-children' );
for ( var i = 0; i < dropdownItems.length; i++ ) { for ( var i = 0; i < dropdownItems.length; i++ ) {
dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).removeAttribute( 'tabindex' ); dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).removeAttribute( 'tabindex' );
dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'role', 'presentation' ); dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'role', 'presentation' );
dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).removeAttribute( 'aria-expanded' ); dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).removeAttribute( 'aria-expanded' );
dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).removeAttribute( 'aria-label' ); dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).removeAttribute( 'aria-label' );
} }
} }
}; };
var setDropdownArrowAttributes = function( arrow ) { var setDropdownArrowAttributes = function( arrow ) {
if ( 'false' === arrow.getAttribute( 'aria-expanded' ) || ! arrow.getAttribute( 'aria-expanded' ) ) { if ( 'false' === arrow.getAttribute( 'aria-expanded' ) || ! arrow.getAttribute( 'aria-expanded' ) ) {
arrow.setAttribute( 'aria-expanded', 'true' ); arrow.setAttribute( 'aria-expanded', 'true' );
arrow.setAttribute( 'aria-label', generatepressMenu.closeSubMenuLabel ); arrow.setAttribute( 'aria-label', generatepressMenu.closeSubMenuLabel );
} else { } else {
arrow.setAttribute( 'aria-expanded', 'false' ); arrow.setAttribute( 'aria-expanded', 'false' );
arrow.setAttribute( 'aria-label', generatepressMenu.openSubMenuLabel ); arrow.setAttribute( 'aria-label', generatepressMenu.openSubMenuLabel );
} }
}; };
/** /**
* Start mobile menu toggle. * Start mobile menu toggle.
* *
* @param e The event. * @param e The event.
* @param _this The clicked item. * @param _this The clicked item.
*/ */
var toggleNav = function( e, _this ) { var toggleNav = function( e, _this ) {
if ( ! _this ) { if ( ! _this ) {
var _this = this; var _this = this;
} }
var parentContainer = ''; var parentContainer = '';
if ( _this.getAttribute( 'data-nav' ) ) { if ( _this.getAttribute( 'data-nav' ) ) {
parentContainer = document.getElementById( _this.getAttribute( 'data-nav' ) ); parentContainer = document.getElementById( _this.getAttribute( 'data-nav' ) );
} else { } else {
parentContainer = document.getElementById( _this.closest( 'nav' ).getAttribute( 'id' ) ); parentContainer = document.getElementById( _this.closest( 'nav' ).getAttribute( 'id' ) );
} }
if ( ! parentContainer ) { if ( ! parentContainer ) {
return; return;
} }
var isExternalToggle = false; var isExternalToggle = false;
if ( _this.closest( '.mobile-menu-control-wrapper' ) ) { if ( _this.closest( '.mobile-menu-control-wrapper' ) ) {
isExternalToggle = true; isExternalToggle = true;
} }
var nav = parentContainer.getElementsByTagName( 'ul' )[0]; var nav = parentContainer.getElementsByTagName( 'ul' )[0];
if ( parentContainer.classList.contains( 'toggled' ) ) { if ( parentContainer.classList.contains( 'toggled' ) ) {
parentContainer.classList.remove( 'toggled' ); parentContainer.classList.remove( 'toggled' );
htmlEl.classList.remove( 'mobile-menu-open' ); htmlEl.classList.remove( 'mobile-menu-open' );
nav.setAttribute( 'aria-hidden', 'true' ); nav.setAttribute( 'aria-hidden', 'true' );
_this.setAttribute( 'aria-expanded', 'false' ); _this.setAttribute( 'aria-expanded', 'false' );
if ( isExternalToggle ) { if ( isExternalToggle ) {
mobileMenuControls.classList.remove( 'toggled' ); mobileMenuControls.classList.remove( 'toggled' );
} else if ( mobileMenuControls && parentContainer.classList.contains( 'main-navigation' ) ) { } else if ( mobileMenuControls && parentContainer.classList.contains( 'main-navigation' ) ) {
mobileMenuControls.classList.remove( 'toggled' ); mobileMenuControls.classList.remove( 'toggled' );
} }
disableDropdownArrows( nav ); disableDropdownArrows( nav );
} else { } else {
parentContainer.classList.add( 'toggled' ); parentContainer.classList.add( 'toggled' );
htmlEl.classList.add( 'mobile-menu-open' ); htmlEl.classList.add( 'mobile-menu-open' );
nav.setAttribute( 'aria-hidden', 'false' ); nav.setAttribute( 'aria-hidden', 'false' );
_this.setAttribute( 'aria-expanded', 'true' ); _this.setAttribute( 'aria-expanded', 'true' );
if ( isExternalToggle ) { if ( isExternalToggle ) {
mobileMenuControls.classList.add( 'toggled' ); mobileMenuControls.classList.add( 'toggled' );
if ( mobileMenuControls.querySelector( '.search-item' ) ) { if ( mobileMenuControls.querySelector( '.search-item' ) ) {
if ( mobileMenuControls.querySelector( '.search-item' ).classList.contains( 'active' ) ) { if ( mobileMenuControls.querySelector( '.search-item' ).classList.contains( 'active' ) ) {
mobileMenuControls.querySelector( '.search-item' ).click(); mobileMenuControls.querySelector( '.search-item' ).click();
} }
} }
} else if ( mobileMenuControls && parentContainer.classList.contains( 'main-navigation' ) ) { } else if ( mobileMenuControls && parentContainer.classList.contains( 'main-navigation' ) ) {
mobileMenuControls.classList.add( 'toggled' ); mobileMenuControls.classList.add( 'toggled' );
} }
enableDropdownArrows( nav ); enableDropdownArrows( nav );
} }
} }
for ( var i = 0; i < allNavToggles.length; i++ ) { for ( var i = 0; i < allNavToggles.length; i++ ) {
allNavToggles[i].addEventListener( 'click', toggleNav, false ); allNavToggles[i].addEventListener( 'click', toggleNav, false );
} }
/** /**
* Open sub-menus * Open sub-menus
* *
* @param e The event. * @param e The event.
* @param _this The clicked item. * @param _this The clicked item.
*/ */
var toggleSubNav = function( e, _this ) { var toggleSubNav = function( e, _this ) {
if ( ! _this ) { if ( ! _this ) {
var _this = this; var _this = this;
} }
if ( ( _this.closest( 'nav' ).classList.contains( 'toggled' ) || htmlEl.classList.contains( 'slide-opened' ) ) && ! body.classList.contains( 'dropdown-click' ) ) { if ( ( _this.closest( 'nav' ).classList.contains( 'toggled' ) || htmlEl.classList.contains( 'slide-opened' ) ) && ! body.classList.contains( 'dropdown-click' ) ) {
e.preventDefault(); e.preventDefault();
var closestLi = _this.closest( 'li' ); var closestLi = _this.closest( 'li' );
setDropdownArrowAttributes( closestLi.querySelector( '.dropdown-menu-toggle' ) ); setDropdownArrowAttributes( closestLi.querySelector( '.dropdown-menu-toggle' ) );
if ( closestLi.querySelector( '.sub-menu' ) ) { if ( closestLi.querySelector( '.sub-menu' ) ) {
var subMenu = closestLi.querySelector( '.sub-menu' ); var subMenu = closestLi.querySelector( '.sub-menu' );
} else { } else {
var subMenu = closestLi.querySelector( '.children' ); var subMenu = closestLi.querySelector( '.children' );
} }
if ( generatepressMenu.toggleOpenedSubMenus ) { if ( generatepressMenu.toggleOpenedSubMenus ) {
var siblings = getSiblings( closestLi ); var siblings = getSiblings( closestLi );
for ( var i = 0; i < siblings.length; i++ ) { for ( var i = 0; i < siblings.length; i++ ) {
if ( siblings[i].classList.contains( 'sfHover' ) ) { if ( siblings[i].classList.contains( 'sfHover' ) ) {
siblings[i].classList.remove( 'sfHover' ); siblings[i].classList.remove( 'sfHover' );
siblings[i].querySelector( '.toggled-on' ).classList.remove( 'toggled-on' ); siblings[i].querySelector( '.toggled-on' ).classList.remove( 'toggled-on' );
setDropdownArrowAttributes( siblings[i].querySelector( '.dropdown-menu-toggle' ) ); setDropdownArrowAttributes( siblings[i].querySelector( '.dropdown-menu-toggle' ) );
} }
} }
} }
closestLi.classList.toggle( 'sfHover' ); closestLi.classList.toggle( 'sfHover' );
subMenu.classList.toggle( 'toggled-on' ); subMenu.classList.toggle( 'toggled-on' );
} }
e.stopPropagation(); e.stopPropagation();
} }
for ( var i = 0; i < dropdownToggle.length; i++ ) { for ( var i = 0; i < dropdownToggle.length; i++ ) {
dropdownToggle[i].addEventListener( 'click', toggleSubNav, false ); dropdownToggle[i].addEventListener( 'click', toggleSubNav, false );
dropdownToggle[i].addEventListener( 'keypress', function( e ) { dropdownToggle[i].addEventListener( 'keypress', function( e ) {
var key = e.which || e.keyCode; var key = e.which || e.keyCode;
if (key === 13) { // 13 is enter if (key === 13) { // 13 is enter
toggleSubNav( e, this ); toggleSubNav( e, this );
} }
}, false ); }, false );
} }
/** /**
* Disable the mobile menu if our toggle isn't visible. * Disable the mobile menu if our toggle isn't visible.
* Makes it possible to style mobile item with .toggled class. * Makes it possible to style mobile item with .toggled class.
*/ */
var checkMobile = function() { var checkMobile = function() {
var openedMobileMenus = document.querySelectorAll( '.toggled, .has-active-search' ); var openedMobileMenus = document.querySelectorAll( '.toggled, .has-active-search' );
for ( var i = 0; i < openedMobileMenus.length; i++ ) { for ( var i = 0; i < openedMobileMenus.length; i++ ) {
var menuToggle = openedMobileMenus[i].querySelector( '.menu-toggle' ); var menuToggle = openedMobileMenus[i].querySelector( '.menu-toggle' );
if ( mobileMenuControls && ! menuToggle.closest( 'nav' ).classList.contains( 'mobile-menu-control-wrapper' ) ) { if ( mobileMenuControls && ! menuToggle.closest( 'nav' ).classList.contains( 'mobile-menu-control-wrapper' ) ) {
menuToggle = mobileMenuControls.querySelector( '.menu-toggle' ); menuToggle = mobileMenuControls.querySelector( '.menu-toggle' );
} }
if ( menuToggle && menuToggle.offsetParent === null ) { if ( menuToggle && menuToggle.offsetParent === null ) {
if ( openedMobileMenus[i].classList.contains( 'toggled' ) ) { if ( openedMobileMenus[i].classList.contains( 'toggled' ) ) {
var remoteNav = false; var remoteNav = false;
if ( openedMobileMenus[i].classList.contains( 'mobile-menu-control-wrapper' ) ) { if ( openedMobileMenus[i].classList.contains( 'mobile-menu-control-wrapper' ) ) {
remoteNav = true; remoteNav = true;
} }
if ( ! remoteNav ) { if ( ! remoteNav ) {
// Navigation is toggled, but .menu-toggle isn't visible on the page (display: none). // Navigation is toggled, but .menu-toggle isn't visible on the page (display: none).
var closestNav = openedMobileMenus[i].getElementsByTagName( 'ul' )[ 0 ], var closestNav = openedMobileMenus[i].getElementsByTagName( 'ul' )[ 0 ],
closestNavItems = closestNav.getElementsByTagName( 'li' ), closestNavItems = closestNav.getElementsByTagName( 'li' ),
closestSubMenus = closestNav.getElementsByTagName( 'ul' ); closestSubMenus = closestNav.getElementsByTagName( 'ul' );
} }
document.activeElement.blur(); document.activeElement.blur();
openedMobileMenus[i].classList.remove( 'toggled' ); openedMobileMenus[i].classList.remove( 'toggled' );
htmlEl.classList.remove( 'mobile-menu-open' ); htmlEl.classList.remove( 'mobile-menu-open' );
menuToggle.setAttribute( 'aria-expanded', 'false' ); menuToggle.setAttribute( 'aria-expanded', 'false' );
if ( ! remoteNav ) { if ( ! remoteNav ) {
for ( var li = 0; li < closestNavItems.length; li++ ) { for ( var li = 0; li < closestNavItems.length; li++ ) {
closestNavItems[li].classList.remove( 'sfHover' ); closestNavItems[li].classList.remove( 'sfHover' );
} }
for ( var sm = 0; sm < closestSubMenus.length; sm++ ) { for ( var sm = 0; sm < closestSubMenus.length; sm++ ) {
closestSubMenus[sm].classList.remove( 'toggled-on' ); closestSubMenus[sm].classList.remove( 'toggled-on' );
} }
if ( closestNav ) { if ( closestNav ) {
closestNav.removeAttribute( 'aria-hidden' ); closestNav.removeAttribute( 'aria-hidden' );
} }
} }
disableDropdownArrows( openedMobileMenus[i] ); disableDropdownArrows( openedMobileMenus[i] );
} }
if ( mobileMenuControls.querySelector( '.search-item' ) ) { if ( mobileMenuControls.querySelector( '.search-item' ) ) {
if ( mobileMenuControls.querySelector( '.search-item' ).classList.contains( 'active' ) ) { if ( mobileMenuControls.querySelector( '.search-item' ).classList.contains( 'active' ) ) {
mobileMenuControls.querySelector( '.search-item' ).click(); mobileMenuControls.querySelector( '.search-item' ).click();
} }
} }
} }
} }
} }
window.addEventListener( 'resize', checkMobile, false ); window.addEventListener( 'resize', checkMobile, false );
window.addEventListener( 'orientationchange', checkMobile, false ); window.addEventListener( 'orientationchange', checkMobile, false );
if ( body.classList.contains( 'dropdown-hover' ) ) { if ( body.classList.contains( 'dropdown-hover' ) ) {
/** /**
* Do some essential things when menu items are clicked. * Do some essential things when menu items are clicked.
*/ */
for ( var i = 0; i < navLinks.length; i++ ) { for ( var i = 0; i < navLinks.length; i++ ) {
navLinks[i].addEventListener( 'click', function( e ) { navLinks[i].addEventListener( 'click', function( e ) {
// Remove sfHover class if we're going to another site. // Remove sfHover class if we're going to another site.
if ( this.hostname !== window.location.hostname ) { if ( this.hostname !== window.location.hostname ) {
document.activeElement.blur(); document.activeElement.blur();
} }
var closest_nav = this.closest( 'nav' ); var closest_nav = this.closest( 'nav' );
if ( closest_nav.classList.contains( 'toggled' ) || htmlEl.classList.contains( 'slide-opened' ) ) { if ( closest_nav.classList.contains( 'toggled' ) || htmlEl.classList.contains( 'slide-opened' ) ) {
var url = this.getAttribute( 'href' ); var url = this.getAttribute( 'href' );
// Open the sub-menu if the link has no destination // Open the sub-menu if the link has no destination
if ( '#' == url || '' == url ) { if ( '#' == url || '' == url ) {
e.preventDefault(); e.preventDefault();
var closestLi = this.closest( 'li' ); var closestLi = this.closest( 'li' );
closestLi.classList.toggle( 'sfHover' ); closestLi.classList.toggle( 'sfHover' );
var subMenu = closestLi.querySelector( '.sub-menu' ); var subMenu = closestLi.querySelector( '.sub-menu' );
if ( subMenu ) { if ( subMenu ) {
subMenu.classList.toggle( 'toggled-on' ); subMenu.classList.toggle( 'toggled-on' );
} }
} }
} }
}, false ); }, false );
} }
} }
} }
})(); })();
( function() { ( function() {
'use strict'; 'use strict';
if ( 'querySelector' in document && 'addEventListener' in window ) { if ( 'querySelector' in document && 'addEventListener' in window ) {
var body = document.body; var body = document.body;
body.addEventListener( 'mousedown', function() { body.addEventListener( 'mousedown', function() {
body.classList.add( 'using-mouse' ); body.classList.add( 'using-mouse' );
} ); } );
body.addEventListener( 'keydown', function() { body.addEventListener( 'keydown', function() {
body.classList.remove( 'using-mouse' ); body.classList.remove( 'using-mouse' );
} ); } );
if ( body.classList.contains( 'dropdown-hover' ) ) { if ( body.classList.contains( 'dropdown-hover' ) ) {
var navLinks = document.querySelectorAll( 'nav .main-nav ul a' ), var navLinks = document.querySelectorAll( 'nav .main-nav ul a' ),
menuBarItems = document.querySelectorAll( '.menu-bar-items .menu-bar-item > a' ); menuBarItems = document.querySelectorAll( '.menu-bar-items .menu-bar-item > a' );
/** /**
* Make menu items tab accessible when using the hover dropdown type * Make menu items tab accessible when using the hover dropdown type
*/ */
var toggleFocus = function() { var toggleFocus = function() {
if ( this.closest( 'nav' ).classList.contains( 'toggled' ) || this.closest( 'nav' ).classList.contains( 'slideout-navigation' ) ) { if ( this.closest( 'nav' ).classList.contains( 'toggled' ) || this.closest( 'nav' ).classList.contains( 'slideout-navigation' ) ) {
return; return;
} }
var self = this; var self = this;
while ( -1 === self.className.indexOf( 'main-nav' ) ) { while ( -1 === self.className.indexOf( 'main-nav' ) ) {
if ( 'li' === self.tagName.toLowerCase() ) { if ( 'li' === self.tagName.toLowerCase() ) {
self.classList.toggle( 'sfHover' ); self.classList.toggle( 'sfHover' );
} }
self = self.parentElement; self = self.parentElement;
} }
} }
/** /**
* Make our menu bar items tab accessible. * Make our menu bar items tab accessible.
*/ */
var toggleMenuBarItemFocus = function() { var toggleMenuBarItemFocus = function() {
if ( this.closest( 'nav' ).classList.contains( 'toggled' ) || this.closest( 'nav' ).classList.contains( 'slideout-navigation' ) ) { if ( this.closest( 'nav' ).classList.contains( 'toggled' ) || this.closest( 'nav' ).classList.contains( 'slideout-navigation' ) ) {
return; return;
} }
var self = this; var self = this;
while ( -1 === self.className.indexOf( 'menu-bar-items' ) ) { while ( -1 === self.className.indexOf( 'menu-bar-items' ) ) {
if ( self.classList.contains( 'menu-bar-item' ) ) { if ( self.classList.contains( 'menu-bar-item' ) ) {
self.classList.toggle( 'sfHover' ); self.classList.toggle( 'sfHover' );
} }
self = self.parentElement; self = self.parentElement;
} }
} }
for ( var i = 0; i < navLinks.length; i++ ) { for ( var i = 0; i < navLinks.length; i++ ) {
navLinks[i].addEventListener( 'focus', toggleFocus ); navLinks[i].addEventListener( 'focus', toggleFocus );
navLinks[i].addEventListener( 'blur', toggleFocus ); navLinks[i].addEventListener( 'blur', toggleFocus );
} }
for ( var i = 0; i < menuBarItems.length; i++ ) { for ( var i = 0; i < menuBarItems.length; i++ ) {
menuBarItems[i].addEventListener( 'focus', toggleMenuBarItemFocus ); menuBarItems[i].addEventListener( 'focus', toggleMenuBarItemFocus );
menuBarItems[i].addEventListener( 'blur', toggleMenuBarItemFocus ); menuBarItems[i].addEventListener( 'blur', toggleMenuBarItemFocus );
} }
} }
} }
/** /**
* Make hover dropdown touch-friendly. * Make hover dropdown touch-friendly.
*/ */
if ( 'ontouchend' in document.documentElement && document.body.classList.contains( 'dropdown-hover' ) ) { if ( 'ontouchend' in document.documentElement && document.body.classList.contains( 'dropdown-hover' ) ) {
var parentElements = document.querySelectorAll( '.sf-menu .menu-item-has-children' ); var parentElements = document.querySelectorAll( '.sf-menu .menu-item-has-children' );
for ( var i = 0; i < parentElements.length; i++ ) { for ( var i = 0; i < parentElements.length; i++ ) {
parentElements[i].addEventListener( 'touchend', function( e ) { parentElements[i].addEventListener( 'touchend', function( e ) {
// Bail on mobile // Bail on mobile
if ( this.closest( 'nav' ).classList.contains( 'toggled' ) ) { if ( this.closest( 'nav' ).classList.contains( 'toggled' ) ) {
return; return;
} }
if ( e.touches.length === 1 || e.touches.length === 0 ) { if ( e.touches.length === 1 || e.touches.length === 0 ) {
// Prevent touch events within dropdown bubbling down to document // Prevent touch events within dropdown bubbling down to document
e.stopPropagation(); e.stopPropagation();
// Toggle hover // Toggle hover
if ( ! this.classList.contains( 'sfHover' ) ) { if ( ! this.classList.contains( 'sfHover' ) ) {
// Prevent link on first touch // Prevent link on first touch
if ( e.target === this || e.target.parentNode === this || e.target.parentNode.parentNode ) { if ( e.target === this || e.target.parentNode === this || e.target.parentNode.parentNode ) {
e.preventDefault(); e.preventDefault();
} }
var getSiblings = function( elem ) { var getSiblings = function( elem ) {
return Array.prototype.filter.call( elem.parentNode.children, function( sibling ) { return Array.prototype.filter.call( elem.parentNode.children, function( sibling ) {
return sibling !== elem; return sibling !== elem;
} ); } );
}; };
// Close other sub-menus. // Close other sub-menus.
var closestLi = this.closest( 'li' ), var closestLi = this.closest( 'li' ),
siblings = getSiblings( closestLi ); siblings = getSiblings( closestLi );
for ( var i = 0; i < siblings.length; i++ ) { for ( var i = 0; i < siblings.length; i++ ) {
if ( siblings[i].classList.contains( 'sfHover' ) ) { if ( siblings[i].classList.contains( 'sfHover' ) ) {
siblings[i].classList.remove( 'sfHover' ); siblings[i].classList.remove( 'sfHover' );
} }
} }
this.classList.add( 'sfHover' ); this.classList.add( 'sfHover' );
// Hide dropdown on touch outside // Hide dropdown on touch outside
var closeDropdown, var closeDropdown,
thisItem = this; thisItem = this;
document.addEventListener( 'touchend', closeDropdown = function(e) { document.addEventListener( 'touchend', closeDropdown = function(e) {
e.stopPropagation(); e.stopPropagation();
thisItem.classList.remove( 'sfHover' ); thisItem.classList.remove( 'sfHover' );
document.removeEventListener( 'touchend', closeDropdown ); document.removeEventListener( 'touchend', closeDropdown );
} ); } );
} }
} }
} ); } );
} }
} }
} )(); } )();

View File

@ -1,302 +1,302 @@
( function() { ( function() {
'use strict'; 'use strict';
if ( 'querySelector' in document && 'addEventListener' in window ) { if ( 'querySelector' in document && 'addEventListener' in window ) {
/** /**
* matches() pollyfil * matches() pollyfil
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Browser_compatibility * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Browser_compatibility
*/ */
if ( ! Element.prototype.matches ) { if ( ! Element.prototype.matches ) {
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
} }
/** /**
* closest() pollyfil * closest() pollyfil
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Browser_compatibility * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Browser_compatibility
*/ */
if ( ! Element.prototype.closest ) { if ( ! Element.prototype.closest ) {
Element.prototype.closest = function( s ) { Element.prototype.closest = function( s ) {
var el = this; var el = this;
var ancestor = this; var ancestor = this;
if ( ! document.documentElement.contains( el ) ) { if ( ! document.documentElement.contains( el ) ) {
return null; return null;
} }
do { do {
if ( ancestor.matches( s ) ) { if ( ancestor.matches( s ) ) {
return ancestor; return ancestor;
} }
ancestor = ancestor.parentElement; ancestor = ancestor.parentElement;
} while ( ancestor !== null ); } while ( ancestor !== null );
return null; return null;
}; };
} }
var getSiblings = function( elem ) { var getSiblings = function( elem ) {
return Array.prototype.filter.call( elem.parentNode.children, function( sibling ) { return Array.prototype.filter.call( elem.parentNode.children, function( sibling ) {
return sibling !== elem; return sibling !== elem;
} ); } );
}; };
var allNavToggles = document.querySelectorAll( '.menu-toggle' ), var allNavToggles = document.querySelectorAll( '.menu-toggle' ),
dropdownToggle = document.querySelectorAll( 'nav .dropdown-menu-toggle' ), dropdownToggle = document.querySelectorAll( 'nav .dropdown-menu-toggle' ),
navLinks = document.querySelectorAll( 'nav ul a' ), navLinks = document.querySelectorAll( 'nav ul a' ),
mobileMenuControls = document.querySelector( '.mobile-menu-control-wrapper' ), mobileMenuControls = document.querySelector( '.mobile-menu-control-wrapper' ),
body = document.body, body = document.body,
htmlEl = document.documentElement; htmlEl = document.documentElement;
var enableDropdownArrows = function( nav ) { var enableDropdownArrows = function( nav ) {
if ( body.classList.contains( 'dropdown-hover' ) ) { if ( body.classList.contains( 'dropdown-hover' ) ) {
var dropdownItems = nav.querySelectorAll( 'li.menu-item-has-children' ); var dropdownItems = nav.querySelectorAll( 'li.menu-item-has-children' );
for ( var i = 0; i < dropdownItems.length; i++ ) { for ( var i = 0; i < dropdownItems.length; i++ ) {
dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'tabindex', '0' ); dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'tabindex', '0' );
dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'role', 'button' ); dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'role', 'button' );
dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'aria-expanded', 'false' ); dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'aria-expanded', 'false' );
dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'aria-label', generatepressMenu.openSubMenuLabel ); dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'aria-label', generatepressMenu.openSubMenuLabel );
} }
} }
}; };
var disableDropdownArrows = function( nav ) { var disableDropdownArrows = function( nav ) {
if ( body.classList.contains( 'dropdown-hover' ) ) { if ( body.classList.contains( 'dropdown-hover' ) ) {
var dropdownItems = nav.querySelectorAll( 'li.menu-item-has-children' ); var dropdownItems = nav.querySelectorAll( 'li.menu-item-has-children' );
for ( var i = 0; i < dropdownItems.length; i++ ) { for ( var i = 0; i < dropdownItems.length; i++ ) {
dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).removeAttribute( 'tabindex' ); dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).removeAttribute( 'tabindex' );
dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'role', 'presentation' ); dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'role', 'presentation' );
dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).removeAttribute( 'aria-expanded' ); dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).removeAttribute( 'aria-expanded' );
dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).removeAttribute( 'aria-label' ); dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).removeAttribute( 'aria-label' );
} }
} }
}; };
var setDropdownArrowAttributes = function( arrow ) { var setDropdownArrowAttributes = function( arrow ) {
if ( 'false' === arrow.getAttribute( 'aria-expanded' ) || ! arrow.getAttribute( 'aria-expanded' ) ) { if ( 'false' === arrow.getAttribute( 'aria-expanded' ) || ! arrow.getAttribute( 'aria-expanded' ) ) {
arrow.setAttribute( 'aria-expanded', 'true' ); arrow.setAttribute( 'aria-expanded', 'true' );
arrow.setAttribute( 'aria-label', generatepressMenu.closeSubMenuLabel ); arrow.setAttribute( 'aria-label', generatepressMenu.closeSubMenuLabel );
} else { } else {
arrow.setAttribute( 'aria-expanded', 'false' ); arrow.setAttribute( 'aria-expanded', 'false' );
arrow.setAttribute( 'aria-label', generatepressMenu.openSubMenuLabel ); arrow.setAttribute( 'aria-label', generatepressMenu.openSubMenuLabel );
} }
}; };
/** /**
* Start mobile menu toggle. * Start mobile menu toggle.
* *
* @param e The event. * @param e The event.
* @param _this The clicked item. * @param _this The clicked item.
*/ */
var toggleNav = function( e, _this ) { var toggleNav = function( e, _this ) {
if ( ! _this ) { if ( ! _this ) {
var _this = this; var _this = this;
} }
var parentContainer = ''; var parentContainer = '';
if ( _this.getAttribute( 'data-nav' ) ) { if ( _this.getAttribute( 'data-nav' ) ) {
parentContainer = document.getElementById( _this.getAttribute( 'data-nav' ) ); parentContainer = document.getElementById( _this.getAttribute( 'data-nav' ) );
} else { } else {
parentContainer = document.getElementById( _this.closest( 'nav' ).getAttribute( 'id' ) ); parentContainer = document.getElementById( _this.closest( 'nav' ).getAttribute( 'id' ) );
} }
if ( ! parentContainer ) { if ( ! parentContainer ) {
return; return;
} }
var isExternalToggle = false; var isExternalToggle = false;
if ( _this.closest( '.mobile-menu-control-wrapper' ) ) { if ( _this.closest( '.mobile-menu-control-wrapper' ) ) {
isExternalToggle = true; isExternalToggle = true;
} }
var nav = parentContainer.getElementsByTagName( 'ul' )[0]; var nav = parentContainer.getElementsByTagName( 'ul' )[0];
if ( parentContainer.classList.contains( 'toggled' ) ) { if ( parentContainer.classList.contains( 'toggled' ) ) {
parentContainer.classList.remove( 'toggled' ); parentContainer.classList.remove( 'toggled' );
htmlEl.classList.remove( 'mobile-menu-open' ); htmlEl.classList.remove( 'mobile-menu-open' );
nav.setAttribute( 'aria-hidden', 'true' ); nav.setAttribute( 'aria-hidden', 'true' );
_this.setAttribute( 'aria-expanded', 'false' ); _this.setAttribute( 'aria-expanded', 'false' );
if ( isExternalToggle ) { if ( isExternalToggle ) {
mobileMenuControls.classList.remove( 'toggled' ); mobileMenuControls.classList.remove( 'toggled' );
} else if ( mobileMenuControls && parentContainer.classList.contains( 'main-navigation' ) ) { } else if ( mobileMenuControls && parentContainer.classList.contains( 'main-navigation' ) ) {
mobileMenuControls.classList.remove( 'toggled' ); mobileMenuControls.classList.remove( 'toggled' );
} }
disableDropdownArrows( nav ); disableDropdownArrows( nav );
} else { } else {
parentContainer.classList.add( 'toggled' ); parentContainer.classList.add( 'toggled' );
htmlEl.classList.add( 'mobile-menu-open' ); htmlEl.classList.add( 'mobile-menu-open' );
nav.setAttribute( 'aria-hidden', 'false' ); nav.setAttribute( 'aria-hidden', 'false' );
_this.setAttribute( 'aria-expanded', 'true' ); _this.setAttribute( 'aria-expanded', 'true' );
if ( isExternalToggle ) { if ( isExternalToggle ) {
mobileMenuControls.classList.add( 'toggled' ); mobileMenuControls.classList.add( 'toggled' );
if ( mobileMenuControls.querySelector( '.search-item' ) ) { if ( mobileMenuControls.querySelector( '.search-item' ) ) {
if ( mobileMenuControls.querySelector( '.search-item' ).classList.contains( 'active' ) ) { if ( mobileMenuControls.querySelector( '.search-item' ).classList.contains( 'active' ) ) {
mobileMenuControls.querySelector( '.search-item' ).click(); mobileMenuControls.querySelector( '.search-item' ).click();
} }
} }
} else if ( mobileMenuControls && parentContainer.classList.contains( 'main-navigation' ) ) { } else if ( mobileMenuControls && parentContainer.classList.contains( 'main-navigation' ) ) {
mobileMenuControls.classList.add( 'toggled' ); mobileMenuControls.classList.add( 'toggled' );
} }
enableDropdownArrows( nav ); enableDropdownArrows( nav );
} }
} }
for ( var i = 0; i < allNavToggles.length; i++ ) { for ( var i = 0; i < allNavToggles.length; i++ ) {
allNavToggles[i].addEventListener( 'click', toggleNav, false ); allNavToggles[i].addEventListener( 'click', toggleNav, false );
} }
/** /**
* Open sub-menus * Open sub-menus
* *
* @param e The event. * @param e The event.
* @param _this The clicked item. * @param _this The clicked item.
*/ */
var toggleSubNav = function( e, _this ) { var toggleSubNav = function( e, _this ) {
if ( ! _this ) { if ( ! _this ) {
var _this = this; var _this = this;
} }
if ( ( _this.closest( 'nav' ).classList.contains( 'toggled' ) || htmlEl.classList.contains( 'slide-opened' ) ) && ! body.classList.contains( 'dropdown-click' ) ) { if ( ( _this.closest( 'nav' ).classList.contains( 'toggled' ) || htmlEl.classList.contains( 'slide-opened' ) ) && ! body.classList.contains( 'dropdown-click' ) ) {
e.preventDefault(); e.preventDefault();
var closestLi = _this.closest( 'li' ); var closestLi = _this.closest( 'li' );
setDropdownArrowAttributes( closestLi.querySelector( '.dropdown-menu-toggle' ) ); setDropdownArrowAttributes( closestLi.querySelector( '.dropdown-menu-toggle' ) );
if ( closestLi.querySelector( '.sub-menu' ) ) { if ( closestLi.querySelector( '.sub-menu' ) ) {
var subMenu = closestLi.querySelector( '.sub-menu' ); var subMenu = closestLi.querySelector( '.sub-menu' );
} else { } else {
var subMenu = closestLi.querySelector( '.children' ); var subMenu = closestLi.querySelector( '.children' );
} }
if ( generatepressMenu.toggleOpenedSubMenus ) { if ( generatepressMenu.toggleOpenedSubMenus ) {
var siblings = getSiblings( closestLi ); var siblings = getSiblings( closestLi );
for ( var i = 0; i < siblings.length; i++ ) { for ( var i = 0; i < siblings.length; i++ ) {
if ( siblings[i].classList.contains( 'sfHover' ) ) { if ( siblings[i].classList.contains( 'sfHover' ) ) {
siblings[i].classList.remove( 'sfHover' ); siblings[i].classList.remove( 'sfHover' );
siblings[i].querySelector( '.toggled-on' ).classList.remove( 'toggled-on' ); siblings[i].querySelector( '.toggled-on' ).classList.remove( 'toggled-on' );
setDropdownArrowAttributes( siblings[i].querySelector( '.dropdown-menu-toggle' ) ); setDropdownArrowAttributes( siblings[i].querySelector( '.dropdown-menu-toggle' ) );
} }
} }
} }
closestLi.classList.toggle( 'sfHover' ); closestLi.classList.toggle( 'sfHover' );
subMenu.classList.toggle( 'toggled-on' ); subMenu.classList.toggle( 'toggled-on' );
} }
e.stopPropagation(); e.stopPropagation();
} }
for ( var i = 0; i < dropdownToggle.length; i++ ) { for ( var i = 0; i < dropdownToggle.length; i++ ) {
dropdownToggle[i].addEventListener( 'click', toggleSubNav, false ); dropdownToggle[i].addEventListener( 'click', toggleSubNav, false );
dropdownToggle[i].addEventListener( 'keypress', function( e ) { dropdownToggle[i].addEventListener( 'keypress', function( e ) {
var key = e.which || e.keyCode; var key = e.which || e.keyCode;
if (key === 13) { // 13 is enter if (key === 13) { // 13 is enter
toggleSubNav( e, this ); toggleSubNav( e, this );
} }
}, false ); }, false );
} }
/** /**
* Disable the mobile menu if our toggle isn't visible. * Disable the mobile menu if our toggle isn't visible.
* Makes it possible to style mobile item with .toggled class. * Makes it possible to style mobile item with .toggled class.
*/ */
var checkMobile = function() { var checkMobile = function() {
var openedMobileMenus = document.querySelectorAll( '.toggled, .has-active-search' ); var openedMobileMenus = document.querySelectorAll( '.toggled, .has-active-search' );
for ( var i = 0; i < openedMobileMenus.length; i++ ) { for ( var i = 0; i < openedMobileMenus.length; i++ ) {
var menuToggle = openedMobileMenus[i].querySelector( '.menu-toggle' ); var menuToggle = openedMobileMenus[i].querySelector( '.menu-toggle' );
if ( mobileMenuControls && ! menuToggle.closest( 'nav' ).classList.contains( 'mobile-menu-control-wrapper' ) ) { if ( mobileMenuControls && ! menuToggle.closest( 'nav' ).classList.contains( 'mobile-menu-control-wrapper' ) ) {
menuToggle = mobileMenuControls.querySelector( '.menu-toggle' ); menuToggle = mobileMenuControls.querySelector( '.menu-toggle' );
} }
if ( menuToggle && menuToggle.offsetParent === null ) { if ( menuToggle && menuToggle.offsetParent === null ) {
if ( openedMobileMenus[i].classList.contains( 'toggled' ) ) { if ( openedMobileMenus[i].classList.contains( 'toggled' ) ) {
var remoteNav = false; var remoteNav = false;
if ( openedMobileMenus[i].classList.contains( 'mobile-menu-control-wrapper' ) ) { if ( openedMobileMenus[i].classList.contains( 'mobile-menu-control-wrapper' ) ) {
remoteNav = true; remoteNav = true;
} }
if ( ! remoteNav ) { if ( ! remoteNav ) {
// Navigation is toggled, but .menu-toggle isn't visible on the page (display: none). // Navigation is toggled, but .menu-toggle isn't visible on the page (display: none).
var closestNav = openedMobileMenus[i].getElementsByTagName( 'ul' )[ 0 ], var closestNav = openedMobileMenus[i].getElementsByTagName( 'ul' )[ 0 ],
closestNavItems = closestNav.getElementsByTagName( 'li' ), closestNavItems = closestNav.getElementsByTagName( 'li' ),
closestSubMenus = closestNav.getElementsByTagName( 'ul' ); closestSubMenus = closestNav.getElementsByTagName( 'ul' );
} }
document.activeElement.blur(); document.activeElement.blur();
openedMobileMenus[i].classList.remove( 'toggled' ); openedMobileMenus[i].classList.remove( 'toggled' );
htmlEl.classList.remove( 'mobile-menu-open' ); htmlEl.classList.remove( 'mobile-menu-open' );
menuToggle.setAttribute( 'aria-expanded', 'false' ); menuToggle.setAttribute( 'aria-expanded', 'false' );
if ( ! remoteNav ) { if ( ! remoteNav ) {
for ( var li = 0; li < closestNavItems.length; li++ ) { for ( var li = 0; li < closestNavItems.length; li++ ) {
closestNavItems[li].classList.remove( 'sfHover' ); closestNavItems[li].classList.remove( 'sfHover' );
} }
for ( var sm = 0; sm < closestSubMenus.length; sm++ ) { for ( var sm = 0; sm < closestSubMenus.length; sm++ ) {
closestSubMenus[sm].classList.remove( 'toggled-on' ); closestSubMenus[sm].classList.remove( 'toggled-on' );
} }
if ( closestNav ) { if ( closestNav ) {
closestNav.removeAttribute( 'aria-hidden' ); closestNav.removeAttribute( 'aria-hidden' );
} }
} }
disableDropdownArrows( openedMobileMenus[i] ); disableDropdownArrows( openedMobileMenus[i] );
} }
if ( mobileMenuControls.querySelector( '.search-item' ) ) { if ( mobileMenuControls.querySelector( '.search-item' ) ) {
if ( mobileMenuControls.querySelector( '.search-item' ).classList.contains( 'active' ) ) { if ( mobileMenuControls.querySelector( '.search-item' ).classList.contains( 'active' ) ) {
mobileMenuControls.querySelector( '.search-item' ).click(); mobileMenuControls.querySelector( '.search-item' ).click();
} }
} }
} }
} }
} }
window.addEventListener( 'resize', checkMobile, false ); window.addEventListener( 'resize', checkMobile, false );
window.addEventListener( 'orientationchange', checkMobile, false ); window.addEventListener( 'orientationchange', checkMobile, false );
if ( body.classList.contains( 'dropdown-hover' ) ) { if ( body.classList.contains( 'dropdown-hover' ) ) {
/** /**
* Do some essential things when menu items are clicked. * Do some essential things when menu items are clicked.
*/ */
for ( var i = 0; i < navLinks.length; i++ ) { for ( var i = 0; i < navLinks.length; i++ ) {
navLinks[i].addEventListener( 'click', function( e ) { navLinks[i].addEventListener( 'click', function( e ) {
// Remove sfHover class if we're going to another site. // Remove sfHover class if we're going to another site.
if ( this.hostname !== window.location.hostname ) { if ( this.hostname !== window.location.hostname ) {
document.activeElement.blur(); document.activeElement.blur();
} }
var closest_nav = this.closest( 'nav' ); var closest_nav = this.closest( 'nav' );
if ( closest_nav.classList.contains( 'toggled' ) || htmlEl.classList.contains( 'slide-opened' ) ) { if ( closest_nav.classList.contains( 'toggled' ) || htmlEl.classList.contains( 'slide-opened' ) ) {
var url = this.getAttribute( 'href' ); var url = this.getAttribute( 'href' );
// Open the sub-menu if the link has no destination // Open the sub-menu if the link has no destination
if ( '#' == url || '' == url ) { if ( '#' == url || '' == url ) {
e.preventDefault(); e.preventDefault();
var closestLi = this.closest( 'li' ); var closestLi = this.closest( 'li' );
closestLi.classList.toggle( 'sfHover' ); closestLi.classList.toggle( 'sfHover' );
var subMenu = closestLi.querySelector( '.sub-menu' ); var subMenu = closestLi.querySelector( '.sub-menu' );
if ( subMenu ) { if ( subMenu ) {
subMenu.classList.toggle( 'toggled-on' ); subMenu.classList.toggle( 'toggled-on' );
} }
} }
} }
}, false ); }, false );
} }
} }
} }
})(); })();

View File

@ -1,128 +1,128 @@
( function() { ( function() {
'use strict'; 'use strict';
if ( 'querySelector' in document && 'addEventListener' in window ) { if ( 'querySelector' in document && 'addEventListener' in window ) {
/** /**
* Navigation search. * Navigation search.
* *
* @param e The event. * @param e The event.
* @param _this The clicked item. * @param _this The clicked item.
*/ */
var toggleSearch = function( e, item ) { var toggleSearch = function( e, item ) {
e.preventDefault(); e.preventDefault();
if ( ! item ) { if ( ! item ) {
var item = this; var item = this;
} }
var forms = document.querySelectorAll( '.navigation-search' ), var forms = document.querySelectorAll( '.navigation-search' ),
toggles = document.querySelectorAll( '.search-item' ), toggles = document.querySelectorAll( '.search-item' ),
focusableEls = document.querySelectorAll('a[href], area[href], input:not([disabled]):not(.navigation-search), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]'), focusableEls = document.querySelectorAll('a[href], area[href], input:not([disabled]):not(.navigation-search), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]'),
nav = ''; nav = '';
if ( item.closest( '.mobile-menu-control-wrapper' ) ) { if ( item.closest( '.mobile-menu-control-wrapper' ) ) {
nav = document.getElementById( 'site-navigation' ); nav = document.getElementById( 'site-navigation' );
} }
for ( var i = 0; i < forms.length; i++ ) { for ( var i = 0; i < forms.length; i++ ) {
if ( forms[i].classList.contains( 'nav-search-active' ) ) { if ( forms[i].classList.contains( 'nav-search-active' ) ) {
if ( forms[i].closest( '#sticky-placeholder' ) ) { if ( forms[i].closest( '#sticky-placeholder' ) ) {
continue; continue;
} }
forms[i].classList.remove( 'nav-search-active' ); forms[i].classList.remove( 'nav-search-active' );
var activeSearch = document.querySelector( '.has-active-search' );; var activeSearch = document.querySelector( '.has-active-search' );;
if ( activeSearch ) { if ( activeSearch ) {
activeSearch.classList.remove( 'has-active-search' ); activeSearch.classList.remove( 'has-active-search' );
} }
for ( var t = 0; t < toggles.length; t++ ) { for ( var t = 0; t < toggles.length; t++ ) {
toggles[t].classList.remove( 'close-search' ); toggles[t].classList.remove( 'close-search' );
toggles[t].classList.remove( 'active' ); toggles[t].classList.remove( 'active' );
toggles[t].querySelector( 'a' ).setAttribute( 'aria-label', generatepressNavSearch.open ); toggles[t].querySelector( 'a' ).setAttribute( 'aria-label', generatepressNavSearch.open );
// Allow tabindex on items again. // Allow tabindex on items again.
for ( var f = 0; f < focusableEls.length; f++ ) { for ( var f = 0; f < focusableEls.length; f++ ) {
if ( ! focusableEls[f].closest( '.navigation-search' ) && ! focusableEls[f].closest( '.search-item' ) ) { if ( ! focusableEls[f].closest( '.navigation-search' ) && ! focusableEls[f].closest( '.search-item' ) ) {
focusableEls[f].removeAttribute( 'tabindex' ); focusableEls[f].removeAttribute( 'tabindex' );
} }
}; };
} }
document.activeElement.blur(); document.activeElement.blur();
} else { } else {
if ( forms[i].closest( '#sticky-placeholder' ) ) { if ( forms[i].closest( '#sticky-placeholder' ) ) {
continue; continue;
} }
var openedMobileMenu = forms[i].closest( '.toggled' ); var openedMobileMenu = forms[i].closest( '.toggled' );
if ( openedMobileMenu ) { if ( openedMobileMenu ) {
// Close the mobile menu. // Close the mobile menu.
openedMobileMenu.querySelector( 'button.menu-toggle' ).click(); openedMobileMenu.querySelector( 'button.menu-toggle' ).click();
} }
if ( nav ) { if ( nav ) {
nav.classList.add( 'has-active-search' ); nav.classList.add( 'has-active-search' );
} }
forms[i].classList.add( 'nav-search-active' ); forms[i].classList.add( 'nav-search-active' );
var container = this.closest( 'nav' ); var container = this.closest( 'nav' );
if ( container ) { if ( container ) {
if ( container.classList.contains( 'mobile-menu-control-wrapper' ) ) { if ( container.classList.contains( 'mobile-menu-control-wrapper' ) ) {
container = nav; container = nav;
} }
var searchField = container.querySelector( '.search-field' ); var searchField = container.querySelector( '.search-field' );
if ( searchField ) { if ( searchField ) {
searchField.focus(); searchField.focus();
} }
} }
for ( var t = 0; t < toggles.length; t++ ) { for ( var t = 0; t < toggles.length; t++ ) {
toggles[t].classList.add( 'active' ); toggles[t].classList.add( 'active' );
toggles[t].querySelector( 'a' ).setAttribute( 'aria-label', generatepressNavSearch.close ); toggles[t].querySelector( 'a' ).setAttribute( 'aria-label', generatepressNavSearch.close );
// Trap tabindex within the search element // Trap tabindex within the search element
for ( var f = 0; f < focusableEls.length; f++ ) { for ( var f = 0; f < focusableEls.length; f++ ) {
if ( ! focusableEls[f].closest( '.navigation-search' ) && ! focusableEls[f].closest( '.search-item' ) ) { if ( ! focusableEls[f].closest( '.navigation-search' ) && ! focusableEls[f].closest( '.search-item' ) ) {
focusableEls[f].setAttribute( 'tabindex', '-1' ); focusableEls[f].setAttribute( 'tabindex', '-1' );
} }
}; };
toggles[t].classList.add( 'close-search' ); toggles[t].classList.add( 'close-search' );
} }
} }
} }
} }
if ( document.body.classList.contains( 'nav-search-enabled' ) ) { if ( document.body.classList.contains( 'nav-search-enabled' ) ) {
var searchItems = document.querySelectorAll( '.search-item' ); var searchItems = document.querySelectorAll( '.search-item' );
for ( var i = 0; i < searchItems.length; i++ ) { for ( var i = 0; i < searchItems.length; i++ ) {
searchItems[i].addEventListener( 'click', toggleSearch, false ); searchItems[i].addEventListener( 'click', toggleSearch, false );
} }
// Close navigation search on escape key // Close navigation search on escape key
document.addEventListener( 'keydown', function( e ) { document.addEventListener( 'keydown', function( e ) {
if ( document.querySelector( '.navigation-search.nav-search-active' ) ) { if ( document.querySelector( '.navigation-search.nav-search-active' ) ) {
var key = e.which || e.keyCode; var key = e.which || e.keyCode;
if ( key === 27 ) { // 27 is esc if ( key === 27 ) { // 27 is esc
var activeSearchItems = document.querySelectorAll( '.search-item.active' ); var activeSearchItems = document.querySelectorAll( '.search-item.active' );
for ( var i = 0; i < activeSearchItems.length; i++ ) { for ( var i = 0; i < activeSearchItems.length; i++ ) {
toggleSearch( e, activeSearchItems[i] ); toggleSearch( e, activeSearchItems[i] );
break; break;
} }
} }
} }
}, false ); }, false );
} }
} }
})(); })();

View File

@ -1,67 +1,67 @@
<?php <?php
/** /**
* The template for displaying 404 pages. * The template for displaying 404 pages.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
?> ?>
<div class="inside-article"> <div class="inside-article">
<?php <?php
/** /**
* generate_before_content hook. * generate_before_content hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_featured_page_header_inside_single - 10 * @hooked generate_featured_page_header_inside_single - 10
*/ */
do_action( 'generate_before_content' ); do_action( 'generate_before_content' );
?> ?>
<header class="entry-header"> <header class="entry-header">
<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML is allowed in filter here. ?> <?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML is allowed in filter here. ?>
<h1 class="entry-title" itemprop="headline"><?php echo apply_filters( 'generate_404_title', __( 'Oops! That page can&rsquo;t be found.', 'generatepress' ) ); ?></h1> <h1 class="entry-title" itemprop="headline"><?php echo apply_filters( 'generate_404_title', __( 'Oops! That page can&rsquo;t be found.', 'generatepress' ) ); ?></h1>
</header> </header>
<?php <?php
/** /**
* generate_after_entry_header hook. * generate_after_entry_header hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_post_image - 10 * @hooked generate_post_image - 10
*/ */
do_action( 'generate_after_entry_header' ); do_action( 'generate_after_entry_header' );
$itemprop = ''; $itemprop = '';
if ( 'microdata' === generate_get_schema_type() ) { if ( 'microdata' === generate_get_schema_type() ) {
$itemprop = ' itemprop="text"'; $itemprop = ' itemprop="text"';
} }
?> ?>
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>> <div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
<?php <?php
printf( printf(
'<p>%s</p>', '<p>%s</p>',
apply_filters( 'generate_404_text', __( 'It looks like nothing was found at this location. Maybe try searching?', 'generatepress' ) ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML is allowed in filter here. apply_filters( 'generate_404_text', __( 'It looks like nothing was found at this location. Maybe try searching?', 'generatepress' ) ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML is allowed in filter here.
); );
get_search_form(); get_search_form();
?> ?>
</div> </div>
<?php <?php
/** /**
* generate_after_content hook. * generate_after_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_after_content' ); do_action( 'generate_after_content' );
?> ?>
</div> </div>

View File

@ -1,111 +1,111 @@
<?php <?php
/** /**
* The template for displaying Link post formats. * The template for displaying Link post formats.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
?> ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
<div class="inside-article"> <div class="inside-article">
<?php <?php
/** /**
* generate_before_content hook. * generate_before_content hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_featured_page_header_inside_single - 10 * @hooked generate_featured_page_header_inside_single - 10
*/ */
do_action( 'generate_before_content' ); do_action( 'generate_before_content' );
if ( generate_show_entry_header() ) : if ( generate_show_entry_header() ) :
?> ?>
<header class="entry-header"> <header class="entry-header">
<?php <?php
/** /**
* generate_before_entry_title hook. * generate_before_entry_title hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_before_entry_title' ); do_action( 'generate_before_entry_title' );
if ( generate_show_title() ) { if ( generate_show_title() ) {
$params = generate_get_the_title_parameters(); $params = generate_get_the_title_parameters();
the_title( $params['before'], $params['after'] ); the_title( $params['before'], $params['after'] );
} }
/** /**
* generate_after_entry_title hook. * generate_after_entry_title hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_post_meta - 10 * @hooked generate_post_meta - 10
*/ */
do_action( 'generate_after_entry_title' ); do_action( 'generate_after_entry_title' );
?> ?>
</header> </header>
<?php <?php
endif; endif;
/** /**
* generate_after_entry_header hook. * generate_after_entry_header hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_post_image - 10 * @hooked generate_post_image - 10
*/ */
do_action( 'generate_after_entry_header' ); do_action( 'generate_after_entry_header' );
$itemprop = ''; $itemprop = '';
if ( 'microdata' === generate_get_schema_type() ) { if ( 'microdata' === generate_get_schema_type() ) {
$itemprop = ' itemprop="text"'; $itemprop = ' itemprop="text"';
} }
if ( generate_show_excerpt() ) : if ( generate_show_excerpt() ) :
?> ?>
<div class="entry-summary"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>> <div class="entry-summary"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
<?php the_excerpt(); ?> <?php the_excerpt(); ?>
</div> </div>
<?php else : ?> <?php else : ?>
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>> <div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
<?php <?php
the_content(); the_content();
wp_link_pages( wp_link_pages(
array( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ), 'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
'after' => '</div>', 'after' => '</div>',
) )
); );
?> ?>
</div> </div>
<?php <?php
endif; endif;
/** /**
* generate_after_entry_content hook. * generate_after_entry_content hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_footer_meta - 10 * @hooked generate_footer_meta - 10
*/ */
do_action( 'generate_after_entry_content' ); do_action( 'generate_after_entry_content' );
/** /**
* generate_after_content hook. * generate_after_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_after_content' ); do_action( 'generate_after_content' );
?> ?>
</div> </div>
</article> </article>

View File

@ -1,93 +1,93 @@
<?php <?php
/** /**
* The template used for displaying page content in page.php * The template used for displaying page content in page.php
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
?> ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
<div class="inside-article"> <div class="inside-article">
<?php <?php
/** /**
* generate_before_content hook. * generate_before_content hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_featured_page_header_inside_single - 10 * @hooked generate_featured_page_header_inside_single - 10
*/ */
do_action( 'generate_before_content' ); do_action( 'generate_before_content' );
if ( generate_show_entry_header() ) : if ( generate_show_entry_header() ) :
?> ?>
<header class="entry-header"> <header class="entry-header">
<?php <?php
/** /**
* generate_before_page_title hook. * generate_before_page_title hook.
* *
* @since 2.4 * @since 2.4
*/ */
do_action( 'generate_before_page_title' ); do_action( 'generate_before_page_title' );
if ( generate_show_title() ) { if ( generate_show_title() ) {
$params = generate_get_the_title_parameters(); $params = generate_get_the_title_parameters();
the_title( $params['before'], $params['after'] ); the_title( $params['before'], $params['after'] );
} }
/** /**
* generate_after_page_title hook. * generate_after_page_title hook.
* *
* @since 2.4 * @since 2.4
*/ */
do_action( 'generate_after_page_title' ); do_action( 'generate_after_page_title' );
?> ?>
</header> </header>
<?php <?php
endif; endif;
/** /**
* generate_after_entry_header hook. * generate_after_entry_header hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_post_image - 10 * @hooked generate_post_image - 10
*/ */
do_action( 'generate_after_entry_header' ); do_action( 'generate_after_entry_header' );
$itemprop = ''; $itemprop = '';
if ( 'microdata' === generate_get_schema_type() ) { if ( 'microdata' === generate_get_schema_type() ) {
$itemprop = ' itemprop="text"'; $itemprop = ' itemprop="text"';
} }
?> ?>
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>> <div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
<?php <?php
the_content(); the_content();
wp_link_pages( wp_link_pages(
array( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ), 'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
'after' => '</div>', 'after' => '</div>',
) )
); );
?> ?>
</div> </div>
<?php <?php
/** /**
* generate_after_content hook. * generate_after_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_after_content' ); do_action( 'generate_after_content' );
?> ?>
</div> </div>
</article> </article>

View File

@ -1,102 +1,102 @@
<?php <?php
/** /**
* The template for displaying single posts. * The template for displaying single posts.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
?> ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
<div class="inside-article"> <div class="inside-article">
<?php <?php
/** /**
* generate_before_content hook. * generate_before_content hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_featured_page_header_inside_single - 10 * @hooked generate_featured_page_header_inside_single - 10
*/ */
do_action( 'generate_before_content' ); do_action( 'generate_before_content' );
if ( generate_show_entry_header() ) : if ( generate_show_entry_header() ) :
?> ?>
<header class="entry-header"> <header class="entry-header">
<?php <?php
/** /**
* generate_before_entry_title hook. * generate_before_entry_title hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_before_entry_title' ); do_action( 'generate_before_entry_title' );
if ( generate_show_title() ) { if ( generate_show_title() ) {
$params = generate_get_the_title_parameters(); $params = generate_get_the_title_parameters();
the_title( $params['before'], $params['after'] ); the_title( $params['before'], $params['after'] );
} }
/** /**
* generate_after_entry_title hook. * generate_after_entry_title hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_post_meta - 10 * @hooked generate_post_meta - 10
*/ */
do_action( 'generate_after_entry_title' ); do_action( 'generate_after_entry_title' );
?> ?>
</header> </header>
<?php <?php
endif; endif;
/** /**
* generate_after_entry_header hook. * generate_after_entry_header hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_post_image - 10 * @hooked generate_post_image - 10
*/ */
do_action( 'generate_after_entry_header' ); do_action( 'generate_after_entry_header' );
$itemprop = ''; $itemprop = '';
if ( 'microdata' === generate_get_schema_type() ) { if ( 'microdata' === generate_get_schema_type() ) {
$itemprop = ' itemprop="text"'; $itemprop = ' itemprop="text"';
} }
?> ?>
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>> <div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
<?php <?php
the_content(); the_content();
wp_link_pages( wp_link_pages(
array( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ), 'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
'after' => '</div>', 'after' => '</div>',
) )
); );
?> ?>
</div> </div>
<?php <?php
/** /**
* generate_after_entry_content hook. * generate_after_entry_content hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_footer_meta - 10 * @hooked generate_footer_meta - 10
*/ */
do_action( 'generate_after_entry_content' ); do_action( 'generate_after_entry_content' );
/** /**
* generate_after_content hook. * generate_after_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_after_content' ); do_action( 'generate_after_content' );
?> ?>
</div> </div>
</article> </article>

View File

@ -1,111 +1,111 @@
<?php <?php
/** /**
* The template for displaying posts within the loop. * The template for displaying posts within the loop.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
?> ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
<div class="inside-article"> <div class="inside-article">
<?php <?php
/** /**
* generate_before_content hook. * generate_before_content hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_featured_page_header_inside_single - 10 * @hooked generate_featured_page_header_inside_single - 10
*/ */
do_action( 'generate_before_content' ); do_action( 'generate_before_content' );
if ( generate_show_entry_header() ) : if ( generate_show_entry_header() ) :
?> ?>
<header class="entry-header"> <header class="entry-header">
<?php <?php
/** /**
* generate_before_entry_title hook. * generate_before_entry_title hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_before_entry_title' ); do_action( 'generate_before_entry_title' );
if ( generate_show_title() ) { if ( generate_show_title() ) {
$params = generate_get_the_title_parameters(); $params = generate_get_the_title_parameters();
the_title( $params['before'], $params['after'] ); the_title( $params['before'], $params['after'] );
} }
/** /**
* generate_after_entry_title hook. * generate_after_entry_title hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_post_meta - 10 * @hooked generate_post_meta - 10
*/ */
do_action( 'generate_after_entry_title' ); do_action( 'generate_after_entry_title' );
?> ?>
</header> </header>
<?php <?php
endif; endif;
/** /**
* generate_after_entry_header hook. * generate_after_entry_header hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_post_image - 10 * @hooked generate_post_image - 10
*/ */
do_action( 'generate_after_entry_header' ); do_action( 'generate_after_entry_header' );
$itemprop = ''; $itemprop = '';
if ( 'microdata' === generate_get_schema_type() ) { if ( 'microdata' === generate_get_schema_type() ) {
$itemprop = ' itemprop="text"'; $itemprop = ' itemprop="text"';
} }
if ( generate_show_excerpt() ) : if ( generate_show_excerpt() ) :
?> ?>
<div class="entry-summary"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>> <div class="entry-summary"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
<?php the_excerpt(); ?> <?php the_excerpt(); ?>
</div> </div>
<?php else : ?> <?php else : ?>
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>> <div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
<?php <?php
the_content(); the_content();
wp_link_pages( wp_link_pages(
array( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ), 'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
'after' => '</div>', 'after' => '</div>',
) )
); );
?> ?>
</div> </div>
<?php <?php
endif; endif;
/** /**
* generate_after_entry_content hook. * generate_after_entry_content hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_footer_meta - 10 * @hooked generate_footer_meta - 10
*/ */
do_action( 'generate_after_entry_content' ); do_action( 'generate_after_entry_content' );
/** /**
* generate_after_content hook. * generate_after_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_after_content' ); do_action( 'generate_after_content' );
?> ?>
</div> </div>
</article> </article>

View File

@ -1,65 +1,65 @@
<?php <?php
/** /**
* The template for displaying the footer. * The template for displaying the footer.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
?> ?>
</div> </div>
</div> </div>
<?php <?php
/** /**
* generate_before_footer hook. * generate_before_footer hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_before_footer' ); do_action( 'generate_before_footer' );
?> ?>
<div <?php generate_do_element_classes( 'footer' ); ?>> <div <?php generate_do_element_classes( 'footer' ); ?>>
<?php <?php
/** /**
* generate_before_footer_content hook. * generate_before_footer_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_before_footer_content' ); do_action( 'generate_before_footer_content' );
/** /**
* generate_footer hook. * generate_footer hook.
* *
* @since 1.3.42 * @since 1.3.42
* *
* @hooked generate_construct_footer_widgets - 5 * @hooked generate_construct_footer_widgets - 5
* @hooked generate_construct_footer - 10 * @hooked generate_construct_footer - 10
*/ */
do_action( 'generate_footer' ); do_action( 'generate_footer' );
/** /**
* generate_after_footer_content hook. * generate_after_footer_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_after_footer_content' ); do_action( 'generate_after_footer_content' );
?> ?>
</div> </div>
<?php <?php
/** /**
* generate_after_footer hook. * generate_after_footer hook.
* *
* @since 2.1 * @since 2.1
*/ */
do_action( 'generate_after_footer' ); do_action( 'generate_after_footer' );
wp_footer(); wp_footer();
?> ?>
</body> </body>
</html> </html>

View File

@ -1,103 +1,103 @@
<?php <?php
/** /**
* GeneratePress. * GeneratePress.
* *
* Please do not make any edits to this file. All edits should be done in a child theme. * Please do not make any edits to this file. All edits should be done in a child theme.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
// Set our theme version. // Set our theme version.
define( 'GENERATE_VERSION', '3.0.3' ); define( 'GENERATE_VERSION', '3.0.4' );
if ( ! function_exists( 'generate_setup' ) ) { if ( ! function_exists( 'generate_setup' ) ) {
add_action( 'after_setup_theme', 'generate_setup' ); add_action( 'after_setup_theme', 'generate_setup' );
/** /**
* Sets up theme defaults and registers support for various WordPress features. * Sets up theme defaults and registers support for various WordPress features.
* *
* @since 0.1 * @since 0.1
*/ */
function generate_setup() { function generate_setup() {
// Make theme available for translation. // Make theme available for translation.
load_theme_textdomain( 'generatepress' ); load_theme_textdomain( 'generatepress' );
// Add theme support for various features. // Add theme support for various features.
add_theme_support( 'automatic-feed-links' ); add_theme_support( 'automatic-feed-links' );
add_theme_support( 'post-thumbnails' ); add_theme_support( 'post-thumbnails' );
add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'status' ) ); add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'status' ) );
add_theme_support( 'woocommerce' ); add_theme_support( 'woocommerce' );
add_theme_support( 'title-tag' ); add_theme_support( 'title-tag' );
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'script', 'style' ) ); add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'script', 'style' ) );
add_theme_support( 'customize-selective-refresh-widgets' ); add_theme_support( 'customize-selective-refresh-widgets' );
add_theme_support( 'align-wide' ); add_theme_support( 'align-wide' );
add_theme_support( 'responsive-embeds' ); add_theme_support( 'responsive-embeds' );
add_theme_support( add_theme_support(
'custom-logo', 'custom-logo',
array( array(
'height' => 70, 'height' => 70,
'width' => 350, 'width' => 350,
'flex-height' => true, 'flex-height' => true,
'flex-width' => true, 'flex-width' => true,
) )
); );
// Register primary menu. // Register primary menu.
register_nav_menus( register_nav_menus(
array( array(
'primary' => __( 'Primary Menu', 'generatepress' ), 'primary' => __( 'Primary Menu', 'generatepress' ),
) )
); );
/** /**
* Set the content width to something large * Set the content width to something large
* We set a more accurate width in generate_smart_content_width() * We set a more accurate width in generate_smart_content_width()
*/ */
global $content_width; global $content_width;
if ( ! isset( $content_width ) ) { if ( ! isset( $content_width ) ) {
$content_width = 1200; /* pixels */ $content_width = 1200; /* pixels */
} }
// This theme styles the visual editor to resemble the theme style. // This theme styles the visual editor to resemble the theme style.
add_editor_style( 'assets/css/admin/editor-style.css' ); add_editor_style( 'assets/css/admin/editor-style.css' );
} }
} }
/** /**
* Get all necessary theme files * Get all necessary theme files
*/ */
$theme_dir = get_template_directory(); $theme_dir = get_template_directory();
require $theme_dir . '/inc/theme-functions.php'; require $theme_dir . '/inc/theme-functions.php';
require $theme_dir . '/inc/defaults.php'; require $theme_dir . '/inc/defaults.php';
require $theme_dir . '/inc/class-css.php'; require $theme_dir . '/inc/class-css.php';
require $theme_dir . '/inc/css-output.php'; require $theme_dir . '/inc/css-output.php';
require $theme_dir . '/inc/general.php'; require $theme_dir . '/inc/general.php';
require $theme_dir . '/inc/customizer.php'; require $theme_dir . '/inc/customizer.php';
require $theme_dir . '/inc/markup.php'; require $theme_dir . '/inc/markup.php';
require $theme_dir . '/inc/typography.php'; require $theme_dir . '/inc/typography.php';
require $theme_dir . '/inc/plugin-compat.php'; require $theme_dir . '/inc/plugin-compat.php';
require $theme_dir . '/inc/block-editor.php'; require $theme_dir . '/inc/block-editor.php';
require $theme_dir . '/inc/class-theme-update.php'; require $theme_dir . '/inc/class-theme-update.php';
require $theme_dir . '/inc/deprecated.php'; require $theme_dir . '/inc/deprecated.php';
if ( is_admin() ) { if ( is_admin() ) {
require $theme_dir . '/inc/meta-box.php'; require $theme_dir . '/inc/meta-box.php';
require $theme_dir . '/inc/dashboard.php'; require $theme_dir . '/inc/dashboard.php';
} }
/** /**
* Load our theme structure * Load our theme structure
*/ */
require $theme_dir . '/inc/structure/archives.php'; require $theme_dir . '/inc/structure/archives.php';
require $theme_dir . '/inc/structure/comments.php'; require $theme_dir . '/inc/structure/comments.php';
require $theme_dir . '/inc/structure/featured-images.php'; require $theme_dir . '/inc/structure/featured-images.php';
require $theme_dir . '/inc/structure/footer.php'; require $theme_dir . '/inc/structure/footer.php';
require $theme_dir . '/inc/structure/header.php'; require $theme_dir . '/inc/structure/header.php';
require $theme_dir . '/inc/structure/navigation.php'; require $theme_dir . '/inc/structure/navigation.php';
require $theme_dir . '/inc/structure/post-meta.php'; require $theme_dir . '/inc/structure/post-meta.php';
require $theme_dir . '/inc/structure/sidebars.php'; require $theme_dir . '/inc/structure/sidebars.php';

View File

@ -1,75 +1,75 @@
<?php <?php
/** /**
* The template for displaying the header. * The template for displaying the header.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
?><!DOCTYPE html> ?><!DOCTYPE html>
<html <?php language_attributes(); ?>> <html <?php language_attributes(); ?>>
<head> <head>
<meta charset="<?php bloginfo( 'charset' ); ?>"> <meta charset="<?php bloginfo( 'charset' ); ?>">
<link rel="profile" href="https://gmpg.org/xfn/11"> <link rel="profile" href="https://gmpg.org/xfn/11">
<?php wp_head(); ?> <?php wp_head(); ?>
</head> </head>
<body <?php body_class(); ?> <?php generate_do_microdata( 'body' ); ?>> <body <?php body_class(); ?> <?php generate_do_microdata( 'body' ); ?>>
<?php <?php
/** /**
* wp_body_open hook. * wp_body_open hook.
* *
* @since 2.3 * @since 2.3
*/ */
do_action( 'wp_body_open' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- core WP hook. do_action( 'wp_body_open' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- core WP hook.
/** /**
* generate_before_header hook. * generate_before_header hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_do_skip_to_content_link - 2 * @hooked generate_do_skip_to_content_link - 2
* @hooked generate_top_bar - 5 * @hooked generate_top_bar - 5
* @hooked generate_add_navigation_before_header - 5 * @hooked generate_add_navigation_before_header - 5
*/ */
do_action( 'generate_before_header' ); do_action( 'generate_before_header' );
/** /**
* generate_header hook. * generate_header hook.
* *
* @since 1.3.42 * @since 1.3.42
* *
* @hooked generate_construct_header - 10 * @hooked generate_construct_header - 10
*/ */
do_action( 'generate_header' ); do_action( 'generate_header' );
/** /**
* generate_after_header hook. * generate_after_header hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_featured_page_header - 10 * @hooked generate_featured_page_header - 10
*/ */
do_action( 'generate_after_header' ); do_action( 'generate_after_header' );
?> ?>
<div id="page" <?php generate_do_element_classes( 'page' ); ?>> <div id="page" <?php generate_do_element_classes( 'page' ); ?>>
<?php <?php
/** /**
* generate_inside_site_container hook. * generate_inside_site_container hook.
* *
* @since 2.4 * @since 2.4
*/ */
do_action( 'generate_inside_site_container' ); do_action( 'generate_inside_site_container' );
?> ?>
<div id="content" class="site-content"> <div id="content" class="site-content">
<?php <?php
/** /**
* generate_inside_container hook. * generate_inside_container hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_inside_container' ); do_action( 'generate_inside_container' );

View File

@ -1,424 +1,424 @@
<?php <?php
/** /**
* Integrate GeneratePress with the WordPress block editor. * Integrate GeneratePress with the WordPress block editor.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
/** /**
* Check what sidebar layout we're using. * Check what sidebar layout we're using.
* We need this function as the post meta in generate_get_layout() only runs * We need this function as the post meta in generate_get_layout() only runs
* on is_singular() * on is_singular()
* *
* @since 2.2 * @since 2.2
* *
* @param bool $meta Check for post meta. * @param bool $meta Check for post meta.
* @return string The saved sidebar layout. * @return string The saved sidebar layout.
*/ */
function generate_get_block_editor_sidebar_layout( $meta = true ) { function generate_get_block_editor_sidebar_layout( $meta = true ) {
$layout = generate_get_option( 'layout_setting' ); $layout = generate_get_option( 'layout_setting' );
if ( function_exists( 'get_current_screen' ) ) { if ( function_exists( 'get_current_screen' ) ) {
$screen = get_current_screen(); $screen = get_current_screen();
if ( is_object( $screen ) && 'post' === $screen->post_type ) { if ( is_object( $screen ) && 'post' === $screen->post_type ) {
$layout = generate_get_option( 'single_layout_setting' ); $layout = generate_get_option( 'single_layout_setting' );
} }
} }
// Add in our default filter in case people have adjusted it. // Add in our default filter in case people have adjusted it.
$layout = apply_filters( 'generate_sidebar_layout', $layout ); $layout = apply_filters( 'generate_sidebar_layout', $layout );
if ( $meta ) { if ( $meta ) {
$layout_meta = get_post_meta( get_the_ID(), '_generate-sidebar-layout-meta', true ); $layout_meta = get_post_meta( get_the_ID(), '_generate-sidebar-layout-meta', true );
if ( $layout_meta ) { if ( $layout_meta ) {
$layout = $layout_meta; $layout = $layout_meta;
} }
} }
return apply_filters( 'generate_block_editor_sidebar_layout', $layout ); return apply_filters( 'generate_block_editor_sidebar_layout', $layout );
} }
/** /**
* Check whether we're disabling the content title or not. * Check whether we're disabling the content title or not.
* We need this function as the post meta in generate_show_title() only runs * We need this function as the post meta in generate_show_title() only runs
* on is_singular() * on is_singular()
* *
* @since 2.2 * @since 2.2
*/ */
function generate_get_block_editor_show_content_title() { function generate_get_block_editor_show_content_title() {
$title = generate_show_title(); $title = generate_show_title();
$disable_title = get_post_meta( get_the_ID(), '_generate-disable-headline', true ); $disable_title = get_post_meta( get_the_ID(), '_generate-disable-headline', true );
if ( $disable_title ) { if ( $disable_title ) {
$title = false; $title = false;
} }
return apply_filters( 'generate_block_editor_show_content_title', $title ); return apply_filters( 'generate_block_editor_show_content_title', $title );
} }
/** /**
* Get the content width for this post. * Get the content width for this post.
* *
* @since 2.2 * @since 2.2
*/ */
function generate_get_block_editor_content_width() { function generate_get_block_editor_content_width() {
$container_width = generate_get_option( 'container_width' ); $container_width = generate_get_option( 'container_width' );
$content_width = $container_width; $content_width = $container_width;
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' ); $right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' ); $left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
$layout = generate_get_block_editor_sidebar_layout(); $layout = generate_get_block_editor_sidebar_layout();
if ( 'left-sidebar' === $layout ) { if ( 'left-sidebar' === $layout ) {
$content_width = $container_width * ( ( 100 - $left_sidebar_width ) / 100 ); $content_width = $container_width * ( ( 100 - $left_sidebar_width ) / 100 );
} elseif ( 'right-sidebar' === $layout ) { } elseif ( 'right-sidebar' === $layout ) {
$content_width = $container_width * ( ( 100 - $right_sidebar_width ) / 100 ); $content_width = $container_width * ( ( 100 - $right_sidebar_width ) / 100 );
} elseif ( 'no-sidebar' === $layout ) { } elseif ( 'no-sidebar' === $layout ) {
$content_width = $container_width; $content_width = $container_width;
} else { } else {
$content_width = $container_width * ( ( 100 - ( $left_sidebar_width + $right_sidebar_width ) ) / 100 ); $content_width = $container_width * ( ( 100 - ( $left_sidebar_width + $right_sidebar_width ) ) / 100 );
} }
return apply_filters( 'generate_block_editor_content_width', $content_width ); return apply_filters( 'generate_block_editor_content_width', $content_width );
} }
add_action( 'enqueue_block_editor_assets', 'generate_enqueue_google_fonts' ); add_action( 'enqueue_block_editor_assets', 'generate_enqueue_google_fonts' );
add_action( 'enqueue_block_editor_assets', 'generate_enqueue_backend_block_editor_assets' ); add_action( 'enqueue_block_editor_assets', 'generate_enqueue_backend_block_editor_assets' );
/** /**
* Add CSS to the admin side of the block editor. * Add CSS to the admin side of the block editor.
* *
* @since 2.2 * @since 2.2
*/ */
function generate_enqueue_backend_block_editor_assets() { function generate_enqueue_backend_block_editor_assets() {
wp_enqueue_style( 'generate-block-editor-styles', get_template_directory_uri() . '/assets/css/admin/block-editor.css', false, GENERATE_VERSION, 'all' ); wp_enqueue_style( 'generate-block-editor-styles', get_template_directory_uri() . '/assets/css/admin/block-editor.css', false, GENERATE_VERSION, 'all' );
wp_enqueue_script( 'generate-block-editor-tinycolor', get_template_directory_uri() . '/assets/js/admin/tinycolor.js', false, GENERATE_VERSION, true ); wp_enqueue_script( 'generate-block-editor-tinycolor', get_template_directory_uri() . '/assets/js/admin/tinycolor.js', false, GENERATE_VERSION, true );
wp_enqueue_script( 'generate-block-editor-scripts', get_template_directory_uri() . '/assets/js/admin/block-editor.js', array( 'jquery', 'generate-block-editor-tinycolor' ), GENERATE_VERSION, true ); wp_enqueue_script( 'generate-block-editor-scripts', get_template_directory_uri() . '/assets/js/admin/block-editor.js', array( 'jquery', 'generate-block-editor-tinycolor' ), GENERATE_VERSION, true );
$show_editor_styles = apply_filters( 'generate_show_block_editor_styles', true ); $show_editor_styles = apply_filters( 'generate_show_block_editor_styles', true );
if ( $show_editor_styles ) { if ( $show_editor_styles ) {
wp_add_inline_style( 'generate-block-editor-styles', wp_strip_all_tags( generate_do_inline_block_editor_css() ) ); wp_add_inline_style( 'generate-block-editor-styles', wp_strip_all_tags( generate_do_inline_block_editor_css() ) );
} }
$color_settings = wp_parse_args( $color_settings = wp_parse_args(
get_option( 'generate_settings', array() ), get_option( 'generate_settings', array() ),
generate_get_color_defaults() generate_get_color_defaults()
); );
$spacing_settings = wp_parse_args( $spacing_settings = wp_parse_args(
get_option( 'generate_spacing_settings', array() ), get_option( 'generate_spacing_settings', array() ),
generate_spacing_get_defaults() generate_spacing_get_defaults()
); );
$text_color = generate_get_option( 'text_color' ); $text_color = generate_get_option( 'text_color' );
if ( $color_settings['content_text_color'] ) { if ( $color_settings['content_text_color'] ) {
$text_color = $color_settings['content_text_color']; $text_color = $color_settings['content_text_color'];
} }
wp_localize_script( wp_localize_script(
'generate-block-editor-scripts', 'generate-block-editor-scripts',
'generate_block_editor', 'generate_block_editor',
array( array(
'global_sidebar_layout' => generate_get_block_editor_sidebar_layout( false ), 'global_sidebar_layout' => generate_get_block_editor_sidebar_layout( false ),
'container_width' => generate_get_option( 'container_width' ), 'container_width' => generate_get_option( 'container_width' ),
'right_sidebar_width' => apply_filters( 'generate_right_sidebar_width', '25' ), 'right_sidebar_width' => apply_filters( 'generate_right_sidebar_width', '25' ),
'left_sidebar_width' => apply_filters( 'generate_left_sidebar_width', '25' ), 'left_sidebar_width' => apply_filters( 'generate_left_sidebar_width', '25' ),
'content_padding_right' => absint( $spacing_settings['content_right'] ) . 'px', 'content_padding_right' => absint( $spacing_settings['content_right'] ) . 'px',
'content_padding_left' => absint( $spacing_settings['content_left'] ) . 'px', 'content_padding_left' => absint( $spacing_settings['content_left'] ) . 'px',
'content_title' => generate_get_block_editor_show_content_title() ? 'true' : 'false', 'content_title' => generate_get_block_editor_show_content_title() ? 'true' : 'false',
'disable_content_title' => esc_html__( 'Disable Content Title', 'generatepress' ), 'disable_content_title' => esc_html__( 'Disable Content Title', 'generatepress' ),
'show_content_title' => esc_html__( 'Show Content Title', 'generatepress' ), 'show_content_title' => esc_html__( 'Show Content Title', 'generatepress' ),
'text_color' => $text_color, 'text_color' => $text_color,
'show_editor_styles' => $show_editor_styles, 'show_editor_styles' => $show_editor_styles,
) )
); );
} }
/** /**
* Write our CSS for the block editor. * Write our CSS for the block editor.
* *
* @since 2.2 * @since 2.2
*/ */
function generate_do_inline_block_editor_css() { function generate_do_inline_block_editor_css() {
$color_settings = wp_parse_args( $color_settings = wp_parse_args(
get_option( 'generate_settings', array() ), get_option( 'generate_settings', array() ),
generate_get_color_defaults() generate_get_color_defaults()
); );
$font_settings = wp_parse_args( $font_settings = wp_parse_args(
get_option( 'generate_settings', array() ), get_option( 'generate_settings', array() ),
generate_get_default_fonts() generate_get_default_fonts()
); );
$css = new GeneratePress_CSS(); $css = new GeneratePress_CSS();
$content_width = generate_get_block_editor_content_width(); $content_width = generate_get_block_editor_content_width();
$spacing_settings = wp_parse_args( $spacing_settings = wp_parse_args(
get_option( 'generate_spacing_settings', array() ), get_option( 'generate_spacing_settings', array() ),
generate_spacing_get_defaults() generate_spacing_get_defaults()
); );
$content_width_calc = sprintf( $content_width_calc = sprintf(
'calc(%1$s - %2$s - %3$s)', 'calc(%1$s - %2$s - %3$s)',
absint( $content_width ) . 'px', absint( $content_width ) . 'px',
absint( $spacing_settings['content_left'] ) . 'px', absint( $spacing_settings['content_left'] ) . 'px',
absint( $spacing_settings['content_right'] ) . 'px' absint( $spacing_settings['content_right'] ) . 'px'
); );
$css->set_selector( 'body .wp-block, html body.gutenberg-editor-page .editor-post-title__block, html body.gutenberg-editor-page .editor-default-block-appender, html body.gutenberg-editor-page .editor-block-list__block' ); $css->set_selector( 'body .wp-block, html body.gutenberg-editor-page .editor-post-title__block, html body.gutenberg-editor-page .editor-default-block-appender, html body.gutenberg-editor-page .editor-block-list__block' );
if ( 'true' === get_post_meta( get_the_ID(), '_generate-full-width-content', true ) ) { if ( 'true' === get_post_meta( get_the_ID(), '_generate-full-width-content', true ) ) {
$css->add_property( 'max-width', '100%' ); $css->add_property( 'max-width', '100%' );
} else { } else {
$css->add_property( 'max-width', $content_width_calc ); $css->add_property( 'max-width', $content_width_calc );
} }
$css->set_selector( 'html body.gutenberg-editor-page .block-editor-block-list__block[data-align="full"]' ); $css->set_selector( 'html body.gutenberg-editor-page .block-editor-block-list__block[data-align="full"]' );
$css->add_property( 'max-width', 'none' ); $css->add_property( 'max-width', 'none' );
$css->set_selector( '.wp-block[data-align="wide"]' ); $css->set_selector( '.wp-block[data-align="wide"]' );
$css->add_property( 'max-width', absint( $content_width ), false, 'px' ); $css->add_property( 'max-width', absint( $content_width ), false, 'px' );
if ( apply_filters( 'generate_do_group_inner_container_style', true ) ) { if ( apply_filters( 'generate_do_group_inner_container_style', true ) ) {
$css->set_selector( '.wp-block-group__inner-container' ); $css->set_selector( '.wp-block-group__inner-container' );
$css->add_property( 'max-width', absint( $content_width ), false, 'px' ); $css->add_property( 'max-width', absint( $content_width ), false, 'px' );
$css->add_property( 'margin-left', 'auto' ); $css->add_property( 'margin-left', 'auto' );
$css->add_property( 'margin-right', 'auto' ); $css->add_property( 'margin-right', 'auto' );
$css->add_property( 'padding', generate_padding_css( $spacing_settings['content_top'], $spacing_settings['content_right'], $spacing_settings['content_bottom'], $spacing_settings['content_left'] ) ); $css->add_property( 'padding', generate_padding_css( $spacing_settings['content_top'], $spacing_settings['content_right'], $spacing_settings['content_bottom'], $spacing_settings['content_left'] ) );
} }
$css->set_selector( '.editor-styles-wrapper a.button, .wp-block-button__link:not(.has-background)' ); $css->set_selector( '.editor-styles-wrapper a.button, .wp-block-button__link:not(.has-background)' );
$css->add_property( 'color', $color_settings['form_button_text_color'] ); $css->add_property( 'color', $color_settings['form_button_text_color'] );
$css->add_property( 'background-color', $color_settings['form_button_background_color'] ); $css->add_property( 'background-color', $color_settings['form_button_background_color'] );
$css->set_selector( '.editor-styles-wrapper a.button:hover, .editor-styles-wrapper a.button:focus, .wp-block-button__link:not(.has-background):active, .wp-block-button__link:not(.has-background):focus, .wp-block-button__link:not(.has-background):hover' ); $css->set_selector( '.editor-styles-wrapper a.button:hover, .editor-styles-wrapper a.button:focus, .wp-block-button__link:not(.has-background):active, .wp-block-button__link:not(.has-background):focus, .wp-block-button__link:not(.has-background):hover' );
$css->add_property( 'color', $color_settings['form_button_text_color_hover'] ); $css->add_property( 'color', $color_settings['form_button_text_color_hover'] );
$css->add_property( 'background-color', $color_settings['form_button_background_color_hover'] ); $css->add_property( 'background-color', $color_settings['form_button_background_color_hover'] );
$body_family = generate_get_font_family_css( 'font_body', 'generate_settings', generate_get_default_fonts() ); $body_family = generate_get_font_family_css( 'font_body', 'generate_settings', generate_get_default_fonts() );
$h1_family = generate_get_font_family_css( 'font_heading_1', 'generate_settings', generate_get_default_fonts() ); $h1_family = generate_get_font_family_css( 'font_heading_1', 'generate_settings', generate_get_default_fonts() );
$h2_family = generate_get_font_family_css( 'font_heading_2', 'generate_settings', generate_get_default_fonts() ); $h2_family = generate_get_font_family_css( 'font_heading_2', 'generate_settings', generate_get_default_fonts() );
$h3_family = generate_get_font_family_css( 'font_heading_3', 'generate_settings', generate_get_default_fonts() ); $h3_family = generate_get_font_family_css( 'font_heading_3', 'generate_settings', generate_get_default_fonts() );
$h4_family = generate_get_font_family_css( 'font_heading_4', 'generate_settings', generate_get_default_fonts() ); $h4_family = generate_get_font_family_css( 'font_heading_4', 'generate_settings', generate_get_default_fonts() );
$h5_family = generate_get_font_family_css( 'font_heading_5', 'generate_settings', generate_get_default_fonts() ); $h5_family = generate_get_font_family_css( 'font_heading_5', 'generate_settings', generate_get_default_fonts() );
$h6_family = generate_get_font_family_css( 'font_heading_6', 'generate_settings', generate_get_default_fonts() ); $h6_family = generate_get_font_family_css( 'font_heading_6', 'generate_settings', generate_get_default_fonts() );
$buttons_family = generate_get_font_family_css( 'font_buttons', 'generate_settings', generate_get_default_fonts() ); $buttons_family = generate_get_font_family_css( 'font_buttons', 'generate_settings', generate_get_default_fonts() );
$css->set_selector( 'body.gutenberg-editor-page .block-editor-block-list__block, body .editor-styles-wrapper' ); $css->set_selector( 'body.gutenberg-editor-page .block-editor-block-list__block, body .editor-styles-wrapper' );
$css->add_property( 'font-family', $body_family ); $css->add_property( 'font-family', $body_family );
$css->add_property( 'font-size', absint( $font_settings['body_font_size'] ), false, 'px' ); $css->add_property( 'font-size', absint( $font_settings['body_font_size'] ), false, 'px' );
if ( $color_settings['content_text_color'] ) { if ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', $color_settings['content_text_color'] ); $css->add_property( 'color', $color_settings['content_text_color'] );
} else { } else {
$css->add_property( 'color', generate_get_option( 'text_color' ) ); $css->add_property( 'color', generate_get_option( 'text_color' ) );
} }
$css->set_selector( '.content-title-visibility' ); $css->set_selector( '.content-title-visibility' );
if ( $color_settings['content_text_color'] ) { if ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', $color_settings['content_text_color'] ); $css->add_property( 'color', $color_settings['content_text_color'] );
} else { } else {
$css->add_property( 'color', generate_get_option( 'text_color' ) ); $css->add_property( 'color', generate_get_option( 'text_color' ) );
} }
$css->set_selector( 'body .editor-styles-wrapper, body .editor-styles-wrapper p, body .editor-styles-wrapper .mce-content-body' ); $css->set_selector( 'body .editor-styles-wrapper, body .editor-styles-wrapper p, body .editor-styles-wrapper .mce-content-body' );
$css->add_property( 'line-height', floatval( $font_settings['body_line_height'] ) ); $css->add_property( 'line-height', floatval( $font_settings['body_line_height'] ) );
$css->set_selector( 'body .editor-styles-wrapper p' ); $css->set_selector( 'body .editor-styles-wrapper p' );
$css->add_property( 'margin-top', '0px' ); $css->add_property( 'margin-top', '0px' );
$css->add_property( 'margin-bottom', $font_settings['paragraph_margin'], false, 'em' ); $css->add_property( 'margin-bottom', $font_settings['paragraph_margin'], false, 'em' );
$css->set_selector( 'body .editor-styles-wrapper h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-post-title__block .editor-post-title__input' ); $css->set_selector( 'body .editor-styles-wrapper h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-post-title__block .editor-post-title__input' );
$css->add_property( 'font-family', 'inherit' === $h1_family || '' === $h1_family ? $body_family : $h1_family ); $css->add_property( 'font-family', 'inherit' === $h1_family || '' === $h1_family ? $body_family : $h1_family );
$css->add_property( 'font-weight', $font_settings['heading_1_weight'] ); $css->add_property( 'font-weight', $font_settings['heading_1_weight'] );
$css->add_property( 'text-transform', $font_settings['heading_1_transform'] ); $css->add_property( 'text-transform', $font_settings['heading_1_transform'] );
$css->add_property( 'font-size', absint( $font_settings['heading_1_font_size'] ), false, 'px' ); $css->add_property( 'font-size', absint( $font_settings['heading_1_font_size'] ), false, 'px' );
$css->add_property( 'line-height', floatval( $font_settings['heading_1_line_height'] ), false, 'em' ); $css->add_property( 'line-height', floatval( $font_settings['heading_1_line_height'] ), false, 'em' );
$css->add_property( 'margin-bottom', floatval( $font_settings['heading_1_margin_bottom'] ), false, 'px' ); $css->add_property( 'margin-bottom', floatval( $font_settings['heading_1_margin_bottom'] ), false, 'px' );
$css->add_property( 'margin-top', '0' ); $css->add_property( 'margin-top', '0' );
if ( $color_settings['h1_color'] ) { if ( $color_settings['h1_color'] ) {
$css->add_property( 'color', $color_settings['h1_color'] ); $css->add_property( 'color', $color_settings['h1_color'] );
} elseif ( $color_settings['content_text_color'] ) { } elseif ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', $color_settings['content_text_color'] ); $css->add_property( 'color', $color_settings['content_text_color'] );
} else { } else {
$css->add_property( 'color', generate_get_option( 'text_color' ) ); $css->add_property( 'color', generate_get_option( 'text_color' ) );
} }
if ( $color_settings['content_title_color'] ) { if ( $color_settings['content_title_color'] ) {
$css->set_selector( '.editor-post-title__block .editor-post-title__input' ); $css->set_selector( '.editor-post-title__block .editor-post-title__input' );
$css->add_property( 'color', $color_settings['content_title_color'] ); $css->add_property( 'color', $color_settings['content_title_color'] );
} }
$css->set_selector( 'body .editor-styles-wrapper h2, .wp-block-heading h2.editor-rich-text__tinymce' ); $css->set_selector( 'body .editor-styles-wrapper h2, .wp-block-heading h2.editor-rich-text__tinymce' );
$css->add_property( 'font-family', $h2_family ); $css->add_property( 'font-family', $h2_family );
$css->add_property( 'font-weight', $font_settings['heading_2_weight'] ); $css->add_property( 'font-weight', $font_settings['heading_2_weight'] );
$css->add_property( 'text-transform', $font_settings['heading_2_transform'] ); $css->add_property( 'text-transform', $font_settings['heading_2_transform'] );
$css->add_property( 'font-size', absint( $font_settings['heading_2_font_size'] ), false, 'px' ); $css->add_property( 'font-size', absint( $font_settings['heading_2_font_size'] ), false, 'px' );
$css->add_property( 'line-height', floatval( $font_settings['heading_2_line_height'] ), false, 'em' ); $css->add_property( 'line-height', floatval( $font_settings['heading_2_line_height'] ), false, 'em' );
$css->add_property( 'margin-bottom', floatval( $font_settings['heading_2_margin_bottom'] ), false, 'px' ); $css->add_property( 'margin-bottom', floatval( $font_settings['heading_2_margin_bottom'] ), false, 'px' );
$css->add_property( 'margin-top', '0' ); $css->add_property( 'margin-top', '0' );
if ( $color_settings['h2_color'] ) { if ( $color_settings['h2_color'] ) {
$css->add_property( 'color', $color_settings['h2_color'] ); $css->add_property( 'color', $color_settings['h2_color'] );
} elseif ( $color_settings['content_text_color'] ) { } elseif ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', $color_settings['content_text_color'] ); $css->add_property( 'color', $color_settings['content_text_color'] );
} else { } else {
$css->add_property( 'color', generate_get_option( 'text_color' ) ); $css->add_property( 'color', generate_get_option( 'text_color' ) );
} }
$css->set_selector( 'body .editor-styles-wrapper h3, .wp-block-heading h3.editor-rich-text__tinymce' ); $css->set_selector( 'body .editor-styles-wrapper h3, .wp-block-heading h3.editor-rich-text__tinymce' );
$css->add_property( 'font-family', $h3_family ); $css->add_property( 'font-family', $h3_family );
$css->add_property( 'font-weight', $font_settings['heading_3_weight'] ); $css->add_property( 'font-weight', $font_settings['heading_3_weight'] );
$css->add_property( 'text-transform', $font_settings['heading_3_transform'] ); $css->add_property( 'text-transform', $font_settings['heading_3_transform'] );
$css->add_property( 'font-size', absint( $font_settings['heading_3_font_size'] ), false, 'px' ); $css->add_property( 'font-size', absint( $font_settings['heading_3_font_size'] ), false, 'px' );
$css->add_property( 'line-height', floatval( $font_settings['heading_3_line_height'] ), false, 'em' ); $css->add_property( 'line-height', floatval( $font_settings['heading_3_line_height'] ), false, 'em' );
$css->add_property( 'margin-bottom', floatval( $font_settings['heading_3_margin_bottom'] ), false, 'px' ); $css->add_property( 'margin-bottom', floatval( $font_settings['heading_3_margin_bottom'] ), false, 'px' );
$css->add_property( 'margin-top', '0' ); $css->add_property( 'margin-top', '0' );
if ( $color_settings['h3_color'] ) { if ( $color_settings['h3_color'] ) {
$css->add_property( 'color', $color_settings['h3_color'] ); $css->add_property( 'color', $color_settings['h3_color'] );
} elseif ( $color_settings['content_text_color'] ) { } elseif ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', $color_settings['content_text_color'] ); $css->add_property( 'color', $color_settings['content_text_color'] );
} else { } else {
$css->add_property( 'color', generate_get_option( 'text_color' ) ); $css->add_property( 'color', generate_get_option( 'text_color' ) );
} }
$css->set_selector( 'body .editor-styles-wrapper h4, .wp-block-heading h4.editor-rich-text__tinymce' ); $css->set_selector( 'body .editor-styles-wrapper h4, .wp-block-heading h4.editor-rich-text__tinymce' );
$css->add_property( 'font-family', $h4_family ); $css->add_property( 'font-family', $h4_family );
$css->add_property( 'font-weight', $font_settings['heading_4_weight'] ); $css->add_property( 'font-weight', $font_settings['heading_4_weight'] );
$css->add_property( 'text-transform', $font_settings['heading_4_transform'] ); $css->add_property( 'text-transform', $font_settings['heading_4_transform'] );
$css->add_property( 'margin-bottom', '20px' ); $css->add_property( 'margin-bottom', '20px' );
$css->add_property( 'margin-top', '0' ); $css->add_property( 'margin-top', '0' );
if ( '' !== $font_settings['heading_4_font_size'] ) { if ( '' !== $font_settings['heading_4_font_size'] ) {
$css->add_property( 'font-size', absint( $font_settings['heading_4_font_size'] ), false, 'px' ); $css->add_property( 'font-size', absint( $font_settings['heading_4_font_size'] ), false, 'px' );
} else { } else {
$css->add_property( 'font-size', 'inherit' ); $css->add_property( 'font-size', 'inherit' );
} }
if ( '' !== $font_settings['heading_4_line_height'] ) { if ( '' !== $font_settings['heading_4_line_height'] ) {
$css->add_property( 'line-height', floatval( $font_settings['heading_4_line_height'] ), false, 'em' ); $css->add_property( 'line-height', floatval( $font_settings['heading_4_line_height'] ), false, 'em' );
} }
if ( $color_settings['h4_color'] ) { if ( $color_settings['h4_color'] ) {
$css->add_property( 'color', $color_settings['h4_color'] ); $css->add_property( 'color', $color_settings['h4_color'] );
} elseif ( $color_settings['content_text_color'] ) { } elseif ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', $color_settings['content_text_color'] ); $css->add_property( 'color', $color_settings['content_text_color'] );
} else { } else {
$css->add_property( 'color', generate_get_option( 'text_color' ) ); $css->add_property( 'color', generate_get_option( 'text_color' ) );
} }
$css->set_selector( 'body .editor-styles-wrapper h5, .wp-block-heading h5.editor-rich-text__tinymce' ); $css->set_selector( 'body .editor-styles-wrapper h5, .wp-block-heading h5.editor-rich-text__tinymce' );
$css->add_property( 'font-family', $h5_family ); $css->add_property( 'font-family', $h5_family );
$css->add_property( 'font-weight', $font_settings['heading_5_weight'] ); $css->add_property( 'font-weight', $font_settings['heading_5_weight'] );
$css->add_property( 'text-transform', $font_settings['heading_5_transform'] ); $css->add_property( 'text-transform', $font_settings['heading_5_transform'] );
$css->add_property( 'margin-bottom', '20px' ); $css->add_property( 'margin-bottom', '20px' );
$css->add_property( 'margin-top', '0' ); $css->add_property( 'margin-top', '0' );
if ( '' !== $font_settings['heading_5_font_size'] ) { if ( '' !== $font_settings['heading_5_font_size'] ) {
$css->add_property( 'font-size', absint( $font_settings['heading_5_font_size'] ), false, 'px' ); $css->add_property( 'font-size', absint( $font_settings['heading_5_font_size'] ), false, 'px' );
} else { } else {
$css->add_property( 'font-size', 'inherit' ); $css->add_property( 'font-size', 'inherit' );
} }
if ( '' !== $font_settings['heading_5_line_height'] ) { if ( '' !== $font_settings['heading_5_line_height'] ) {
$css->add_property( 'line-height', floatval( $font_settings['heading_5_line_height'] ), false, 'em' ); $css->add_property( 'line-height', floatval( $font_settings['heading_5_line_height'] ), false, 'em' );
} }
if ( $color_settings['h5_color'] ) { if ( $color_settings['h5_color'] ) {
$css->add_property( 'color', $color_settings['h5_color'] ); $css->add_property( 'color', $color_settings['h5_color'] );
} elseif ( $color_settings['content_text_color'] ) { } elseif ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', $color_settings['content_text_color'] ); $css->add_property( 'color', $color_settings['content_text_color'] );
} else { } else {
$css->add_property( 'color', generate_get_option( 'text_color' ) ); $css->add_property( 'color', generate_get_option( 'text_color' ) );
} }
$css->set_selector( 'body .editor-styles-wrapper h6, .wp-block-heading h6.editor-rich-text__tinymce' ); $css->set_selector( 'body .editor-styles-wrapper h6, .wp-block-heading h6.editor-rich-text__tinymce' );
$css->add_property( 'font-family', $h6_family ); $css->add_property( 'font-family', $h6_family );
$css->add_property( 'font-weight', $font_settings['heading_6_weight'] ); $css->add_property( 'font-weight', $font_settings['heading_6_weight'] );
$css->add_property( 'text-transform', $font_settings['heading_6_transform'] ); $css->add_property( 'text-transform', $font_settings['heading_6_transform'] );
$css->add_property( 'margin-bottom', '20px' ); $css->add_property( 'margin-bottom', '20px' );
$css->add_property( 'margin-top', '0' ); $css->add_property( 'margin-top', '0' );
if ( '' !== $font_settings['heading_6_font_size'] ) { if ( '' !== $font_settings['heading_6_font_size'] ) {
$css->add_property( 'font-size', absint( $font_settings['heading_6_font_size'] ), false, 'px' ); $css->add_property( 'font-size', absint( $font_settings['heading_6_font_size'] ), false, 'px' );
} else { } else {
$css->add_property( 'font-size', 'inherit' ); $css->add_property( 'font-size', 'inherit' );
} }
if ( '' !== $font_settings['heading_6_line_height'] ) { if ( '' !== $font_settings['heading_6_line_height'] ) {
$css->add_property( 'line-height', floatval( $font_settings['heading_6_line_height'] ), false, 'em' ); $css->add_property( 'line-height', floatval( $font_settings['heading_6_line_height'] ), false, 'em' );
} }
if ( $color_settings['h6_color'] ) { if ( $color_settings['h6_color'] ) {
$css->add_property( 'color', $color_settings['h6_color'] ); $css->add_property( 'color', $color_settings['h6_color'] );
} elseif ( $color_settings['content_text_color'] ) { } elseif ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', $color_settings['content_text_color'] ); $css->add_property( 'color', $color_settings['content_text_color'] );
} else { } else {
$css->add_property( 'color', generate_get_option( 'text_color' ) ); $css->add_property( 'color', generate_get_option( 'text_color' ) );
} }
$css->set_selector( '.editor-styles-wrapper a.button, .block-editor-block-list__layout .wp-block-button .wp-block-button__link' ); $css->set_selector( '.editor-styles-wrapper a.button, .block-editor-block-list__layout .wp-block-button .wp-block-button__link' );
$css->add_property( 'font-family', $buttons_family ); $css->add_property( 'font-family', $buttons_family );
$css->add_property( 'font-weight', $font_settings['buttons_font_weight'] ); $css->add_property( 'font-weight', $font_settings['buttons_font_weight'] );
$css->add_property( 'text-transform', $font_settings['buttons_font_transform'] ); $css->add_property( 'text-transform', $font_settings['buttons_font_transform'] );
if ( '' !== $font_settings['buttons_font_size'] ) { if ( '' !== $font_settings['buttons_font_size'] ) {
$css->add_property( 'font-size', absint( $font_settings['buttons_font_size'] ), false, 'px' ); $css->add_property( 'font-size', absint( $font_settings['buttons_font_size'] ), false, 'px' );
} }
if ( version_compare( $GLOBALS['wp_version'], '5.7-alpha.1', '>' ) ) { if ( version_compare( $GLOBALS['wp_version'], '5.7-alpha.1', '>' ) ) {
$css->set_selector( '.block-editor__container .edit-post-visual-editor' ); $css->set_selector( '.block-editor__container .edit-post-visual-editor' );
$css->add_property( 'background-color', generate_get_option( 'background_color' ) ); $css->add_property( 'background-color', generate_get_option( 'background_color' ) );
$css->set_selector( '.block-editor__container .editor-styles-wrapper' ); $css->set_selector( '.block-editor__container .editor-styles-wrapper' );
if ( $color_settings['content_background_color'] ) { if ( $color_settings['content_background_color'] ) {
$css->add_property( 'background-color', $color_settings['content_background_color'] ); $css->add_property( 'background-color', $color_settings['content_background_color'] );
} else { } else {
$css->add_property( 'background-color', generate_get_option( 'background_color' ) ); $css->add_property( 'background-color', generate_get_option( 'background_color' ) );
} }
} else { } else {
$css->set_selector( 'body .editor-styles-wrapper' ); $css->set_selector( 'body .editor-styles-wrapper' );
$css->add_property( 'background-color', generate_get_option( 'background_color' ) ); $css->add_property( 'background-color', generate_get_option( 'background_color' ) );
if ( $color_settings['content_background_color'] ) { if ( $color_settings['content_background_color'] ) {
$body_background = generate_get_option( 'background_color' ); $body_background = generate_get_option( 'background_color' );
$content_background = $color_settings['content_background_color']; $content_background = $color_settings['content_background_color'];
$css->add_property( 'background', 'linear-gradient(' . $content_background . ',' . $content_background . '), linear-gradient(' . $body_background . ',' . $body_background . ')' ); $css->add_property( 'background', 'linear-gradient(' . $content_background . ',' . $content_background . '), linear-gradient(' . $body_background . ',' . $body_background . ')' );
} }
} }
$css->set_selector( '.block-editor-block-list__block a, .block-editor-block-list__block a:visited' ); $css->set_selector( '.block-editor-block-list__block a, .block-editor-block-list__block a:visited' );
if ( $color_settings['content_link_color'] ) { if ( $color_settings['content_link_color'] ) {
$css->add_property( 'color', $color_settings['content_link_color'] ); $css->add_property( 'color', $color_settings['content_link_color'] );
} else { } else {
$css->add_property( 'color', generate_get_option( 'link_color' ) ); $css->add_property( 'color', generate_get_option( 'link_color' ) );
} }
$css->set_selector( '.block-editor-block-list__block a:hover, .block-editor-block-list__block a:focus, .block-editor-block-list__block a:active' ); $css->set_selector( '.block-editor-block-list__block a:hover, .block-editor-block-list__block a:focus, .block-editor-block-list__block a:active' );
if ( $color_settings['content_link_hover_color'] ) { if ( $color_settings['content_link_hover_color'] ) {
$css->add_property( 'color', $color_settings['content_link_hover_color'] ); $css->add_property( 'color', $color_settings['content_link_hover_color'] );
} else { } else {
$css->add_property( 'color', generate_get_option( 'link_color_hover' ) ); $css->add_property( 'color', generate_get_option( 'link_color_hover' ) );
} }
return $css->css_output(); return $css->css_output();
} }

View File

@ -1,327 +1,327 @@
<?php <?php
/** /**
* Migrates old options on update. * Migrates old options on update.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
/** /**
* Process option updates if necessary. * Process option updates if necessary.
*/ */
class GeneratePress_Theme_Update { class GeneratePress_Theme_Update {
/** /**
* Class instance. * Class instance.
* *
* @access private * @access private
* @var $instance Class instance. * @var $instance Class instance.
*/ */
private static $instance; private static $instance;
/** /**
* Initiator * Initiator
*/ */
public static function get_instance() { public static function get_instance() {
if ( ! isset( self::$instance ) ) { if ( ! isset( self::$instance ) ) {
self::$instance = new self(); self::$instance = new self();
} }
return self::$instance; return self::$instance;
} }
/** /**
* Constructor * Constructor
*/ */
public function __construct() { public function __construct() {
if ( is_admin() ) { if ( is_admin() ) {
add_action( 'admin_init', __CLASS__ . '::init', 5 ); add_action( 'admin_init', __CLASS__ . '::init', 5 );
} else { } else {
add_action( 'wp', __CLASS__ . '::init', 5 ); add_action( 'wp', __CLASS__ . '::init', 5 );
} }
add_action( 'admin_init', __CLASS__ . '::admin_updates', 1 ); add_action( 'admin_init', __CLASS__ . '::admin_updates', 1 );
} }
/** /**
* Implement theme update logic. Only run updates on existing sites. * Implement theme update logic. Only run updates on existing sites.
* *
* @since 3.0.0 * @since 3.0.0
*/ */
public static function init() { public static function init() {
if ( is_customize_preview() ) { if ( is_customize_preview() ) {
return; return;
} }
$saved_version = get_option( 'generate_db_version', false ); $saved_version = get_option( 'generate_db_version', false );
if ( false === $saved_version ) { if ( false === $saved_version ) {
// Typically this would mean this is a new install, but we haven't always had the version saved, so we need to check for existing settings. // Typically this would mean this is a new install, but we haven't always had the version saved, so we need to check for existing settings.
$existing_settings = get_option( 'generate_settings', array() ); $existing_settings = get_option( 'generate_settings', array() );
// Can't count this as a user-set option since a previous migration script set it. // Can't count this as a user-set option since a previous migration script set it.
if ( isset( $existing_settings['combine_css'] ) ) { if ( isset( $existing_settings['combine_css'] ) ) {
unset( $existing_settings['combine_css'] ); unset( $existing_settings['combine_css'] );
} }
if ( ! empty( $existing_settings ) ) { if ( ! empty( $existing_settings ) ) {
// We have settings, which means this is an old install with no version number. // We have settings, which means this is an old install with no version number.
$saved_version = '2.0'; $saved_version = '2.0';
} else { } else {
// No settings and no saved version, must be a new install. // No settings and no saved version, must be a new install.
if ( 'admin_init' === current_action() ) { if ( 'admin_init' === current_action() ) {
// If we're in the admin, add our version to the database. // If we're in the admin, add our version to the database.
update_option( 'generate_db_version', GENERATE_VERSION ); update_option( 'generate_db_version', GENERATE_VERSION );
} }
return; return;
} }
} }
if ( version_compare( $saved_version, GENERATE_VERSION, '=' ) ) { if ( version_compare( $saved_version, GENERATE_VERSION, '=' ) ) {
return; return;
} }
if ( version_compare( $saved_version, '2.3.0', '<' ) ) { if ( version_compare( $saved_version, '2.3.0', '<' ) ) {
self::v_2_3_0(); self::v_2_3_0();
} }
if ( version_compare( $saved_version, '3.0.0-alpha.1', '<' ) ) { if ( version_compare( $saved_version, '3.0.0-alpha.1', '<' ) ) {
self::v_3_0_0(); self::v_3_0_0();
} }
// Last thing to do is update our version. // Last thing to do is update our version.
update_option( 'generate_db_version', GENERATE_VERSION ); update_option( 'generate_db_version', GENERATE_VERSION );
} }
/** /**
* Less important updates that should only happen in the Dashboard. * Less important updates that should only happen in the Dashboard.
* These use a database flag instead of our version number for legacy reasons. * These use a database flag instead of our version number for legacy reasons.
* *
* @since 3.0.0 * @since 3.0.0
*/ */
public static function admin_updates() { public static function admin_updates() {
self::v_1_3_0(); self::v_1_3_0();
self::v_1_3_29(); self::v_1_3_29();
} }
/** /**
* Remove variants from font family values. * Remove variants from font family values.
* *
* @since 1.3.0 * @since 1.3.0
*/ */
public static function v_1_3_0() { public static function v_1_3_0() {
// Don't run this if Typography add-on is activated. // Don't run this if Typography add-on is activated.
if ( function_exists( 'generate_fonts_customize_register' ) ) { if ( function_exists( 'generate_fonts_customize_register' ) ) {
return; return;
} }
$settings = get_option( 'generate_settings', array() ); $settings = get_option( 'generate_settings', array() );
if ( ! isset( $settings['font_body'] ) ) { if ( ! isset( $settings['font_body'] ) ) {
return; return;
} }
$value = $settings['font_body']; $value = $settings['font_body'];
$needs_update = false; $needs_update = false;
// If our value has : in it. // If our value has : in it.
if ( ! empty( $value ) && strpos( $value, ':' ) !== false ) { if ( ! empty( $value ) && strpos( $value, ':' ) !== false ) {
// Remove the : and anything past it. // Remove the : and anything past it.
$value = current( explode( ':', $value ) ); $value = current( explode( ':', $value ) );
$settings['font_body'] = $value; $settings['font_body'] = $value;
$needs_update = true; $needs_update = true;
} }
if ( $needs_update ) { if ( $needs_update ) {
update_option( 'generate_settings', $settings ); update_option( 'generate_settings', $settings );
} }
} }
/** /**
* Move logo to custom_logo option as required by WP.org. * Move logo to custom_logo option as required by WP.org.
* *
* @since 1.3.29 * @since 1.3.29
*/ */
public static function v_1_3_29() { public static function v_1_3_29() {
if ( ! function_exists( 'the_custom_logo' ) ) { if ( ! function_exists( 'the_custom_logo' ) ) {
return; return;
} }
if ( get_theme_mod( 'custom_logo' ) ) { if ( get_theme_mod( 'custom_logo' ) ) {
return; return;
} }
$settings = get_option( 'generate_settings', array() ); $settings = get_option( 'generate_settings', array() );
if ( ! isset( $settings['logo'] ) ) { if ( ! isset( $settings['logo'] ) ) {
return; return;
} }
$old_value = $settings['logo']; $old_value = $settings['logo'];
if ( empty( $old_value ) ) { if ( empty( $old_value ) ) {
return; return;
} }
$logo = attachment_url_to_postid( $old_value ); $logo = attachment_url_to_postid( $old_value );
if ( is_int( $logo ) ) { if ( is_int( $logo ) ) {
set_theme_mod( 'custom_logo', $logo ); set_theme_mod( 'custom_logo', $logo );
} }
if ( get_theme_mod( 'custom_logo' ) ) { if ( get_theme_mod( 'custom_logo' ) ) {
$settings['logo'] = ''; $settings['logo'] = '';
update_option( 'generate_settings', $settings ); update_option( 'generate_settings', $settings );
} }
} }
/** /**
* Turn off the combine CSS option for existing sites. * Turn off the combine CSS option for existing sites.
* *
* @since 2.3.0 * @since 2.3.0
*/ */
public static function v_2_3_0() { public static function v_2_3_0() {
$settings = get_option( 'generate_settings', array() ); $settings = get_option( 'generate_settings', array() );
$update_options = false; $update_options = false;
if ( ! isset( $settings['combine_css'] ) ) { if ( ! isset( $settings['combine_css'] ) ) {
$settings['combine_css'] = false; $settings['combine_css'] = false;
$update_options = true; $update_options = true;
} }
if ( $update_options ) { if ( $update_options ) {
update_option( 'generate_settings', $settings ); update_option( 'generate_settings', $settings );
} }
} }
/** /**
* Update sites using old defaults. * Update sites using old defaults.
* *
* @since 3.0.0 * @since 3.0.0
*/ */
public static function v_3_0_0() { public static function v_3_0_0() {
$settings = get_option( 'generate_settings', array() ); $settings = get_option( 'generate_settings', array() );
$update_options = false; $update_options = false;
$old_defaults = array( $old_defaults = array(
'icons' => 'font', 'icons' => 'font',
'structure' => 'floats', 'structure' => 'floats',
'hide_tagline' => '', 'hide_tagline' => '',
'container_width' => '1100', 'container_width' => '1100',
'nav_position_setting' => 'nav-below-header', 'nav_position_setting' => 'nav-below-header',
'container_alignment' => 'boxes', 'container_alignment' => 'boxes',
'background_color' => '#efefef', 'background_color' => '#efefef',
'text_color' => '#3a3a3a', 'text_color' => '#3a3a3a',
'header_text_color' => '#3a3a3a', 'header_text_color' => '#3a3a3a',
'header_link_color' => '#3a3a3a', 'header_link_color' => '#3a3a3a',
'navigation_background_color' => '#222222', 'navigation_background_color' => '#222222',
'navigation_text_color' => '#ffffff', 'navigation_text_color' => '#ffffff',
'navigation_background_hover_color' => '#3f3f3f', 'navigation_background_hover_color' => '#3f3f3f',
'navigation_text_hover_color' => '#ffffff', 'navigation_text_hover_color' => '#ffffff',
'navigation_background_current_color' => '#3f3f3f', 'navigation_background_current_color' => '#3f3f3f',
'navigation_text_current_color' => '#ffffff', 'navigation_text_current_color' => '#ffffff',
'subnavigation_background_color' => '#3f3f3f', 'subnavigation_background_color' => '#3f3f3f',
'subnavigation_text_color' => '#ffffff', 'subnavigation_text_color' => '#ffffff',
'subnavigation_background_hover_color' => '#4f4f4f', 'subnavigation_background_hover_color' => '#4f4f4f',
'subnavigation_text_hover_color' => '#ffffff', 'subnavigation_text_hover_color' => '#ffffff',
'subnavigation_background_current_color' => '#4f4f4f', 'subnavigation_background_current_color' => '#4f4f4f',
'subnavigation_text_current_color' => '#ffffff', 'subnavigation_text_current_color' => '#ffffff',
'sidebar_widget_title_color' => '#000000', 'sidebar_widget_title_color' => '#000000',
'site_title_font_size' => '45', 'site_title_font_size' => '45',
'mobile_site_title_font_size' => '30', 'mobile_site_title_font_size' => '30',
'form_button_background_color' => '#666666', 'form_button_background_color' => '#666666',
'form_button_background_color_hover' => '#3f3f3f', 'form_button_background_color_hover' => '#3f3f3f',
'footer_background_color' => '#222222', 'footer_background_color' => '#222222',
'footer_link_hover_color' => '#606060', 'footer_link_hover_color' => '#606060',
'entry_meta_link_color' => '#595959', 'entry_meta_link_color' => '#595959',
'entry_meta_link_color_hover' => '#1e73be', 'entry_meta_link_color_hover' => '#1e73be',
'blog_post_title_color' => '', 'blog_post_title_color' => '',
'blog_post_title_hover_color' => '', 'blog_post_title_hover_color' => '',
'heading_1_font_size' => '40', 'heading_1_font_size' => '40',
'mobile_heading_1_font_size' => '30', 'mobile_heading_1_font_size' => '30',
'heading_1_weight' => '300', 'heading_1_weight' => '300',
'heading_2_font_size' => '30', 'heading_2_font_size' => '30',
'mobile_heading_2_font_size' => '25', 'mobile_heading_2_font_size' => '25',
'heading_2_weight' => '300', 'heading_2_weight' => '300',
'heading_3_font_size' => '20', 'heading_3_font_size' => '20',
'mobile_heading_3_font_size' => '', 'mobile_heading_3_font_size' => '',
'heading_4_font_size' => '', 'heading_4_font_size' => '',
'mobile_heading_4_font_size' => '', 'mobile_heading_4_font_size' => '',
'heading_5_font_size' => '', 'heading_5_font_size' => '',
'mobile_heading_5_font_size' => '', 'mobile_heading_5_font_size' => '',
); );
foreach ( $old_defaults as $key => $value ) { foreach ( $old_defaults as $key => $value ) {
if ( ! isset( $settings[ $key ] ) ) { if ( ! isset( $settings[ $key ] ) ) {
$settings[ $key ] = $value; $settings[ $key ] = $value;
$update_options = true; $update_options = true;
} }
} }
if ( $update_options ) { if ( $update_options ) {
update_option( 'generate_settings', $settings ); update_option( 'generate_settings', $settings );
} }
$spacing_settings = get_option( 'generate_spacing_settings', array() ); $spacing_settings = get_option( 'generate_spacing_settings', array() );
$update_spacing_options = false; $update_spacing_options = false;
$old_spacing_defaults = array( $old_spacing_defaults = array(
'left_sidebar_width' => '25', 'left_sidebar_width' => '25',
'right_sidebar_width' => '25', 'right_sidebar_width' => '25',
'top_bar_right' => '10', 'top_bar_right' => '10',
'top_bar_left' => '10', 'top_bar_left' => '10',
'mobile_top_bar_right' => '', 'mobile_top_bar_right' => '',
'mobile_top_bar_left' => '', 'mobile_top_bar_left' => '',
'header_top' => '40', 'header_top' => '40',
'header_bottom' => '40', 'header_bottom' => '40',
'mobile_header_right' => '', 'mobile_header_right' => '',
'mobile_header_left' => '', 'mobile_header_left' => '',
'mobile_widget_top' => '', 'mobile_widget_top' => '',
'mobile_widget_right' => '', 'mobile_widget_right' => '',
'mobile_widget_bottom' => '', 'mobile_widget_bottom' => '',
'mobile_widget_left' => '', 'mobile_widget_left' => '',
'mobile_footer_widget_container_top' => '', 'mobile_footer_widget_container_top' => '',
'mobile_footer_widget_container_right' => '', 'mobile_footer_widget_container_right' => '',
'mobile_footer_widget_container_bottom' => '', 'mobile_footer_widget_container_bottom' => '',
'mobile_footer_widget_container_left' => '', 'mobile_footer_widget_container_left' => '',
'footer_right' => '20', 'footer_right' => '20',
'footer_left' => '20', 'footer_left' => '20',
'mobile_footer_right' => '10', 'mobile_footer_right' => '10',
'mobile_footer_left' => '10', 'mobile_footer_left' => '10',
); );
foreach ( $old_spacing_defaults as $key => $value ) { foreach ( $old_spacing_defaults as $key => $value ) {
if ( ! isset( $spacing_settings[ $key ] ) ) { if ( ! isset( $spacing_settings[ $key ] ) ) {
$spacing_settings[ $key ] = $value; $spacing_settings[ $key ] = $value;
$update_spacing_options = true; $update_spacing_options = true;
} }
} }
if ( $update_spacing_options ) { if ( $update_spacing_options ) {
update_option( 'generate_spacing_settings', $spacing_settings ); update_option( 'generate_spacing_settings', $spacing_settings );
} }
if ( $update_options || $update_spacing_options ) { if ( $update_options || $update_spacing_options ) {
delete_option( 'generate_dynamic_css_output' ); delete_option( 'generate_dynamic_css_output' );
delete_option( 'generate_dynamic_css_cached_version' ); delete_option( 'generate_dynamic_css_cached_version' );
// Reset our dynamic CSS file updated time so it regenerates. // Reset our dynamic CSS file updated time so it regenerates.
$dynamic_css_data = get_option( 'generatepress_dynamic_css_data', array() ); $dynamic_css_data = get_option( 'generatepress_dynamic_css_data', array() );
if ( ! empty( $dynamic_css_data ) ) { if ( ! empty( $dynamic_css_data ) ) {
if ( isset( $dynamic_css_data['updated_time'] ) ) { if ( isset( $dynamic_css_data['updated_time'] ) ) {
unset( $dynamic_css_data['updated_time'] ); unset( $dynamic_css_data['updated_time'] );
} }
update_option( 'generatepress_dynamic_css_data', $dynamic_css_data ); update_option( 'generatepress_dynamic_css_data', $dynamic_css_data );
} }
} }
} }
} }
GeneratePress_Theme_Update::get_instance(); GeneratePress_Theme_Update::get_instance();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,23 @@
<?php <?php
/** /**
* Load necessary Customizer controls and functions. * Load necessary Customizer controls and functions.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
// Controls. // Controls.
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-range-control.php'; require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-range-control.php';
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-typography-control.php'; require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-typography-control.php';
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-upsell-section.php'; require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-upsell-section.php';
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-upsell-control.php'; require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-upsell-control.php';
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-deprecated.php'; require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-deprecated.php';
// Helper functions. // Helper functions.
require_once trailingslashit( dirname( __FILE__ ) ) . 'helpers.php'; require_once trailingslashit( dirname( __FILE__ ) ) . 'helpers.php';
// Deprecated. // Deprecated.
require_once trailingslashit( dirname( __FILE__ ) ) . 'deprecated.php'; require_once trailingslashit( dirname( __FILE__ ) ) . 'deprecated.php';

View File

@ -1,348 +1,348 @@
<?php <?php
/** /**
* Helper functions for the Customizer. * Helper functions for the Customizer.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
if ( ! function_exists( 'generate_is_posts_page' ) ) { if ( ! function_exists( 'generate_is_posts_page' ) ) {
/** /**
* Check to see if we're on a posts page * Check to see if we're on a posts page
* *
* @since 1.3.39 * @since 1.3.39
*/ */
function generate_is_posts_page() { function generate_is_posts_page() {
return ( is_home() || is_archive() || is_tax() ) ? true : false; return ( is_home() || is_archive() || is_tax() ) ? true : false;
} }
} }
if ( ! function_exists( 'generate_is_footer_bar_active' ) ) { if ( ! function_exists( 'generate_is_footer_bar_active' ) ) {
/** /**
* Check to see if we're using our footer bar widget * Check to see if we're using our footer bar widget
* *
* @since 1.3.42 * @since 1.3.42
*/ */
function generate_is_footer_bar_active() { function generate_is_footer_bar_active() {
return ( is_active_sidebar( 'footer-bar' ) ) ? true : false; return ( is_active_sidebar( 'footer-bar' ) ) ? true : false;
} }
} }
if ( ! function_exists( 'generate_is_top_bar_active' ) ) { if ( ! function_exists( 'generate_is_top_bar_active' ) ) {
/** /**
* Check to see if the top bar is active * Check to see if the top bar is active
* *
* @since 1.3.45 * @since 1.3.45
*/ */
function generate_is_top_bar_active() { function generate_is_top_bar_active() {
$top_bar = is_active_sidebar( 'top-bar' ) ? true : false; $top_bar = is_active_sidebar( 'top-bar' ) ? true : false;
return apply_filters( 'generate_is_top_bar_active', $top_bar ); return apply_filters( 'generate_is_top_bar_active', $top_bar );
} }
} }
if ( ! function_exists( 'generate_customize_partial_blogname' ) ) { if ( ! function_exists( 'generate_customize_partial_blogname' ) ) {
/** /**
* Render the site title for the selective refresh partial. * Render the site title for the selective refresh partial.
* *
* @since 1.3.41 * @since 1.3.41
*/ */
function generate_customize_partial_blogname() { function generate_customize_partial_blogname() {
bloginfo( 'name' ); bloginfo( 'name' );
} }
} }
if ( ! function_exists( 'generate_customize_partial_blogdescription' ) ) { if ( ! function_exists( 'generate_customize_partial_blogdescription' ) ) {
/** /**
* Render the site tagline for the selective refresh partial. * Render the site tagline for the selective refresh partial.
* *
* @since 1.3.41 * @since 1.3.41
*/ */
function generate_customize_partial_blogdescription() { function generate_customize_partial_blogdescription() {
bloginfo( 'description' ); bloginfo( 'description' );
} }
} }
if ( ! function_exists( 'generate_enqueue_color_palettes' ) ) { if ( ! function_exists( 'generate_enqueue_color_palettes' ) ) {
add_action( 'customize_controls_enqueue_scripts', 'generate_enqueue_color_palettes' ); add_action( 'customize_controls_enqueue_scripts', 'generate_enqueue_color_palettes' );
/** /**
* Add our custom color palettes to the color pickers in the Customizer. * Add our custom color palettes to the color pickers in the Customizer.
* *
* @since 1.3.42 * @since 1.3.42
*/ */
function generate_enqueue_color_palettes() { function generate_enqueue_color_palettes() {
// Old versions of WP don't get nice things. // Old versions of WP don't get nice things.
if ( ! function_exists( 'wp_add_inline_script' ) ) { if ( ! function_exists( 'wp_add_inline_script' ) ) {
return; return;
} }
// Grab our palette array and turn it into JS. // Grab our palette array and turn it into JS.
$palettes = wp_json_encode( generate_get_default_color_palettes() ); $palettes = wp_json_encode( generate_get_default_color_palettes() );
// Add our custom palettes. // Add our custom palettes.
// json_encode takes care of escaping. // json_encode takes care of escaping.
wp_add_inline_script( 'wp-color-picker', 'jQuery.wp.wpColorPicker.prototype.options.palettes = ' . $palettes . ';' ); wp_add_inline_script( 'wp-color-picker', 'jQuery.wp.wpColorPicker.prototype.options.palettes = ' . $palettes . ';' );
} }
} }
if ( ! function_exists( 'generate_sanitize_integer' ) ) { if ( ! function_exists( 'generate_sanitize_integer' ) ) {
/** /**
* Sanitize integers. * Sanitize integers.
* *
* @since 1.0.8 * @since 1.0.8
* @param string $input The value to check. * @param string $input The value to check.
*/ */
function generate_sanitize_integer( $input ) { function generate_sanitize_integer( $input ) {
return absint( $input ); return absint( $input );
} }
} }
if ( ! function_exists( 'generate_sanitize_decimal_integer' ) ) { if ( ! function_exists( 'generate_sanitize_decimal_integer' ) ) {
/** /**
* Sanitize integers that can use decimals. * Sanitize integers that can use decimals.
* *
* @since 1.3.41 * @since 1.3.41
* @param string $input The value to check. * @param string $input The value to check.
*/ */
function generate_sanitize_decimal_integer( $input ) { function generate_sanitize_decimal_integer( $input ) {
return abs( floatval( $input ) ); return abs( floatval( $input ) );
} }
} }
/** /**
* Sanitize a positive number, but allow an empty value. * Sanitize a positive number, but allow an empty value.
* *
* @since 2.2 * @since 2.2
* @param string $input The value to check. * @param string $input The value to check.
*/ */
function generate_sanitize_empty_absint( $input ) { function generate_sanitize_empty_absint( $input ) {
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose. // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose.
if ( '' == $input ) { if ( '' == $input ) {
return ''; return '';
} }
return absint( $input ); return absint( $input );
} }
if ( ! function_exists( 'generate_sanitize_checkbox' ) ) { if ( ! function_exists( 'generate_sanitize_checkbox' ) ) {
/** /**
* Sanitize checkbox values. * Sanitize checkbox values.
* *
* @since 1.0.8 * @since 1.0.8
* @param string $checked The value to check. * @param string $checked The value to check.
*/ */
function generate_sanitize_checkbox( $checked ) { function generate_sanitize_checkbox( $checked ) {
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose. // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose.
return ( ( isset( $checked ) && true == $checked ) ? true : false ); return ( ( isset( $checked ) && true == $checked ) ? true : false );
} }
} }
if ( ! function_exists( 'generate_sanitize_blog_excerpt' ) ) { if ( ! function_exists( 'generate_sanitize_blog_excerpt' ) ) {
/** /**
* Sanitize blog excerpt. * Sanitize blog excerpt.
* Needed because GP Premium calls the control ID which is different from the settings ID. * Needed because GP Premium calls the control ID which is different from the settings ID.
* *
* @since 1.0.8 * @since 1.0.8
* @param string $input The value to check. * @param string $input The value to check.
*/ */
function generate_sanitize_blog_excerpt( $input ) { function generate_sanitize_blog_excerpt( $input ) {
$valid = array( $valid = array(
'full', 'full',
'excerpt', 'excerpt',
); );
if ( in_array( $input, $valid ) ) { if ( in_array( $input, $valid ) ) {
return $input; return $input;
} else { } else {
return 'full'; return 'full';
} }
} }
} }
if ( ! function_exists( 'generate_sanitize_hex_color' ) ) { if ( ! function_exists( 'generate_sanitize_hex_color' ) ) {
/** /**
* Sanitize colors. * Sanitize colors.
* Allow blank value. * Allow blank value.
* *
* @since 1.2.9.6 * @since 1.2.9.6
* @param string $color The color to check. * @param string $color The color to check.
*/ */
function generate_sanitize_hex_color( $color ) { function generate_sanitize_hex_color( $color ) {
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose. // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose.
if ( '' === $color ) { if ( '' === $color ) {
return ''; return '';
} }
// 3 or 6 hex digits, or the empty string. // 3 or 6 hex digits, or the empty string.
if ( preg_match( '|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) { if ( preg_match( '|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) {
return $color; return $color;
} }
return ''; return '';
} }
} }
/** /**
* Sanitize RGBA colors. * Sanitize RGBA colors.
* *
* @since 2.2 * @since 2.2
* @param string $color The color to check. * @param string $color The color to check.
*/ */
function generate_sanitize_rgba_color( $color ) { function generate_sanitize_rgba_color( $color ) {
if ( '' === $color ) { if ( '' === $color ) {
return ''; return '';
} }
if ( false === strpos( $color, 'rgba' ) ) { if ( false === strpos( $color, 'rgba' ) ) {
return generate_sanitize_hex_color( $color ); return generate_sanitize_hex_color( $color );
} }
$color = str_replace( ' ', '', $color ); $color = str_replace( ' ', '', $color );
sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha ); sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha );
return 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $alpha . ')'; return 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $alpha . ')';
} }
if ( ! function_exists( 'generate_sanitize_choices' ) ) { if ( ! function_exists( 'generate_sanitize_choices' ) ) {
/** /**
* Sanitize choices. * Sanitize choices.
* *
* @since 1.3.24 * @since 1.3.24
* @param string $input The value to check. * @param string $input The value to check.
* @param object $setting The setting object. * @param object $setting The setting object.
*/ */
function generate_sanitize_choices( $input, $setting ) { function generate_sanitize_choices( $input, $setting ) {
// Ensure input is a slug. // Ensure input is a slug.
$input = sanitize_key( $input ); $input = sanitize_key( $input );
// Get list of choices from the control. // Get list of choices from the control.
// associated with the setting. // associated with the setting.
$choices = $setting->manager->get_control( $setting->id )->choices; $choices = $setting->manager->get_control( $setting->id )->choices;
// If the input is a valid key, return it. // If the input is a valid key, return it.
// otherwise, return the default. // otherwise, return the default.
return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
} }
} }
/** /**
* Sanitize our Google Font variants * Sanitize our Google Font variants
* *
* @since 2.0 * @since 2.0
* @param string $input The value to check. * @param string $input The value to check.
*/ */
function generate_sanitize_variants( $input ) { function generate_sanitize_variants( $input ) {
if ( is_array( $input ) ) { if ( is_array( $input ) ) {
$input = implode( ',', $input ); $input = implode( ',', $input );
} }
return sanitize_text_field( $input ); return sanitize_text_field( $input );
} }
add_action( 'customize_controls_enqueue_scripts', 'generate_do_control_inline_scripts', 100 ); add_action( 'customize_controls_enqueue_scripts', 'generate_do_control_inline_scripts', 100 );
/** /**
* Add misc inline scripts to our controls. * Add misc inline scripts to our controls.
* *
* We don't want to add these to the controls themselves, as they will be repeated * We don't want to add these to the controls themselves, as they will be repeated
* each time the control is initialized. * each time the control is initialized.
* *
* @since 2.0 * @since 2.0
*/ */
function generate_do_control_inline_scripts() { function generate_do_control_inline_scripts() {
wp_localize_script( wp_localize_script(
'generatepress-typography-customizer', 'generatepress-typography-customizer',
'gp_customize', 'gp_customize',
array( array(
'nonce' => wp_create_nonce( 'gp_customize_nonce' ), 'nonce' => wp_create_nonce( 'gp_customize_nonce' ),
) )
); );
$number_of_fonts = apply_filters( 'generate_number_of_fonts', 200 ); $number_of_fonts = apply_filters( 'generate_number_of_fonts', 200 );
wp_localize_script( wp_localize_script(
'generatepress-typography-customizer', 'generatepress-typography-customizer',
'generatePressTypography', 'generatePressTypography',
array( array(
'googleFonts' => apply_filters( 'generate_typography_customize_list', generate_get_all_google_fonts( $number_of_fonts ) ), 'googleFonts' => apply_filters( 'generate_typography_customize_list', generate_get_all_google_fonts( $number_of_fonts ) ),
) )
); );
wp_localize_script( 'generatepress-typography-customizer', 'typography_defaults', generate_typography_default_fonts() ); wp_localize_script( 'generatepress-typography-customizer', 'typography_defaults', generate_typography_default_fonts() );
wp_enqueue_script( 'generatepress-customizer-controls', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/customizer-controls.js', array( 'customize-controls', 'jquery' ), GENERATE_VERSION, true ); wp_enqueue_script( 'generatepress-customizer-controls', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/customizer-controls.js', array( 'customize-controls', 'jquery' ), GENERATE_VERSION, true );
wp_localize_script( 'generatepress-customizer-controls', 'generatepress_defaults', generate_get_defaults() ); wp_localize_script( 'generatepress-customizer-controls', 'generatepress_defaults', generate_get_defaults() );
wp_localize_script( 'generatepress-customizer-controls', 'generatepress_color_defaults', generate_get_color_defaults() ); wp_localize_script( 'generatepress-customizer-controls', 'generatepress_color_defaults', generate_get_color_defaults() );
wp_localize_script( 'generatepress-customizer-controls', 'generatepress_typography_defaults', generate_get_default_fonts() ); wp_localize_script( 'generatepress-customizer-controls', 'generatepress_typography_defaults', generate_get_default_fonts() );
wp_localize_script( 'generatepress-customizer-controls', 'generatepress_spacing_defaults', generate_spacing_get_defaults() ); wp_localize_script( 'generatepress-customizer-controls', 'generatepress_spacing_defaults', generate_spacing_get_defaults() );
} }
if ( ! function_exists( 'generate_customizer_live_preview' ) ) { if ( ! function_exists( 'generate_customizer_live_preview' ) ) {
add_action( 'customize_preview_init', 'generate_customizer_live_preview', 100 ); add_action( 'customize_preview_init', 'generate_customizer_live_preview', 100 );
/** /**
* Add our live preview scripts * Add our live preview scripts
* *
* @since 0.1 * @since 0.1
*/ */
function generate_customizer_live_preview() { function generate_customizer_live_preview() {
$spacing_settings = wp_parse_args( $spacing_settings = wp_parse_args(
get_option( 'generate_spacing_settings', array() ), get_option( 'generate_spacing_settings', array() ),
generate_spacing_get_defaults() generate_spacing_get_defaults()
); );
wp_enqueue_script( 'generate-themecustomizer', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/customizer-live-preview.js', array( 'customize-preview' ), GENERATE_VERSION, true ); wp_enqueue_script( 'generate-themecustomizer', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/customizer-live-preview.js', array( 'customize-preview' ), GENERATE_VERSION, true );
wp_localize_script( wp_localize_script(
'generate-themecustomizer', 'generate-themecustomizer',
'generatepress_live_preview', 'generatepress_live_preview',
array( array(
'mobile' => generate_get_media_query( 'mobile' ), 'mobile' => generate_get_media_query( 'mobile' ),
'tablet' => generate_get_media_query( 'tablet' ), 'tablet' => generate_get_media_query( 'tablet' ),
'desktop' => generate_get_media_query( 'desktop' ), 'desktop' => generate_get_media_query( 'desktop' ),
'contentLeft' => absint( $spacing_settings['content_left'] ), 'contentLeft' => absint( $spacing_settings['content_left'] ),
'contentRight' => absint( $spacing_settings['content_right'] ), 'contentRight' => absint( $spacing_settings['content_right'] ),
'isFlex' => generate_is_using_flexbox(), 'isFlex' => generate_is_using_flexbox(),
'isRTL' => is_rtl(), 'isRTL' => is_rtl(),
) )
); );
} }
} }
/** /**
* Check to see if we have a logo or not. * Check to see if we have a logo or not.
* *
* Used as an active callback. Calling has_custom_logo creates a PHP notice for * Used as an active callback. Calling has_custom_logo creates a PHP notice for
* multisite users. * multisite users.
* *
* @since 2.0.1 * @since 2.0.1
*/ */
function generate_has_custom_logo_callback() { function generate_has_custom_logo_callback() {
if ( get_theme_mod( 'custom_logo' ) ) { if ( get_theme_mod( 'custom_logo' ) ) {
return true; return true;
} }
return false; return false;
} }
/** /**
* Save our preset layout controls. These should always save to be "current". * Save our preset layout controls. These should always save to be "current".
* *
* @since 2.2 * @since 2.2
*/ */
function generate_sanitize_preset_layout() { function generate_sanitize_preset_layout() {
return 'current'; return 'current';
} }
/** /**
* Display options if we're using the Floats structure. * Display options if we're using the Floats structure.
*/ */
function generate_is_using_floats_callback() { function generate_is_using_floats_callback() {
return 'floats' === generate_get_option( 'structure' ); return 'floats' === generate_get_option( 'structure' );
} }
/** /**
* Callback to determine whether to show the inline logo option. * Callback to determine whether to show the inline logo option.
*/ */
function generate_show_inline_logo_callback() { function generate_show_inline_logo_callback() {
return 'floats' === generate_get_option( 'structure' ) && generate_has_logo_site_branding(); return 'floats' === generate_get_option( 'structure' ) && generate_has_logo_site_branding();
} }

View File

@ -1,378 +1,378 @@
<?php <?php
/** /**
* Builds our admin page. * Builds our admin page.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
if ( ! function_exists( 'generate_create_menu' ) ) { if ( ! function_exists( 'generate_create_menu' ) ) {
add_action( 'admin_menu', 'generate_create_menu' ); add_action( 'admin_menu', 'generate_create_menu' );
/** /**
* Adds our "GeneratePress" dashboard menu item * Adds our "GeneratePress" dashboard menu item
* *
* @since 0.1 * @since 0.1
*/ */
function generate_create_menu() { function generate_create_menu() {
$generate_page = add_theme_page( esc_html__( 'GeneratePress', 'generatepress' ), esc_html__( 'GeneratePress', 'generatepress' ), apply_filters( 'generate_dashboard_page_capability', 'edit_theme_options' ), 'generate-options', 'generate_settings_page' ); $generate_page = add_theme_page( esc_html__( 'GeneratePress', 'generatepress' ), esc_html__( 'GeneratePress', 'generatepress' ), apply_filters( 'generate_dashboard_page_capability', 'edit_theme_options' ), 'generate-options', 'generate_settings_page' );
add_action( "admin_print_styles-$generate_page", 'generate_options_styles' ); add_action( "admin_print_styles-$generate_page", 'generate_options_styles' );
} }
} }
if ( ! function_exists( 'generate_options_styles' ) ) { if ( ! function_exists( 'generate_options_styles' ) ) {
/** /**
* Adds any necessary scripts to the GP dashboard page * Adds any necessary scripts to the GP dashboard page
* *
* @since 0.1 * @since 0.1
*/ */
function generate_options_styles() { function generate_options_styles() {
wp_enqueue_style( 'generate-options', get_template_directory_uri() . '/assets/css/admin/style.css', array(), GENERATE_VERSION ); wp_enqueue_style( 'generate-options', get_template_directory_uri() . '/assets/css/admin/style.css', array(), GENERATE_VERSION );
} }
} }
if ( ! function_exists( 'generate_settings_page' ) ) { if ( ! function_exists( 'generate_settings_page' ) ) {
/** /**
* Builds the content of our GP dashboard page * Builds the content of our GP dashboard page
* *
* @since 0.1 * @since 0.1
*/ */
function generate_settings_page() { function generate_settings_page() {
?> ?>
<div class="wrap"> <div class="wrap">
<div class="metabox-holder"> <div class="metabox-holder">
<div class="gp-masthead clearfix"> <div class="gp-masthead clearfix">
<div class="gp-container"> <div class="gp-container">
<div class="gp-title"> <div class="gp-title">
<a href="<?php echo generate_get_premium_url( 'https://generatepress.com' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in function. ?>" target="_blank">GeneratePress</a> <span class="gp-version"><?php echo esc_html( GENERATE_VERSION ); ?></span> <a href="<?php echo generate_get_premium_url( 'https://generatepress.com' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in function. ?>" target="_blank">GeneratePress</a> <span class="gp-version"><?php echo esc_html( GENERATE_VERSION ); ?></span>
</div> </div>
<div class="gp-masthead-links"> <div class="gp-masthead-links">
<?php if ( ! defined( 'GP_PREMIUM_VERSION' ) ) : ?> <?php if ( ! defined( 'GP_PREMIUM_VERSION' ) ) : ?>
<a style="font-weight: bold;" href="<?php echo generate_get_premium_url( 'https://generatepress.com/premium/' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in function. ?>" target="_blank"><?php esc_html_e( 'Premium', 'generatepress' ); ?></a> <a style="font-weight: bold;" href="<?php echo generate_get_premium_url( 'https://generatepress.com/premium/' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in function. ?>" target="_blank"><?php esc_html_e( 'Premium', 'generatepress' ); ?></a>
<?php endif; ?> <?php endif; ?>
<a href="<?php echo esc_url( 'https://generatepress.com/support' ); ?>" target="_blank"><?php esc_html_e( 'Support', 'generatepress' ); ?></a> <a href="<?php echo esc_url( 'https://generatepress.com/support' ); ?>" target="_blank"><?php esc_html_e( 'Support', 'generatepress' ); ?></a>
<a href="<?php echo esc_url( 'https://docs.generatepress.com' ); ?>" target="_blank"><?php esc_html_e( 'Documentation', 'generatepress' ); ?></a> <a href="<?php echo esc_url( 'https://docs.generatepress.com' ); ?>" target="_blank"><?php esc_html_e( 'Documentation', 'generatepress' ); ?></a>
</div> </div>
</div> </div>
</div> </div>
<?php <?php
/** /**
* generate_dashboard_after_header hook. * generate_dashboard_after_header hook.
* *
* @since 2.0 * @since 2.0
*/ */
do_action( 'generate_dashboard_after_header' ); do_action( 'generate_dashboard_after_header' );
?> ?>
<div class="gp-container"> <div class="gp-container">
<div class="postbox-container clearfix" style="float: none;"> <div class="postbox-container clearfix" style="float: none;">
<div class="grid-container grid-parent"> <div class="grid-container grid-parent">
<?php <?php
/** /**
* generate_dashboard_inside_container hook. * generate_dashboard_inside_container hook.
* *
* @since 2.0 * @since 2.0
*/ */
do_action( 'generate_dashboard_inside_container' ); do_action( 'generate_dashboard_inside_container' );
?> ?>
<div class="form-metabox grid-70" style="padding-left: 0;"> <div class="form-metabox grid-70" style="padding-left: 0;">
<h2 style="height:0;margin:0;"><!-- admin notices below this element --></h2> <h2 style="height:0;margin:0;"><!-- admin notices below this element --></h2>
<form method="post" action="options.php"> <form method="post" action="options.php">
<?php settings_fields( 'generate-settings-group' ); ?> <?php settings_fields( 'generate-settings-group' ); ?>
<?php do_settings_sections( 'generate-settings-group' ); ?> <?php do_settings_sections( 'generate-settings-group' ); ?>
<div class="customize-button hide-on-desktop"> <div class="customize-button hide-on-desktop">
<?php <?php
printf( printf(
'<a id="generate_customize_button" class="button button-primary" href="%1$s">%2$s</a>', '<a id="generate_customize_button" class="button button-primary" href="%1$s">%2$s</a>',
esc_url( admin_url( 'customize.php' ) ), esc_url( admin_url( 'customize.php' ) ),
esc_html__( 'Customize', 'generatepress' ) esc_html__( 'Customize', 'generatepress' )
); );
?> ?>
</div> </div>
<?php <?php
/** /**
* generate_inside_options_form hook. * generate_inside_options_form hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_inside_options_form' ); do_action( 'generate_inside_options_form' );
?> ?>
</form> </form>
<?php <?php
$modules = array( $modules = array(
'Backgrounds' => array( 'Backgrounds' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#backgrounds', false ), 'url' => generate_get_premium_url( 'https://generatepress.com/premium/#backgrounds', false ),
), ),
'Blog' => array( 'Blog' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#blog', false ), 'url' => generate_get_premium_url( 'https://generatepress.com/premium/#blog', false ),
), ),
'Colors' => array( 'Colors' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#colors', false ), 'url' => generate_get_premium_url( 'https://generatepress.com/premium/#colors', false ),
), ),
'Copyright' => array( 'Copyright' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#copyright', false ), 'url' => generate_get_premium_url( 'https://generatepress.com/premium/#copyright', false ),
), ),
'Disable Elements' => array( 'Disable Elements' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#disable-elements', false ), 'url' => generate_get_premium_url( 'https://generatepress.com/premium/#disable-elements', false ),
), ),
'Elements' => array( 'Elements' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#elements', false ), 'url' => generate_get_premium_url( 'https://generatepress.com/premium/#elements', false ),
), ),
'Import / Export' => array( 'Import / Export' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#import-export', false ), 'url' => generate_get_premium_url( 'https://generatepress.com/premium/#import-export', false ),
), ),
'Menu Plus' => array( 'Menu Plus' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#menu-plus', false ), 'url' => generate_get_premium_url( 'https://generatepress.com/premium/#menu-plus', false ),
), ),
'Secondary Nav' => array( 'Secondary Nav' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#secondary-nav', false ), 'url' => generate_get_premium_url( 'https://generatepress.com/premium/#secondary-nav', false ),
), ),
'Sections' => array( 'Sections' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#sections', false ), 'url' => generate_get_premium_url( 'https://generatepress.com/premium/#sections', false ),
), ),
'Site Library' => array( 'Site Library' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/site-library', false ), 'url' => generate_get_premium_url( 'https://generatepress.com/site-library', false ),
), ),
'Spacing' => array( 'Spacing' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#spacing', false ), 'url' => generate_get_premium_url( 'https://generatepress.com/premium/#spacing', false ),
), ),
'Typography' => array( 'Typography' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#typography', false ), 'url' => generate_get_premium_url( 'https://generatepress.com/premium/#typography', false ),
), ),
'WooCommerce' => array( 'WooCommerce' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#woocommerce', false ), 'url' => generate_get_premium_url( 'https://generatepress.com/premium/#woocommerce', false ),
), ),
); );
if ( ! defined( 'GP_PREMIUM_VERSION' ) ) : if ( ! defined( 'GP_PREMIUM_VERSION' ) ) :
?> ?>
<div class="postbox generate-metabox"> <div class="postbox generate-metabox">
<h3 class="hndle"><?php esc_html_e( 'Premium Modules', 'generatepress' ); ?></h3> <h3 class="hndle"><?php esc_html_e( 'Premium Modules', 'generatepress' ); ?></h3>
<div class="inside" style="margin:0;padding:0;"> <div class="inside" style="margin:0;padding:0;">
<div class="premium-addons"> <div class="premium-addons">
<?php <?php
foreach ( $modules as $module => $info ) { foreach ( $modules as $module => $info ) {
?> ?>
<div class="add-on activated gp-clear addon-container grid-parent"> <div class="add-on activated gp-clear addon-container grid-parent">
<div class="addon-name column-addon-name" style=""> <div class="addon-name column-addon-name" style="">
<a href="<?php echo esc_url( $info['url'] ); ?>" target="_blank"><?php echo esc_html( $module ); ?></a> <a href="<?php echo esc_url( $info['url'] ); ?>" target="_blank"><?php echo esc_html( $module ); ?></a>
</div> </div>
<div class="addon-action addon-addon-action" style="text-align:right;"> <div class="addon-action addon-addon-action" style="text-align:right;">
<a href="<?php echo esc_url( $info['url'] ); ?>" target="_blank"><?php esc_html_e( 'Learn more', 'generatepress' ); ?></a> <a href="<?php echo esc_url( $info['url'] ); ?>" target="_blank"><?php esc_html_e( 'Learn more', 'generatepress' ); ?></a>
</div> </div>
</div> </div>
<div class="gp-clear"></div> <div class="gp-clear"></div>
<?php } ?> <?php } ?>
</div> </div>
</div> </div>
</div> </div>
<?php <?php
endif; endif;
/** /**
* generate_options_items hook. * generate_options_items hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_options_items' ); do_action( 'generate_options_items' );
$typography_section = 'customize.php?autofocus[section]=font_section'; $typography_section = 'customize.php?autofocus[section]=font_section';
$colors_section = 'customize.php?autofocus[section]=body_section'; $colors_section = 'customize.php?autofocus[section]=body_section';
if ( function_exists( 'generatepress_is_module_active' ) ) { if ( function_exists( 'generatepress_is_module_active' ) ) {
if ( generatepress_is_module_active( 'generate_package_typography', 'GENERATE_TYPOGRAPHY' ) ) { if ( generatepress_is_module_active( 'generate_package_typography', 'GENERATE_TYPOGRAPHY' ) ) {
$typography_section = 'customize.php?autofocus[panel]=generate_typography_panel'; $typography_section = 'customize.php?autofocus[panel]=generate_typography_panel';
} }
if ( generatepress_is_module_active( 'generate_package_colors', 'GENERATE_COLORS' ) ) { if ( generatepress_is_module_active( 'generate_package_colors', 'GENERATE_COLORS' ) ) {
$colors_section = 'customize.php?autofocus[panel]=generate_colors_panel'; $colors_section = 'customize.php?autofocus[panel]=generate_colors_panel';
} }
} }
$quick_settings = array( $quick_settings = array(
'logo' => array( 'logo' => array(
'title' => __( 'Upload Logo', 'generatepress' ), 'title' => __( 'Upload Logo', 'generatepress' ),
'icon' => 'dashicons-format-image', 'icon' => 'dashicons-format-image',
'url' => admin_url( 'customize.php?autofocus[control]=custom_logo' ), 'url' => admin_url( 'customize.php?autofocus[control]=custom_logo' ),
), ),
'typography' => array( 'typography' => array(
'title' => __( 'Customize Fonts', 'generatepress' ), 'title' => __( 'Customize Fonts', 'generatepress' ),
'icon' => 'dashicons-editor-textcolor', 'icon' => 'dashicons-editor-textcolor',
'url' => admin_url( $typography_section ), 'url' => admin_url( $typography_section ),
), ),
'colors' => array( 'colors' => array(
'title' => __( 'Customize Colors', 'generatepress' ), 'title' => __( 'Customize Colors', 'generatepress' ),
'icon' => 'dashicons-admin-customizer', 'icon' => 'dashicons-admin-customizer',
'url' => admin_url( $colors_section ), 'url' => admin_url( $colors_section ),
), ),
'layout' => array( 'layout' => array(
'title' => __( 'Layout Options', 'generatepress' ), 'title' => __( 'Layout Options', 'generatepress' ),
'icon' => 'dashicons-layout', 'icon' => 'dashicons-layout',
'url' => admin_url( 'customize.php?autofocus[panel]=generate_layout_panel' ), 'url' => admin_url( 'customize.php?autofocus[panel]=generate_layout_panel' ),
), ),
'all' => array( 'all' => array(
'title' => __( 'All Options', 'generatepress' ), 'title' => __( 'All Options', 'generatepress' ),
'icon' => 'dashicons-admin-generic', 'icon' => 'dashicons-admin-generic',
'url' => admin_url( 'customize.php' ), 'url' => admin_url( 'customize.php' ),
), ),
); );
?> ?>
</div> </div>
<div class="generate-right-sidebar grid-30" style="padding-right: 0;"> <div class="generate-right-sidebar grid-30" style="padding-right: 0;">
<div class="postbox generate-metabox start-customizing"> <div class="postbox generate-metabox start-customizing">
<h3 class="hndle"><?php esc_html_e( 'Start Customizing', 'generatepress' ); ?></h3> <h3 class="hndle"><?php esc_html_e( 'Start Customizing', 'generatepress' ); ?></h3>
<div class="inside"> <div class="inside">
<ul> <ul>
<?php <?php
foreach ( $quick_settings as $key => $data ) { foreach ( $quick_settings as $key => $data ) {
printf( printf(
'<li><span class="dashicons %1$s"></span> <a href="%2$s">%3$s</a></li>', '<li><span class="dashicons %1$s"></span> <a href="%2$s">%3$s</a></li>',
esc_attr( $data['icon'] ), esc_attr( $data['icon'] ),
esc_url( $data['url'] ), esc_url( $data['url'] ),
esc_html( $data['title'] ) esc_html( $data['title'] )
); );
} }
?> ?>
</ul> </ul>
<p><?php esc_html_e( 'Want to learn more about the theme? Check out our extensive documentation.', 'generatepress' ); ?></p> <p><?php esc_html_e( 'Want to learn more about the theme? Check out our extensive documentation.', 'generatepress' ); ?></p>
<a href="https://docs.generatepress.com"><?php esc_html_e( 'Visit documentation &rarr;', 'generatepress' ); ?></a> <a href="https://docs.generatepress.com"><?php esc_html_e( 'Visit documentation &rarr;', 'generatepress' ); ?></a>
</div> </div>
</div> </div>
<?php <?php
/** /**
* generate_admin_right_panel hook. * generate_admin_right_panel hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_admin_right_panel' ); do_action( 'generate_admin_right_panel' );
?> ?>
<div class="postbox generate-metabox" id="gen-delete"> <div class="postbox generate-metabox" id="gen-delete">
<h3 class="hndle"><?php esc_html_e( 'Reset Settings', 'generatepress' ); ?></h3> <h3 class="hndle"><?php esc_html_e( 'Reset Settings', 'generatepress' ); ?></h3>
<div class="inside"> <div class="inside">
<p><?php esc_html_e( 'Deleting your settings can not be undone.', 'generatepress' ); ?></p> <p><?php esc_html_e( 'Deleting your settings can not be undone.', 'generatepress' ); ?></p>
<form method="post"> <form method="post">
<p><input type="hidden" name="generate_reset_customizer" value="generate_reset_customizer_settings" /></p> <p><input type="hidden" name="generate_reset_customizer" value="generate_reset_customizer_settings" /></p>
<p> <p>
<?php <?php
$warning = 'return confirm("' . esc_html__( 'Warning: This will delete your settings.', 'generatepress' ) . '")'; $warning = 'return confirm("' . esc_html__( 'Warning: This will delete your settings.', 'generatepress' ) . '")';
wp_nonce_field( 'generate_reset_customizer_nonce', 'generate_reset_customizer_nonce' ); wp_nonce_field( 'generate_reset_customizer_nonce', 'generate_reset_customizer_nonce' );
submit_button( submit_button(
esc_attr__( 'Reset', 'generatepress' ), esc_attr__( 'Reset', 'generatepress' ),
'button-primary', 'button-primary',
'submit', 'submit',
false, false,
array( array(
'onclick' => esc_js( $warning ), 'onclick' => esc_js( $warning ),
) )
); );
?> ?>
</p> </p>
</form> </form>
<?php <?php
/** /**
* generate_delete_settings_form hook. * generate_delete_settings_form hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_delete_settings_form' ); do_action( 'generate_delete_settings_form' );
?> ?>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="gp-options-footer"> <div class="gp-options-footer">
<span> <span>
<?php <?php
printf( printf(
/* translators: %s: Heart icon */ /* translators: %s: Heart icon */
_x( 'Made with %s by Tom Usborne', 'made with love', 'generatepress' ), _x( 'Made with %s by Tom Usborne', 'made with love', 'generatepress' ),
'<span style="color:#D04848" class="dashicons dashicons-heart"></span>' '<span style="color:#D04848" class="dashicons dashicons-heart"></span>'
); );
?> ?>
</span> </span>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<?php <?php
} }
} }
if ( ! function_exists( 'generate_reset_customizer_settings' ) ) { if ( ! function_exists( 'generate_reset_customizer_settings' ) ) {
add_action( 'admin_init', 'generate_reset_customizer_settings' ); add_action( 'admin_init', 'generate_reset_customizer_settings' );
/** /**
* Reset customizer settings * Reset customizer settings
* *
* @since 0.1 * @since 0.1
*/ */
function generate_reset_customizer_settings() { function generate_reset_customizer_settings() {
if ( empty( $_POST['generate_reset_customizer'] ) || 'generate_reset_customizer_settings' !== $_POST['generate_reset_customizer'] ) { if ( empty( $_POST['generate_reset_customizer'] ) || 'generate_reset_customizer_settings' !== $_POST['generate_reset_customizer'] ) {
return; return;
} }
$nonce = isset( $_POST['generate_reset_customizer_nonce'] ) ? sanitize_key( $_POST['generate_reset_customizer_nonce'] ) : ''; $nonce = isset( $_POST['generate_reset_customizer_nonce'] ) ? sanitize_key( $_POST['generate_reset_customizer_nonce'] ) : '';
if ( ! wp_verify_nonce( $nonce, 'generate_reset_customizer_nonce' ) ) { if ( ! wp_verify_nonce( $nonce, 'generate_reset_customizer_nonce' ) ) {
return; return;
} }
if ( ! current_user_can( 'manage_options' ) ) { if ( ! current_user_can( 'manage_options' ) ) {
return; return;
} }
delete_option( 'generate_settings' ); delete_option( 'generate_settings' );
delete_option( 'generate_dynamic_css_output' ); delete_option( 'generate_dynamic_css_output' );
delete_option( 'generate_dynamic_css_cached_version' ); delete_option( 'generate_dynamic_css_cached_version' );
remove_theme_mod( 'font_body_variants' ); remove_theme_mod( 'font_body_variants' );
remove_theme_mod( 'font_body_category' ); remove_theme_mod( 'font_body_category' );
wp_safe_redirect( admin_url( 'themes.php?page=generate-options&status=reset' ) ); wp_safe_redirect( admin_url( 'themes.php?page=generate-options&status=reset' ) );
exit; exit;
} }
} }
if ( ! function_exists( 'generate_admin_errors' ) ) { if ( ! function_exists( 'generate_admin_errors' ) ) {
add_action( 'admin_notices', 'generate_admin_errors' ); add_action( 'admin_notices', 'generate_admin_errors' );
/** /**
* Add our admin notices * Add our admin notices
* *
* @since 0.1 * @since 0.1
*/ */
function generate_admin_errors() { function generate_admin_errors() {
$screen = get_current_screen(); $screen = get_current_screen();
if ( 'appearance_page_generate-options' !== $screen->base ) { if ( 'appearance_page_generate-options' !== $screen->base ) {
return; return;
} }
if ( isset( $_GET['settings-updated'] ) && 'true' === $_GET['settings-updated'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only checking. False positive. if ( isset( $_GET['settings-updated'] ) && 'true' === $_GET['settings-updated'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only checking. False positive.
add_settings_error( 'generate-notices', 'true', esc_html__( 'Settings saved.', 'generatepress' ), 'updated' ); add_settings_error( 'generate-notices', 'true', esc_html__( 'Settings saved.', 'generatepress' ), 'updated' );
} }
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only checking. False positive. // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only checking. False positive.
if ( isset( $_GET['status'] ) && 'imported' === $_GET['status'] ) { if ( isset( $_GET['status'] ) && 'imported' === $_GET['status'] ) {
add_settings_error( 'generate-notices', 'imported', esc_html__( 'Import successful.', 'generatepress' ), 'updated' ); add_settings_error( 'generate-notices', 'imported', esc_html__( 'Import successful.', 'generatepress' ), 'updated' );
} }
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only checking. False positive. // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only checking. False positive.
if ( isset( $_GET['status'] ) && 'reset' === $_GET['status'] ) { if ( isset( $_GET['status'] ) && 'reset' === $_GET['status'] ) {
add_settings_error( 'generate-notices', 'reset', esc_html__( 'Settings removed.', 'generatepress' ), 'updated' ); add_settings_error( 'generate-notices', 'reset', esc_html__( 'Settings removed.', 'generatepress' ), 'updated' );
} }
settings_errors( 'generate-notices' ); settings_errors( 'generate-notices' );
} }
} }

View File

@ -1,368 +1,368 @@
<?php <?php
/** /**
* Sets all of our theme defaults. * Sets all of our theme defaults.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
if ( ! function_exists( 'generate_get_defaults' ) ) { if ( ! function_exists( 'generate_get_defaults' ) ) {
/** /**
* Set default options * Set default options
* *
* @since 0.1 * @since 0.1
*/ */
function generate_get_defaults() { function generate_get_defaults() {
return apply_filters( return apply_filters(
'generate_option_defaults', 'generate_option_defaults',
array( array(
'hide_title' => '', 'hide_title' => '',
'hide_tagline' => true, 'hide_tagline' => true,
'logo' => '', 'logo' => '',
'inline_logo_site_branding' => false, 'inline_logo_site_branding' => false,
'retina_logo' => '', 'retina_logo' => '',
'logo_width' => '', 'logo_width' => '',
'top_bar_width' => 'full', 'top_bar_width' => 'full',
'top_bar_inner_width' => 'contained', 'top_bar_inner_width' => 'contained',
'top_bar_alignment' => 'right', 'top_bar_alignment' => 'right',
'container_width' => '1200', 'container_width' => '1200',
'container_alignment' => 'text', 'container_alignment' => 'text',
'header_layout_setting' => 'fluid-header', 'header_layout_setting' => 'fluid-header',
'header_inner_width' => 'contained', 'header_inner_width' => 'contained',
'nav_alignment_setting' => is_rtl() ? 'right' : 'left', 'nav_alignment_setting' => is_rtl() ? 'right' : 'left',
'header_alignment_setting' => is_rtl() ? 'right' : 'left', 'header_alignment_setting' => is_rtl() ? 'right' : 'left',
'nav_layout_setting' => 'fluid-nav', 'nav_layout_setting' => 'fluid-nav',
'nav_inner_width' => 'contained', 'nav_inner_width' => 'contained',
'nav_position_setting' => 'nav-float-right', 'nav_position_setting' => 'nav-float-right',
'nav_drop_point' => '', 'nav_drop_point' => '',
'nav_dropdown_type' => 'hover', 'nav_dropdown_type' => 'hover',
'nav_dropdown_direction' => is_rtl() ? 'left' : 'right', 'nav_dropdown_direction' => is_rtl() ? 'left' : 'right',
'nav_search' => 'disable', 'nav_search' => 'disable',
'content_layout_setting' => 'separate-containers', 'content_layout_setting' => 'separate-containers',
'layout_setting' => 'right-sidebar', 'layout_setting' => 'right-sidebar',
'blog_layout_setting' => 'right-sidebar', 'blog_layout_setting' => 'right-sidebar',
'single_layout_setting' => 'right-sidebar', 'single_layout_setting' => 'right-sidebar',
'post_content' => 'excerpt', 'post_content' => 'excerpt',
'footer_layout_setting' => 'fluid-footer', 'footer_layout_setting' => 'fluid-footer',
'footer_inner_width' => 'contained', 'footer_inner_width' => 'contained',
'footer_widget_setting' => '3', 'footer_widget_setting' => '3',
'footer_bar_alignment' => 'right', 'footer_bar_alignment' => 'right',
'back_to_top' => '', 'back_to_top' => '',
'background_color' => '#f7f8f9', 'background_color' => '#f7f8f9',
'text_color' => '#222222', 'text_color' => '#222222',
'link_color' => '#1e73be', 'link_color' => '#1e73be',
'link_color_hover' => '#000000', 'link_color_hover' => '#000000',
'link_color_visited' => '', 'link_color_visited' => '',
'font_awesome_essentials' => true, 'font_awesome_essentials' => true,
'icons' => 'svg', 'icons' => 'svg',
'combine_css' => true, 'combine_css' => true,
'dynamic_css_cache' => true, 'dynamic_css_cache' => true,
'structure' => 'flexbox', 'structure' => 'flexbox',
) )
); );
} }
} }
if ( ! function_exists( 'generate_get_color_defaults' ) ) { if ( ! function_exists( 'generate_get_color_defaults' ) ) {
/** /**
* Set default options * Set default options
*/ */
function generate_get_color_defaults() { function generate_get_color_defaults() {
return apply_filters( return apply_filters(
'generate_color_option_defaults', 'generate_color_option_defaults',
array( array(
'top_bar_background_color' => '#636363', 'top_bar_background_color' => '#636363',
'top_bar_text_color' => '#ffffff', 'top_bar_text_color' => '#ffffff',
'top_bar_link_color' => '#ffffff', 'top_bar_link_color' => '#ffffff',
'top_bar_link_color_hover' => '#303030', 'top_bar_link_color_hover' => '#303030',
'header_background_color' => '#ffffff', 'header_background_color' => '#ffffff',
'header_text_color' => '', 'header_text_color' => '',
'header_link_color' => '', 'header_link_color' => '',
'header_link_hover_color' => '', 'header_link_hover_color' => '',
'site_title_color' => '#222222', 'site_title_color' => '#222222',
'site_tagline_color' => '#757575', 'site_tagline_color' => '#757575',
'navigation_background_color' => '#ffffff', 'navigation_background_color' => '#ffffff',
'navigation_text_color' => '#515151', 'navigation_text_color' => '#515151',
'navigation_background_hover_color' => '#ffffff', 'navigation_background_hover_color' => '#ffffff',
'navigation_text_hover_color' => '#7a8896', 'navigation_text_hover_color' => '#7a8896',
'navigation_background_current_color' => '#ffffff', 'navigation_background_current_color' => '#ffffff',
'navigation_text_current_color' => '#7a8896', 'navigation_text_current_color' => '#7a8896',
'subnavigation_background_color' => '#eaeaea', 'subnavigation_background_color' => '#eaeaea',
'subnavigation_text_color' => '#515151', 'subnavigation_text_color' => '#515151',
'subnavigation_background_hover_color' => '#eaeaea', 'subnavigation_background_hover_color' => '#eaeaea',
'subnavigation_text_hover_color' => '#7a8896', 'subnavigation_text_hover_color' => '#7a8896',
'subnavigation_background_current_color' => '#eaeaea', 'subnavigation_background_current_color' => '#eaeaea',
'subnavigation_text_current_color' => '#7a8896', 'subnavigation_text_current_color' => '#7a8896',
'navigation_search_background_color' => '', 'navigation_search_background_color' => '',
'navigation_search_text_color' => '', 'navigation_search_text_color' => '',
'content_background_color' => '#ffffff', 'content_background_color' => '#ffffff',
'content_text_color' => '', 'content_text_color' => '',
'content_link_color' => '', 'content_link_color' => '',
'content_link_hover_color' => '', 'content_link_hover_color' => '',
'content_title_color' => '', 'content_title_color' => '',
'blog_post_title_color' => '#222222', 'blog_post_title_color' => '#222222',
'blog_post_title_hover_color' => '#55555e', 'blog_post_title_hover_color' => '#55555e',
'entry_meta_text_color' => '#595959', 'entry_meta_text_color' => '#595959',
'entry_meta_link_color' => '', 'entry_meta_link_color' => '',
'entry_meta_link_color_hover' => '', 'entry_meta_link_color_hover' => '',
'h1_color' => '', 'h1_color' => '',
'h2_color' => '', 'h2_color' => '',
'h3_color' => '', 'h3_color' => '',
'h4_color' => '', 'h4_color' => '',
'h5_color' => '', 'h5_color' => '',
'h6_color' => '', 'h6_color' => '',
'sidebar_widget_background_color' => '#ffffff', 'sidebar_widget_background_color' => '#ffffff',
'sidebar_widget_text_color' => '', 'sidebar_widget_text_color' => '',
'sidebar_widget_link_color' => '', 'sidebar_widget_link_color' => '',
'sidebar_widget_link_hover_color' => '', 'sidebar_widget_link_hover_color' => '',
'sidebar_widget_title_color' => '', 'sidebar_widget_title_color' => '',
'footer_widget_background_color' => '#ffffff', 'footer_widget_background_color' => '#ffffff',
'footer_widget_text_color' => '', 'footer_widget_text_color' => '',
'footer_widget_link_color' => '', 'footer_widget_link_color' => '',
'footer_widget_link_hover_color' => '', 'footer_widget_link_hover_color' => '',
'footer_widget_title_color' => '#000000', 'footer_widget_title_color' => '#000000',
'footer_background_color' => '#55555e', 'footer_background_color' => '#55555e',
'footer_text_color' => '#ffffff', 'footer_text_color' => '#ffffff',
'footer_link_color' => '#ffffff', 'footer_link_color' => '#ffffff',
'footer_link_hover_color' => '#d3d3d3', 'footer_link_hover_color' => '#d3d3d3',
'form_background_color' => '#fafafa', 'form_background_color' => '#fafafa',
'form_text_color' => '#666666', 'form_text_color' => '#666666',
'form_background_color_focus' => '#ffffff', 'form_background_color_focus' => '#ffffff',
'form_text_color_focus' => '#666666', 'form_text_color_focus' => '#666666',
'form_border_color' => '#cccccc', 'form_border_color' => '#cccccc',
'form_border_color_focus' => '#bfbfbf', 'form_border_color_focus' => '#bfbfbf',
'form_button_background_color' => '#55555e', 'form_button_background_color' => '#55555e',
'form_button_background_color_hover' => '#3f4047', 'form_button_background_color_hover' => '#3f4047',
'form_button_text_color' => '#ffffff', 'form_button_text_color' => '#ffffff',
'form_button_text_color_hover' => '#ffffff', 'form_button_text_color_hover' => '#ffffff',
'back_to_top_background_color' => 'rgba( 0,0,0,0.4 )', 'back_to_top_background_color' => 'rgba( 0,0,0,0.4 )',
'back_to_top_background_color_hover' => 'rgba( 0,0,0,0.6 )', 'back_to_top_background_color_hover' => 'rgba( 0,0,0,0.6 )',
'back_to_top_text_color' => '#ffffff', 'back_to_top_text_color' => '#ffffff',
'back_to_top_text_color_hover' => '#ffffff', 'back_to_top_text_color_hover' => '#ffffff',
) )
); );
} }
} }
if ( ! function_exists( 'generate_get_default_fonts' ) ) { if ( ! function_exists( 'generate_get_default_fonts' ) ) {
/** /**
* Set default options. * Set default options.
* *
* @since 0.1 * @since 0.1
* *
* @param bool $filter Whether to return the filtered values or original values. * @param bool $filter Whether to return the filtered values or original values.
* @return array Option defaults. * @return array Option defaults.
*/ */
function generate_get_default_fonts( $filter = true ) { function generate_get_default_fonts( $filter = true ) {
$defaults = array( $defaults = array(
'font_body' => 'System Stack', 'font_body' => 'System Stack',
'font_body_category' => '', 'font_body_category' => '',
'font_body_variants' => '', 'font_body_variants' => '',
'body_font_weight' => 'normal', 'body_font_weight' => 'normal',
'body_font_transform' => 'none', 'body_font_transform' => 'none',
'body_font_size' => '17', 'body_font_size' => '17',
'body_line_height' => '1.5', // no unit. 'body_line_height' => '1.5', // no unit.
'paragraph_margin' => '1.5', // em. 'paragraph_margin' => '1.5', // em.
'font_top_bar' => 'inherit', 'font_top_bar' => 'inherit',
'font_top_bar_category' => '', 'font_top_bar_category' => '',
'font_top_bar_variants' => '', 'font_top_bar_variants' => '',
'top_bar_font_weight' => 'normal', 'top_bar_font_weight' => 'normal',
'top_bar_font_transform' => 'none', 'top_bar_font_transform' => 'none',
'top_bar_font_size' => '13', 'top_bar_font_size' => '13',
'font_site_title' => 'inherit', 'font_site_title' => 'inherit',
'font_site_title_category' => '', 'font_site_title_category' => '',
'font_site_title_variants' => '', 'font_site_title_variants' => '',
'site_title_font_weight' => 'bold', 'site_title_font_weight' => 'bold',
'site_title_font_transform' => 'none', 'site_title_font_transform' => 'none',
'site_title_font_size' => '25', 'site_title_font_size' => '25',
'mobile_site_title_font_size' => '', 'mobile_site_title_font_size' => '',
'font_site_tagline' => 'inherit', 'font_site_tagline' => 'inherit',
'font_site_tagline_category' => '', 'font_site_tagline_category' => '',
'font_site_tagline_variants' => '', 'font_site_tagline_variants' => '',
'site_tagline_font_weight' => 'normal', 'site_tagline_font_weight' => 'normal',
'site_tagline_font_transform' => 'none', 'site_tagline_font_transform' => 'none',
'site_tagline_font_size' => '15', 'site_tagline_font_size' => '15',
'font_navigation' => 'inherit', 'font_navigation' => 'inherit',
'font_navigation_category' => '', 'font_navigation_category' => '',
'font_navigation_variants' => '', 'font_navigation_variants' => '',
'navigation_font_weight' => 'normal', 'navigation_font_weight' => 'normal',
'navigation_font_transform' => 'none', 'navigation_font_transform' => 'none',
'navigation_font_size' => '15', 'navigation_font_size' => '15',
'font_widget_title' => 'inherit', 'font_widget_title' => 'inherit',
'font_widget_title_category' => '', 'font_widget_title_category' => '',
'font_widget_title_variants' => '', 'font_widget_title_variants' => '',
'widget_title_font_weight' => 'normal', 'widget_title_font_weight' => 'normal',
'widget_title_font_transform' => 'none', 'widget_title_font_transform' => 'none',
'widget_title_font_size' => '20', 'widget_title_font_size' => '20',
'widget_title_separator' => '30', 'widget_title_separator' => '30',
'widget_content_font_size' => '17', 'widget_content_font_size' => '17',
'font_buttons' => 'inherit', 'font_buttons' => 'inherit',
'font_buttons_category' => '', 'font_buttons_category' => '',
'font_buttons_variants' => '', 'font_buttons_variants' => '',
'buttons_font_weight' => 'normal', 'buttons_font_weight' => 'normal',
'buttons_font_transform' => 'none', 'buttons_font_transform' => 'none',
'buttons_font_size' => '', 'buttons_font_size' => '',
'font_heading_1' => 'inherit', 'font_heading_1' => 'inherit',
'font_heading_1_category' => '', 'font_heading_1_category' => '',
'font_heading_1_variants' => '', 'font_heading_1_variants' => '',
'heading_1_weight' => 'normal', 'heading_1_weight' => 'normal',
'heading_1_transform' => 'none', 'heading_1_transform' => 'none',
'heading_1_font_size' => '42', 'heading_1_font_size' => '42',
'heading_1_line_height' => '1.2', // em. 'heading_1_line_height' => '1.2', // em.
'heading_1_margin_bottom' => '20', 'heading_1_margin_bottom' => '20',
'mobile_heading_1_font_size' => '31', 'mobile_heading_1_font_size' => '31',
'font_heading_2' => 'inherit', 'font_heading_2' => 'inherit',
'font_heading_2_category' => '', 'font_heading_2_category' => '',
'font_heading_2_variants' => '', 'font_heading_2_variants' => '',
'heading_2_weight' => 'normal', 'heading_2_weight' => 'normal',
'heading_2_transform' => 'none', 'heading_2_transform' => 'none',
'heading_2_font_size' => '35', 'heading_2_font_size' => '35',
'heading_2_line_height' => '1.2', // em. 'heading_2_line_height' => '1.2', // em.
'heading_2_margin_bottom' => '20', 'heading_2_margin_bottom' => '20',
'mobile_heading_2_font_size' => '27', 'mobile_heading_2_font_size' => '27',
'font_heading_3' => 'inherit', 'font_heading_3' => 'inherit',
'font_heading_3_category' => '', 'font_heading_3_category' => '',
'font_heading_3_variants' => '', 'font_heading_3_variants' => '',
'heading_3_weight' => 'normal', 'heading_3_weight' => 'normal',
'heading_3_transform' => 'none', 'heading_3_transform' => 'none',
'heading_3_font_size' => '29', 'heading_3_font_size' => '29',
'heading_3_line_height' => '1.2', // em. 'heading_3_line_height' => '1.2', // em.
'heading_3_margin_bottom' => '20', 'heading_3_margin_bottom' => '20',
'mobile_heading_3_font_size' => '24', 'mobile_heading_3_font_size' => '24',
'font_heading_4' => 'inherit', 'font_heading_4' => 'inherit',
'font_heading_4_category' => '', 'font_heading_4_category' => '',
'font_heading_4_variants' => '', 'font_heading_4_variants' => '',
'heading_4_weight' => 'normal', 'heading_4_weight' => 'normal',
'heading_4_transform' => 'none', 'heading_4_transform' => 'none',
'heading_4_font_size' => '24', 'heading_4_font_size' => '24',
'heading_4_line_height' => '', // em. 'heading_4_line_height' => '', // em.
'mobile_heading_4_font_size' => '22', 'mobile_heading_4_font_size' => '22',
'font_heading_5' => 'inherit', 'font_heading_5' => 'inherit',
'font_heading_5_category' => '', 'font_heading_5_category' => '',
'font_heading_5_variants' => '', 'font_heading_5_variants' => '',
'heading_5_weight' => 'normal', 'heading_5_weight' => 'normal',
'heading_5_transform' => 'none', 'heading_5_transform' => 'none',
'heading_5_font_size' => '20', 'heading_5_font_size' => '20',
'heading_5_line_height' => '', // em. 'heading_5_line_height' => '', // em.
'mobile_heading_5_font_size' => '19', 'mobile_heading_5_font_size' => '19',
'font_heading_6' => 'inherit', 'font_heading_6' => 'inherit',
'font_heading_6_category' => '', 'font_heading_6_category' => '',
'font_heading_6_variants' => '', 'font_heading_6_variants' => '',
'heading_6_weight' => 'normal', 'heading_6_weight' => 'normal',
'heading_6_transform' => 'none', 'heading_6_transform' => 'none',
'heading_6_font_size' => '', 'heading_6_font_size' => '',
'heading_6_line_height' => '', // em. 'heading_6_line_height' => '', // em.
'font_footer' => 'inherit', 'font_footer' => 'inherit',
'font_footer_category' => '', 'font_footer_category' => '',
'font_footer_variants' => '', 'font_footer_variants' => '',
'footer_weight' => 'normal', 'footer_weight' => 'normal',
'footer_transform' => 'none', 'footer_transform' => 'none',
'footer_font_size' => '15', 'footer_font_size' => '15',
); );
if ( $filter ) { if ( $filter ) {
return apply_filters( 'generate_font_option_defaults', $defaults ); return apply_filters( 'generate_font_option_defaults', $defaults );
} }
return $defaults; return $defaults;
} }
} }
if ( ! function_exists( 'generate_spacing_get_defaults' ) ) { if ( ! function_exists( 'generate_spacing_get_defaults' ) ) {
/** /**
* Set the default options. * Set the default options.
* *
* @since 0.1 * @since 0.1
* *
* @param bool $filter Whether to return the filtered values or original values. * @param bool $filter Whether to return the filtered values or original values.
* @return array Option defaults. * @return array Option defaults.
*/ */
function generate_spacing_get_defaults( $filter = true ) { function generate_spacing_get_defaults( $filter = true ) {
$defaults = array( $defaults = array(
'top_bar_top' => '10', 'top_bar_top' => '10',
'top_bar_right' => '40', 'top_bar_right' => '40',
'top_bar_bottom' => '10', 'top_bar_bottom' => '10',
'top_bar_left' => '40', 'top_bar_left' => '40',
'mobile_top_bar_top' => '', 'mobile_top_bar_top' => '',
'mobile_top_bar_right' => '30', 'mobile_top_bar_right' => '30',
'mobile_top_bar_bottom' => '', 'mobile_top_bar_bottom' => '',
'mobile_top_bar_left' => '30', 'mobile_top_bar_left' => '30',
'header_top' => '20', 'header_top' => '20',
'header_right' => '40', 'header_right' => '40',
'header_bottom' => '20', 'header_bottom' => '20',
'header_left' => '40', 'header_left' => '40',
'menu_item' => '20', 'menu_item' => '20',
'menu_item_height' => '60', 'menu_item_height' => '60',
'sub_menu_item_height' => '10', 'sub_menu_item_height' => '10',
'sub_menu_width' => '200', 'sub_menu_width' => '200',
'content_top' => '40', 'content_top' => '40',
'content_right' => '40', 'content_right' => '40',
'content_bottom' => '40', 'content_bottom' => '40',
'content_left' => '40', 'content_left' => '40',
'mobile_content_top' => '30', 'mobile_content_top' => '30',
'mobile_content_right' => '30', 'mobile_content_right' => '30',
'mobile_content_bottom' => '30', 'mobile_content_bottom' => '30',
'mobile_content_left' => '30', 'mobile_content_left' => '30',
'separator' => '20', 'separator' => '20',
'mobile_separator' => '', 'mobile_separator' => '',
'left_sidebar_width' => '30', 'left_sidebar_width' => '30',
'right_sidebar_width' => '30', 'right_sidebar_width' => '30',
'widget_top' => '40', 'widget_top' => '40',
'widget_right' => '40', 'widget_right' => '40',
'widget_bottom' => '40', 'widget_bottom' => '40',
'widget_left' => '40', 'widget_left' => '40',
'footer_widget_container_top' => '40', 'footer_widget_container_top' => '40',
'footer_widget_container_right' => '40', 'footer_widget_container_right' => '40',
'footer_widget_container_bottom' => '40', 'footer_widget_container_bottom' => '40',
'footer_widget_container_left' => '40', 'footer_widget_container_left' => '40',
'footer_widget_separator' => '40', 'footer_widget_separator' => '40',
'footer_top' => '20', 'footer_top' => '20',
'footer_right' => '40', 'footer_right' => '40',
'footer_bottom' => '20', 'footer_bottom' => '20',
'footer_left' => '40', 'footer_left' => '40',
'mobile_footer_top' => '', 'mobile_footer_top' => '',
'mobile_footer_right' => '30', 'mobile_footer_right' => '30',
'mobile_footer_bottom' => '', 'mobile_footer_bottom' => '',
'mobile_footer_left' => '30', 'mobile_footer_left' => '30',
); );
if ( $filter ) { if ( $filter ) {
return apply_filters( 'generate_spacing_option_defaults', $defaults ); return apply_filters( 'generate_spacing_option_defaults', $defaults );
} }
return $defaults; return $defaults;
} }
} }
if ( ! function_exists( 'generate_typography_default_fonts' ) ) { if ( ! function_exists( 'generate_typography_default_fonts' ) ) {
/** /**
* Set the default system fonts. * Set the default system fonts.
* *
* @since 1.3.40 * @since 1.3.40
*/ */
function generate_typography_default_fonts() { function generate_typography_default_fonts() {
$fonts = array( $fonts = array(
'inherit', 'inherit',
'System Stack', 'System Stack',
'Arial, Helvetica, sans-serif', 'Arial, Helvetica, sans-serif',
'Century Gothic', 'Century Gothic',
'Comic Sans MS', 'Comic Sans MS',
'Courier New', 'Courier New',
'Georgia, Times New Roman, Times, serif', 'Georgia, Times New Roman, Times, serif',
'Helvetica', 'Helvetica',
'Impact', 'Impact',
'Lucida Console', 'Lucida Console',
'Lucida Sans Unicode', 'Lucida Sans Unicode',
'Palatino Linotype', 'Palatino Linotype',
'Segoe UI, Helvetica Neue, Helvetica, sans-serif', 'Segoe UI, Helvetica Neue, Helvetica, sans-serif',
'Tahoma, Geneva, sans-serif', 'Tahoma, Geneva, sans-serif',
'Trebuchet MS, Helvetica, sans-serif', 'Trebuchet MS, Helvetica, sans-serif',
'Verdana, Geneva, sans-serif', 'Verdana, Geneva, sans-serif',
); );
return apply_filters( 'generate_typography_default_fonts', $fonts ); return apply_filters( 'generate_typography_default_fonts', $fonts );
} }
} }

View File

@ -1,436 +1,436 @@
<?php <?php
/** /**
* General functions. * General functions.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
if ( ! function_exists( 'generate_scripts' ) ) { if ( ! function_exists( 'generate_scripts' ) ) {
add_action( 'wp_enqueue_scripts', 'generate_scripts' ); add_action( 'wp_enqueue_scripts', 'generate_scripts' );
/** /**
* Enqueue scripts and styles * Enqueue scripts and styles
*/ */
function generate_scripts() { function generate_scripts() {
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
$dir_uri = get_template_directory_uri(); $dir_uri = get_template_directory_uri();
if ( generate_is_using_flexbox() ) { if ( generate_is_using_flexbox() ) {
if ( is_singular() && comments_open() ) { if ( is_singular() && comments_open() ) {
wp_enqueue_style( 'generate-comments', $dir_uri . "/assets/css/components/comments{$suffix}.css", array(), GENERATE_VERSION, 'all' ); wp_enqueue_style( 'generate-comments', $dir_uri . "/assets/css/components/comments{$suffix}.css", array(), GENERATE_VERSION, 'all' );
} }
if ( if (
is_active_sidebar( 'top-bar' ) || is_active_sidebar( 'top-bar' ) ||
is_active_sidebar( 'footer-bar' ) || is_active_sidebar( 'footer-bar' ) ||
is_active_sidebar( 'footer-1' ) || is_active_sidebar( 'footer-1' ) ||
is_active_sidebar( 'footer-2' ) || is_active_sidebar( 'footer-2' ) ||
is_active_sidebar( 'footer-3' ) || is_active_sidebar( 'footer-3' ) ||
is_active_sidebar( 'footer-4' ) || is_active_sidebar( 'footer-4' ) ||
is_active_sidebar( 'footer-5' ) is_active_sidebar( 'footer-5' )
) { ) {
wp_enqueue_style( 'generate-widget-areas', $dir_uri . "/assets/css/components/widget-areas{$suffix}.css", array(), GENERATE_VERSION, 'all' ); wp_enqueue_style( 'generate-widget-areas', $dir_uri . "/assets/css/components/widget-areas{$suffix}.css", array(), GENERATE_VERSION, 'all' );
} }
wp_enqueue_style( 'generate-style', $dir_uri . "/assets/css/main{$suffix}.css", array(), GENERATE_VERSION, 'all' ); wp_enqueue_style( 'generate-style', $dir_uri . "/assets/css/main{$suffix}.css", array(), GENERATE_VERSION, 'all' );
} else { } else {
if ( generate_get_option( 'combine_css' ) && $suffix ) { if ( generate_get_option( 'combine_css' ) && $suffix ) {
wp_enqueue_style( 'generate-style', $dir_uri . "/assets/css/all{$suffix}.css", array(), GENERATE_VERSION, 'all' ); wp_enqueue_style( 'generate-style', $dir_uri . "/assets/css/all{$suffix}.css", array(), GENERATE_VERSION, 'all' );
} else { } else {
wp_enqueue_style( 'generate-style-grid', $dir_uri . "/assets/css/unsemantic-grid{$suffix}.css", false, GENERATE_VERSION, 'all' ); wp_enqueue_style( 'generate-style-grid', $dir_uri . "/assets/css/unsemantic-grid{$suffix}.css", false, GENERATE_VERSION, 'all' );
wp_enqueue_style( 'generate-style', $dir_uri . "/assets/css/style{$suffix}.css", array(), GENERATE_VERSION, 'all' ); wp_enqueue_style( 'generate-style', $dir_uri . "/assets/css/style{$suffix}.css", array(), GENERATE_VERSION, 'all' );
wp_enqueue_style( 'generate-mobile-style', $dir_uri . "/assets/css/mobile{$suffix}.css", array(), GENERATE_VERSION, 'all' ); wp_enqueue_style( 'generate-mobile-style', $dir_uri . "/assets/css/mobile{$suffix}.css", array(), GENERATE_VERSION, 'all' );
} }
} }
if ( 'font' === generate_get_option( 'icons' ) ) { if ( 'font' === generate_get_option( 'icons' ) ) {
wp_enqueue_style( 'generate-font-icons', $dir_uri . "/assets/css/components/font-icons{$suffix}.css", array(), GENERATE_VERSION, 'all' ); wp_enqueue_style( 'generate-font-icons', $dir_uri . "/assets/css/components/font-icons{$suffix}.css", array(), GENERATE_VERSION, 'all' );
} }
if ( ! apply_filters( 'generate_fontawesome_essentials', false ) ) { if ( ! apply_filters( 'generate_fontawesome_essentials', false ) ) {
wp_enqueue_style( 'font-awesome', $dir_uri . "/assets/css/components/font-awesome{$suffix}.css", false, '4.7', 'all' ); wp_enqueue_style( 'font-awesome', $dir_uri . "/assets/css/components/font-awesome{$suffix}.css", false, '4.7', 'all' );
} }
if ( is_rtl() ) { if ( is_rtl() ) {
if ( generate_is_using_flexbox() ) { if ( generate_is_using_flexbox() ) {
wp_enqueue_style( 'generate-rtl', $dir_uri . "/assets/css/main-rtl{$suffix}.css", array(), GENERATE_VERSION, 'all' ); wp_enqueue_style( 'generate-rtl', $dir_uri . "/assets/css/main-rtl{$suffix}.css", array(), GENERATE_VERSION, 'all' );
} else { } else {
wp_enqueue_style( 'generate-rtl', $dir_uri . "/assets/css/style-rtl{$suffix}.css", array(), GENERATE_VERSION, 'all' ); wp_enqueue_style( 'generate-rtl', $dir_uri . "/assets/css/style-rtl{$suffix}.css", array(), GENERATE_VERSION, 'all' );
} }
} }
if ( is_child_theme() && apply_filters( 'generate_load_child_theme_stylesheet', true ) ) { if ( is_child_theme() && apply_filters( 'generate_load_child_theme_stylesheet', true ) ) {
wp_enqueue_style( 'generate-child', get_stylesheet_uri(), array( 'generate-style' ), filemtime( get_stylesheet_directory() . '/style.css' ), 'all' ); wp_enqueue_style( 'generate-child', get_stylesheet_uri(), array( 'generate-style' ), filemtime( get_stylesheet_directory() . '/style.css' ), 'all' );
} }
if ( function_exists( 'wp_script_add_data' ) ) { if ( function_exists( 'wp_script_add_data' ) ) {
wp_enqueue_script( 'generate-classlist', $dir_uri . "/assets/js/classList{$suffix}.js", array(), GENERATE_VERSION, true ); wp_enqueue_script( 'generate-classlist', $dir_uri . "/assets/js/classList{$suffix}.js", array(), GENERATE_VERSION, true );
wp_script_add_data( 'generate-classlist', 'conditional', 'lte IE 11' ); wp_script_add_data( 'generate-classlist', 'conditional', 'lte IE 11' );
} }
if ( apply_filters( 'generate_combine_js', true ) && $suffix ) { if ( apply_filters( 'generate_combine_js', true ) && $suffix ) {
wp_enqueue_script( 'generate-main', $dir_uri . "/assets/js/main{$suffix}.js", array(), GENERATE_VERSION, true ); wp_enqueue_script( 'generate-main', $dir_uri . "/assets/js/main{$suffix}.js", array(), GENERATE_VERSION, true );
$script_handle = 'generate-main'; $script_handle = 'generate-main';
} else { } else {
wp_enqueue_script( 'generate-menu', $dir_uri . "/assets/js/menu{$suffix}.js", array(), GENERATE_VERSION, true ); wp_enqueue_script( 'generate-menu', $dir_uri . "/assets/js/menu{$suffix}.js", array(), GENERATE_VERSION, true );
wp_enqueue_script( 'generate-a11y', $dir_uri . "/assets/js/a11y{$suffix}.js", array(), GENERATE_VERSION, true ); wp_enqueue_script( 'generate-a11y', $dir_uri . "/assets/js/a11y{$suffix}.js", array(), GENERATE_VERSION, true );
$script_handle = 'generate-menu'; $script_handle = 'generate-menu';
} }
wp_localize_script( wp_localize_script(
$script_handle, $script_handle,
'generatepressMenu', 'generatepressMenu',
apply_filters( apply_filters(
'generate_localize_js_args', 'generate_localize_js_args',
array( array(
'toggleOpenedSubMenus' => true, 'toggleOpenedSubMenus' => true,
'openSubMenuLabel' => esc_attr__( 'Open Sub-Menu', 'generatepress' ), 'openSubMenuLabel' => esc_attr__( 'Open Sub-Menu', 'generatepress' ),
'closeSubMenuLabel' => esc_attr__( 'Close Sub-Menu', 'generatepress' ), 'closeSubMenuLabel' => esc_attr__( 'Close Sub-Menu', 'generatepress' ),
) )
) )
); );
if ( 'click' === generate_get_option( 'nav_dropdown_type' ) || 'click-arrow' === generate_get_option( 'nav_dropdown_type' ) ) { if ( 'click' === generate_get_option( 'nav_dropdown_type' ) || 'click-arrow' === generate_get_option( 'nav_dropdown_type' ) ) {
wp_enqueue_script( 'generate-dropdown-click', $dir_uri . "/assets/js/dropdown-click{$suffix}.js", array(), GENERATE_VERSION, true ); wp_enqueue_script( 'generate-dropdown-click', $dir_uri . "/assets/js/dropdown-click{$suffix}.js", array(), GENERATE_VERSION, true );
} }
if ( 'enable' === generate_get_option( 'nav_search' ) ) { if ( 'enable' === generate_get_option( 'nav_search' ) ) {
wp_enqueue_script( 'generate-navigation-search', $dir_uri . "/assets/js/navigation-search{$suffix}.js", array(), GENERATE_VERSION, true ); wp_enqueue_script( 'generate-navigation-search', $dir_uri . "/assets/js/navigation-search{$suffix}.js", array(), GENERATE_VERSION, true );
wp_localize_script( wp_localize_script(
'generate-navigation-search', 'generate-navigation-search',
'generatepressNavSearch', 'generatepressNavSearch',
array( array(
'open' => esc_attr__( 'Open Search Bar', 'generatepress' ), 'open' => esc_attr__( 'Open Search Bar', 'generatepress' ),
'close' => esc_attr__( 'Close Search Bar', 'generatepress' ), 'close' => esc_attr__( 'Close Search Bar', 'generatepress' ),
) )
); );
} }
if ( 'enable' === generate_get_option( 'back_to_top' ) ) { if ( 'enable' === generate_get_option( 'back_to_top' ) ) {
wp_enqueue_script( 'generate-back-to-top', $dir_uri . "/assets/js/back-to-top{$suffix}.js", array(), GENERATE_VERSION, true ); wp_enqueue_script( 'generate-back-to-top', $dir_uri . "/assets/js/back-to-top{$suffix}.js", array(), GENERATE_VERSION, true );
} }
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' ); wp_enqueue_script( 'comment-reply' );
} }
} }
} }
if ( ! function_exists( 'generate_widgets_init' ) ) { if ( ! function_exists( 'generate_widgets_init' ) ) {
add_action( 'widgets_init', 'generate_widgets_init' ); add_action( 'widgets_init', 'generate_widgets_init' );
/** /**
* Register widgetized area and update sidebar with default widgets * Register widgetized area and update sidebar with default widgets
*/ */
function generate_widgets_init() { function generate_widgets_init() {
$widgets = array( $widgets = array(
'sidebar-1' => __( 'Right Sidebar', 'generatepress' ), 'sidebar-1' => __( 'Right Sidebar', 'generatepress' ),
'sidebar-2' => __( 'Left Sidebar', 'generatepress' ), 'sidebar-2' => __( 'Left Sidebar', 'generatepress' ),
'header' => __( 'Header', 'generatepress' ), 'header' => __( 'Header', 'generatepress' ),
'footer-1' => __( 'Footer Widget 1', 'generatepress' ), 'footer-1' => __( 'Footer Widget 1', 'generatepress' ),
'footer-2' => __( 'Footer Widget 2', 'generatepress' ), 'footer-2' => __( 'Footer Widget 2', 'generatepress' ),
'footer-3' => __( 'Footer Widget 3', 'generatepress' ), 'footer-3' => __( 'Footer Widget 3', 'generatepress' ),
'footer-4' => __( 'Footer Widget 4', 'generatepress' ), 'footer-4' => __( 'Footer Widget 4', 'generatepress' ),
'footer-5' => __( 'Footer Widget 5', 'generatepress' ), 'footer-5' => __( 'Footer Widget 5', 'generatepress' ),
'footer-bar' => __( 'Footer Bar', 'generatepress' ), 'footer-bar' => __( 'Footer Bar', 'generatepress' ),
'top-bar' => __( 'Top Bar', 'generatepress' ), 'top-bar' => __( 'Top Bar', 'generatepress' ),
); );
foreach ( $widgets as $id => $name ) { foreach ( $widgets as $id => $name ) {
register_sidebar( register_sidebar(
array( array(
'name' => $name, 'name' => $name,
'id' => $id, 'id' => $id,
'before_widget' => '<aside id="%1$s" class="widget inner-padding %2$s">', 'before_widget' => '<aside id="%1$s" class="widget inner-padding %2$s">',
'after_widget' => '</aside>', 'after_widget' => '</aside>',
'before_title' => apply_filters( 'generate_start_widget_title', '<h2 class="widget-title">' ), 'before_title' => apply_filters( 'generate_start_widget_title', '<h2 class="widget-title">' ),
'after_title' => apply_filters( 'generate_end_widget_title', '</h2>' ), 'after_title' => apply_filters( 'generate_end_widget_title', '</h2>' ),
) )
); );
} }
} }
} }
if ( ! function_exists( 'generate_smart_content_width' ) ) { if ( ! function_exists( 'generate_smart_content_width' ) ) {
add_action( 'wp', 'generate_smart_content_width' ); add_action( 'wp', 'generate_smart_content_width' );
/** /**
* Set the $content_width depending on layout of current page * Set the $content_width depending on layout of current page
* Hook into "wp" so we have the correct layout setting from generate_get_layout() * Hook into "wp" so we have the correct layout setting from generate_get_layout()
* Hooking into "after_setup_theme" doesn't get the correct layout setting * Hooking into "after_setup_theme" doesn't get the correct layout setting
*/ */
function generate_smart_content_width() { function generate_smart_content_width() {
global $content_width; global $content_width;
$container_width = generate_get_option( 'container_width' ); $container_width = generate_get_option( 'container_width' );
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' ); $right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' ); $left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
$layout = generate_get_layout(); $layout = generate_get_layout();
if ( 'left-sidebar' === $layout ) { if ( 'left-sidebar' === $layout ) {
$content_width = $container_width * ( ( 100 - $left_sidebar_width ) / 100 ); $content_width = $container_width * ( ( 100 - $left_sidebar_width ) / 100 );
} elseif ( 'right-sidebar' === $layout ) { } elseif ( 'right-sidebar' === $layout ) {
$content_width = $container_width * ( ( 100 - $right_sidebar_width ) / 100 ); $content_width = $container_width * ( ( 100 - $right_sidebar_width ) / 100 );
} elseif ( 'no-sidebar' === $layout ) { } elseif ( 'no-sidebar' === $layout ) {
$content_width = $container_width; $content_width = $container_width;
} else { } else {
$content_width = $container_width * ( ( 100 - ( $left_sidebar_width + $right_sidebar_width ) ) / 100 ); $content_width = $container_width * ( ( 100 - ( $left_sidebar_width + $right_sidebar_width ) ) / 100 );
} }
} }
} }
if ( ! function_exists( 'generate_page_menu_args' ) ) { if ( ! function_exists( 'generate_page_menu_args' ) ) {
add_filter( 'wp_page_menu_args', 'generate_page_menu_args' ); add_filter( 'wp_page_menu_args', 'generate_page_menu_args' );
/** /**
* Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
* *
* @since 0.1 * @since 0.1
* *
* @param array $args The existing menu args. * @param array $args The existing menu args.
* @return array Menu args. * @return array Menu args.
*/ */
function generate_page_menu_args( $args ) { function generate_page_menu_args( $args ) {
$args['show_home'] = true; $args['show_home'] = true;
return $args; return $args;
} }
} }
if ( ! function_exists( 'generate_disable_title' ) ) { if ( ! function_exists( 'generate_disable_title' ) ) {
add_filter( 'generate_show_title', 'generate_disable_title' ); add_filter( 'generate_show_title', 'generate_disable_title' );
/** /**
* Remove our title if set. * Remove our title if set.
* *
* @since 1.3.18 * @since 1.3.18
* *
* @param bool $title Whether the title is displayed or not. * @param bool $title Whether the title is displayed or not.
* @return bool Whether to display the content title. * @return bool Whether to display the content title.
*/ */
function generate_disable_title( $title ) { function generate_disable_title( $title ) {
if ( is_singular() ) { if ( is_singular() ) {
$disable_title = get_post_meta( get_the_ID(), '_generate-disable-headline', true ); $disable_title = get_post_meta( get_the_ID(), '_generate-disable-headline', true );
if ( $disable_title ) { if ( $disable_title ) {
$title = false; $title = false;
} }
} }
return $title; return $title;
} }
} }
if ( ! function_exists( 'generate_resource_hints' ) ) { if ( ! function_exists( 'generate_resource_hints' ) ) {
add_filter( 'wp_resource_hints', 'generate_resource_hints', 10, 2 ); add_filter( 'wp_resource_hints', 'generate_resource_hints', 10, 2 );
/** /**
* Add resource hints to our Google fonts call. * Add resource hints to our Google fonts call.
* *
* @since 1.3.42 * @since 1.3.42
* *
* @param array $urls URLs to print for resource hints. * @param array $urls URLs to print for resource hints.
* @param string $relation_type The relation type the URLs are printed. * @param string $relation_type The relation type the URLs are printed.
* @return array $urls URLs to print for resource hints. * @return array $urls URLs to print for resource hints.
*/ */
function generate_resource_hints( $urls, $relation_type ) { function generate_resource_hints( $urls, $relation_type ) {
if ( wp_style_is( 'generate-fonts', 'queue' ) && 'preconnect' === $relation_type ) { if ( wp_style_is( 'generate-fonts', 'queue' ) && 'preconnect' === $relation_type ) {
if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '>=' ) ) { if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '>=' ) ) {
$urls[] = array( $urls[] = array(
'href' => 'https://fonts.gstatic.com', 'href' => 'https://fonts.gstatic.com',
'crossorigin', 'crossorigin',
); );
} else { } else {
$urls[] = 'https://fonts.gstatic.com'; $urls[] = 'https://fonts.gstatic.com';
} }
} }
return $urls; return $urls;
} }
} }
if ( ! function_exists( 'generate_remove_caption_padding' ) ) { if ( ! function_exists( 'generate_remove_caption_padding' ) ) {
add_filter( 'img_caption_shortcode_width', 'generate_remove_caption_padding' ); add_filter( 'img_caption_shortcode_width', 'generate_remove_caption_padding' );
/** /**
* Remove WordPress's default padding on images with captions * Remove WordPress's default padding on images with captions
* *
* @param int $width Default WP .wp-caption width (image width + 10px). * @param int $width Default WP .wp-caption width (image width + 10px).
* @return int Updated width to remove 10px padding. * @return int Updated width to remove 10px padding.
*/ */
function generate_remove_caption_padding( $width ) { function generate_remove_caption_padding( $width ) {
return $width - 10; return $width - 10;
} }
} }
if ( ! function_exists( 'generate_enhanced_image_navigation' ) ) { if ( ! function_exists( 'generate_enhanced_image_navigation' ) ) {
add_filter( 'attachment_link', 'generate_enhanced_image_navigation', 10, 2 ); add_filter( 'attachment_link', 'generate_enhanced_image_navigation', 10, 2 );
/** /**
* Filter in a link to a content ID attribute for the next/previous image links on image attachment pages. * Filter in a link to a content ID attribute for the next/previous image links on image attachment pages.
* *
* @param string $url The input URL. * @param string $url The input URL.
* @param int $id The ID of the post. * @param int $id The ID of the post.
*/ */
function generate_enhanced_image_navigation( $url, $id ) { function generate_enhanced_image_navigation( $url, $id ) {
if ( ! is_attachment() && ! wp_attachment_is_image( $id ) ) { if ( ! is_attachment() && ! wp_attachment_is_image( $id ) ) {
return $url; return $url;
} }
$image = get_post( $id ); $image = get_post( $id );
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose. // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose.
if ( ! empty( $image->post_parent ) && $image->post_parent != $id ) { if ( ! empty( $image->post_parent ) && $image->post_parent != $id ) {
$url .= '#main'; $url .= '#main';
} }
return $url; return $url;
} }
} }
if ( ! function_exists( 'generate_categorized_blog' ) ) { if ( ! function_exists( 'generate_categorized_blog' ) ) {
/** /**
* Determine whether blog/site has more than one category. * Determine whether blog/site has more than one category.
* *
* @since 1.2.5 * @since 1.2.5
* *
* @return bool True of there is more than one category, false otherwise. * @return bool True of there is more than one category, false otherwise.
*/ */
function generate_categorized_blog() { function generate_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'generate_categories' ) ) ) { // phpcs:ignore if ( false === ( $all_the_cool_cats = get_transient( 'generate_categories' ) ) ) { // phpcs:ignore
// Create an array of all the categories that are attached to posts. // Create an array of all the categories that are attached to posts.
$all_the_cool_cats = get_categories( $all_the_cool_cats = get_categories(
array( array(
'fields' => 'ids', 'fields' => 'ids',
'hide_empty' => 1, 'hide_empty' => 1,
// We only need to know if there is more than one category. // We only need to know if there is more than one category.
'number' => 2, 'number' => 2,
) )
); );
// Count the number of categories that are attached to the posts. // Count the number of categories that are attached to the posts.
$all_the_cool_cats = count( $all_the_cool_cats ); $all_the_cool_cats = count( $all_the_cool_cats );
set_transient( 'generate_categories', $all_the_cool_cats ); set_transient( 'generate_categories', $all_the_cool_cats );
} }
if ( $all_the_cool_cats > 1 ) { if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so twentyfifteen_categorized_blog should return true. // This blog has more than 1 category so twentyfifteen_categorized_blog should return true.
return true; return true;
} else { } else {
// This blog has only 1 category so twentyfifteen_categorized_blog should return false. // This blog has only 1 category so twentyfifteen_categorized_blog should return false.
return false; return false;
} }
} }
} }
if ( ! function_exists( 'generate_category_transient_flusher' ) ) { if ( ! function_exists( 'generate_category_transient_flusher' ) ) {
add_action( 'edit_category', 'generate_category_transient_flusher' ); add_action( 'edit_category', 'generate_category_transient_flusher' );
add_action( 'save_post', 'generate_category_transient_flusher' ); add_action( 'save_post', 'generate_category_transient_flusher' );
/** /**
* Flush out the transients used in {@see generate_categorized_blog()}. * Flush out the transients used in {@see generate_categorized_blog()}.
* *
* @since 1.2.5 * @since 1.2.5
*/ */
function generate_category_transient_flusher() { function generate_category_transient_flusher() {
// Like, beat it. Dig? // Like, beat it. Dig?
delete_transient( 'generate_categories' ); delete_transient( 'generate_categories' );
} }
} }
if ( ! function_exists( 'generate_get_default_color_palettes' ) ) { if ( ! function_exists( 'generate_get_default_color_palettes' ) ) {
/** /**
* Set up our colors for the color picker palettes and filter them so you can change them. * Set up our colors for the color picker palettes and filter them so you can change them.
* *
* @since 1.3.42 * @since 1.3.42
*/ */
function generate_get_default_color_palettes() { function generate_get_default_color_palettes() {
$palettes = array( $palettes = array(
'#000000', '#000000',
'#FFFFFF', '#FFFFFF',
'#F1C40F', '#F1C40F',
'#E74C3C', '#E74C3C',
'#1ABC9C', '#1ABC9C',
'#1e72bd', '#1e72bd',
'#8E44AD', '#8E44AD',
'#00CC77', '#00CC77',
); );
return apply_filters( 'generate_default_color_palettes', $palettes ); return apply_filters( 'generate_default_color_palettes', $palettes );
} }
} }
add_filter( 'generate_fontawesome_essentials', 'generate_set_font_awesome_essentials' ); add_filter( 'generate_fontawesome_essentials', 'generate_set_font_awesome_essentials' );
/** /**
* Check to see if we should include the full Font Awesome library or not. * Check to see if we should include the full Font Awesome library or not.
* *
* @since 2.0 * @since 2.0
* *
* @param bool $essentials The existing value. * @param bool $essentials The existing value.
* @return bool * @return bool
*/ */
function generate_set_font_awesome_essentials( $essentials ) { function generate_set_font_awesome_essentials( $essentials ) {
if ( generate_get_option( 'font_awesome_essentials' ) ) { if ( generate_get_option( 'font_awesome_essentials' ) ) {
return true; return true;
} }
return $essentials; return $essentials;
} }
add_filter( 'generate_dynamic_css_skip_cache', 'generate_skip_dynamic_css_cache' ); add_filter( 'generate_dynamic_css_skip_cache', 'generate_skip_dynamic_css_cache' );
/** /**
* Skips caching of the dynamic CSS if set to false. * Skips caching of the dynamic CSS if set to false.
* *
* @since 2.0 * @since 2.0
* *
* @param bool $cache The existing value. * @param bool $cache The existing value.
* @return bool * @return bool
*/ */
function generate_skip_dynamic_css_cache( $cache ) { function generate_skip_dynamic_css_cache( $cache ) {
if ( ! generate_get_option( 'dynamic_css_cache' ) ) { if ( ! generate_get_option( 'dynamic_css_cache' ) ) {
return true; return true;
} }
return $cache; return $cache;
} }
add_filter( 'wp_headers', 'generate_set_wp_headers' ); add_filter( 'wp_headers', 'generate_set_wp_headers' );
/** /**
* Set any necessary headers. * Set any necessary headers.
* *
* @param array $headers The existing headers. * @param array $headers The existing headers.
* *
* @since 2.3 * @since 2.3
*/ */
function generate_set_wp_headers( $headers ) { function generate_set_wp_headers( $headers ) {
$headers['X-UA-Compatible'] = 'IE=edge'; $headers['X-UA-Compatible'] = 'IE=edge';
return $headers; return $headers;
} }
add_filter( 'generate_after_element_class_attribute', 'generate_set_microdata_markup', 10, 2 ); add_filter( 'generate_after_element_class_attribute', 'generate_set_microdata_markup', 10, 2 );
/** /**
* Adds microdata to elements. * Adds microdata to elements.
* *
* @since 3.0.0 * @since 3.0.0
* @param string $output The existing output after the class attribute. * @param string $output The existing output after the class attribute.
* @param string $context What element we're targeting. * @param string $context What element we're targeting.
*/ */
function generate_set_microdata_markup( $output, $context ) { function generate_set_microdata_markup( $output, $context ) {
if ( 'left_sidebar' === $context || 'right_sidebar' === $context ) { if ( 'left_sidebar' === $context || 'right_sidebar' === $context ) {
$context = 'sidebar'; $context = 'sidebar';
} }
if ( 'footer' === $context ) { if ( 'footer' === $context ) {
return $output; return $output;
} }
if ( 'site-info' === $context ) { if ( 'site-info' === $context ) {
$context = 'footer'; $context = 'footer';
} }
$microdata = generate_get_microdata( $context ); $microdata = generate_get_microdata( $context );
if ( $microdata ) { if ( $microdata ) {
return $microdata; return $microdata;
} }
return $output; return $output;
} }

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,75 +1,75 @@
<?php <?php
/** /**
* The main template file. * The main template file.
* *
* This is the most generic template file in a WordPress theme * This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css). * and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query. * It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists. * E.g., it puts together the home page when no home.php file exists.
* Learn more: http://codex.wordpress.org/Template_Hierarchy * Learn more: http://codex.wordpress.org/Template_Hierarchy
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
get_header(); ?> get_header(); ?>
<div id="primary" <?php generate_do_element_classes( 'content' ); ?>> <div id="primary" <?php generate_do_element_classes( 'content' ); ?>>
<main id="main" <?php generate_do_element_classes( 'main' ); ?>> <main id="main" <?php generate_do_element_classes( 'main' ); ?>>
<?php <?php
/** /**
* generate_before_main_content hook. * generate_before_main_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_before_main_content' ); do_action( 'generate_before_main_content' );
if ( generate_has_default_loop() ) { if ( generate_has_default_loop() ) {
if ( have_posts() ) : if ( have_posts() ) :
while ( have_posts() ) : while ( have_posts() ) :
the_post(); the_post();
generate_do_template_part( 'index' ); generate_do_template_part( 'index' );
endwhile; endwhile;
/** /**
* generate_after_loop hook. * generate_after_loop hook.
* *
* @since 2.3 * @since 2.3
*/ */
do_action( 'generate_after_loop', 'index' ); do_action( 'generate_after_loop', 'index' );
else : else :
generate_do_template_part( 'none' ); generate_do_template_part( 'none' );
endif; endif;
} }
/** /**
* generate_after_main_content hook. * generate_after_main_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_after_main_content' ); do_action( 'generate_after_main_content' );
?> ?>
</main> </main>
</div> </div>
<?php <?php
/** /**
* generate_after_primary_content_area hook. * generate_after_primary_content_area hook.
* *
* @since 2.0 * @since 2.0
*/ */
do_action( 'generate_after_primary_content_area' ); do_action( 'generate_after_primary_content_area' );
generate_construct_sidebars(); generate_construct_sidebars();
get_footer(); get_footer();

View File

@ -1,78 +1,78 @@
<?php <?php
/** /**
* The template part for displaying a message that posts cannot be found. * The template part for displaying a message that posts cannot be found.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
?> ?>
<div class="no-results not-found"> <div class="no-results not-found">
<div class="inside-article"> <div class="inside-article">
<?php <?php
/** /**
* generate_before_content hook. * generate_before_content hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_featured_page_header_inside_single - 10 * @hooked generate_featured_page_header_inside_single - 10
*/ */
do_action( 'generate_before_content' ); do_action( 'generate_before_content' );
?> ?>
<header class="entry-header"> <header class="entry-header">
<h1 class="entry-title"><?php _e( 'Nothing Found', 'generatepress' ); ?></h1> <h1 class="entry-title"><?php _e( 'Nothing Found', 'generatepress' ); ?></h1>
</header> </header>
<?php <?php
/** /**
* generate_after_entry_header hook. * generate_after_entry_header hook.
* *
* @since 0.1 * @since 0.1
* *
* @hooked generate_post_image - 10 * @hooked generate_post_image - 10
*/ */
do_action( 'generate_after_entry_header' ); do_action( 'generate_after_entry_header' );
?> ?>
<div class="entry-content"> <div class="entry-content">
<?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?> <?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
<p> <p>
<?php <?php
printf( printf(
/* translators: 1: Admin URL */ /* translators: 1: Admin URL */
__( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'generatepress' ), __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'generatepress' ),
esc_url( admin_url( 'post-new.php' ) ) esc_url( admin_url( 'post-new.php' ) )
); );
?> ?>
</p> </p>
<?php elseif ( is_search() ) : ?> <?php elseif ( is_search() ) : ?>
<p><?php _e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'generatepress' ); ?></p> <p><?php _e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'generatepress' ); ?></p>
<?php get_search_form(); ?> <?php get_search_form(); ?>
<?php else : ?> <?php else : ?>
<p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'generatepress' ); ?></p> <p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'generatepress' ); ?></p>
<?php get_search_form(); ?> <?php get_search_form(); ?>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php <?php
/** /**
* generate_after_content hook. * generate_after_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_after_content' ); do_action( 'generate_after_content' );
?> ?>
</div> </div>
</div> </div>

View File

@ -1,59 +1,59 @@
<?php <?php
/** /**
* The template for displaying all pages. * The template for displaying all pages.
* *
* This is the template that displays all pages by default. * This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages * Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a * and that other 'pages' on your WordPress site will use a
* different template. * different template.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
get_header(); ?> get_header(); ?>
<div id="primary" <?php generate_do_element_classes( 'content' ); ?>> <div id="primary" <?php generate_do_element_classes( 'content' ); ?>>
<main id="main" <?php generate_do_element_classes( 'main' ); ?>> <main id="main" <?php generate_do_element_classes( 'main' ); ?>>
<?php <?php
/** /**
* generate_before_main_content hook. * generate_before_main_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_before_main_content' ); do_action( 'generate_before_main_content' );
if ( generate_has_default_loop() ) { if ( generate_has_default_loop() ) {
while ( have_posts() ) : while ( have_posts() ) :
the_post(); the_post();
generate_do_template_part( 'page' ); generate_do_template_part( 'page' );
endwhile; endwhile;
} }
/** /**
* generate_after_main_content hook. * generate_after_main_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_after_main_content' ); do_action( 'generate_after_main_content' );
?> ?>
</main> </main>
</div> </div>
<?php <?php
/** /**
* generate_after_primary_content_area hook. * generate_after_primary_content_area hook.
* *
* @since 2.0 * @since 2.0
*/ */
do_action( 'generate_after_primary_content_area' ); do_action( 'generate_after_primary_content_area' );
generate_construct_sidebars(); generate_construct_sidebars();
get_footer(); get_footer();

View File

@ -5,8 +5,8 @@ License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: two-columns, three-columns, one-column, right-sidebar, left-sidebar, footer-widgets, blog, e-commerce, flexible-header, full-width-template, buddypress, custom-header, custom-background, custom-menu, custom-colors, sticky-post, threaded-comments, translation-ready, rtl-language-support, featured-images, theme-options Tags: two-columns, three-columns, one-column, right-sidebar, left-sidebar, footer-widgets, blog, e-commerce, flexible-header, full-width-template, buddypress, custom-header, custom-background, custom-menu, custom-colors, sticky-post, threaded-comments, translation-ready, rtl-language-support, featured-images, theme-options
Requires at least: 4.5 Requires at least: 4.5
Tested up to: 5.7 Tested up to: 5.8
Stable tag: 3.0.3 Stable tag: 3.0.4
GeneratePress is a lightweight WordPress theme built with a focus on speed and usability. GeneratePress is a lightweight WordPress theme built with a focus on speed and usability.
@ -95,6 +95,12 @@ MIT License: https://github.com/bgrins/TinyColor/blob/master/LICENSE
== Changelog == == Changelog ==
= 3.0.4 =
Release date: July 12, 2021
* Tweak: Apply default Group block padding to blocks in the content area only.
= 3.0.3 = = 3.0.3 =
Release date: March 2, 2021 Release date: March 2, 2021

View File

@ -1,83 +1,83 @@
<?php <?php
/** /**
* The template for displaying Search Results pages. * The template for displaying Search Results pages.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
get_header(); ?> get_header(); ?>
<div id="primary" <?php generate_do_element_classes( 'content' ); ?>> <div id="primary" <?php generate_do_element_classes( 'content' ); ?>>
<main id="main" <?php generate_do_element_classes( 'main' ); ?>> <main id="main" <?php generate_do_element_classes( 'main' ); ?>>
<?php <?php
/** /**
* generate_before_main_content hook. * generate_before_main_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_before_main_content' ); do_action( 'generate_before_main_content' );
if ( generate_has_default_loop() ) { if ( generate_has_default_loop() ) {
if ( have_posts() ) : if ( have_posts() ) :
?> ?>
<header class="page-header"> <header class="page-header">
<h1 class="page-title"> <h1 class="page-title">
<?php <?php
printf( printf(
/* translators: 1: Search query name */ /* translators: 1: Search query name */
__( 'Search Results for: %s', 'generatepress' ), __( 'Search Results for: %s', 'generatepress' ),
'<span>' . get_search_query() . '</span>' '<span>' . get_search_query() . '</span>'
); );
?> ?>
</h1> </h1>
</header> </header>
<?php <?php
while ( have_posts() ) : while ( have_posts() ) :
the_post(); the_post();
generate_do_template_part( 'search' ); generate_do_template_part( 'search' );
endwhile; endwhile;
/** /**
* generate_after_loop hook. * generate_after_loop hook.
* *
* @since 2.3 * @since 2.3
*/ */
do_action( 'generate_after_loop', 'search' ); do_action( 'generate_after_loop', 'search' );
else : else :
generate_do_template_part( 'none' ); generate_do_template_part( 'none' );
endif; endif;
} }
/** /**
* generate_after_main_content hook. * generate_after_main_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_after_main_content' ); do_action( 'generate_after_main_content' );
?> ?>
</main> </main>
</div> </div>
<?php <?php
/** /**
* generate_after_primary_content_area hook. * generate_after_primary_content_area hook.
* *
* @since 2.0 * @since 2.0
*/ */
do_action( 'generate_after_primary_content_area' ); do_action( 'generate_after_primary_content_area' );
generate_construct_sidebars(); generate_construct_sidebars();
get_footer(); get_footer();

View File

@ -1,34 +1,34 @@
<?php <?php
/** /**
* The Sidebar containing the main widget areas. * The Sidebar containing the main widget areas.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
?> ?>
<div id="left-sidebar" <?php generate_do_element_classes( 'left_sidebar' ); ?>> <div id="left-sidebar" <?php generate_do_element_classes( 'left_sidebar' ); ?>>
<div class="inside-left-sidebar"> <div class="inside-left-sidebar">
<?php <?php
/** /**
* generate_before_left_sidebar_content hook. * generate_before_left_sidebar_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_before_left_sidebar_content' ); do_action( 'generate_before_left_sidebar_content' );
if ( ! dynamic_sidebar( 'sidebar-2' ) ) { if ( ! dynamic_sidebar( 'sidebar-2' ) ) {
generate_do_default_sidebar_widgets( 'left-sidebar' ); generate_do_default_sidebar_widgets( 'left-sidebar' );
} }
/** /**
* generate_after_left_sidebar_content hook. * generate_after_left_sidebar_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_after_left_sidebar_content' ); do_action( 'generate_after_left_sidebar_content' );
?> ?>
</div> </div>
</div> </div>

View File

@ -1,34 +1,34 @@
<?php <?php
/** /**
* The Sidebar containing the main widget areas. * The Sidebar containing the main widget areas.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
?> ?>
<div id="right-sidebar" <?php generate_do_element_classes( 'right_sidebar' ); ?>> <div id="right-sidebar" <?php generate_do_element_classes( 'right_sidebar' ); ?>>
<div class="inside-right-sidebar"> <div class="inside-right-sidebar">
<?php <?php
/** /**
* generate_before_right_sidebar_content hook. * generate_before_right_sidebar_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_before_right_sidebar_content' ); do_action( 'generate_before_right_sidebar_content' );
if ( ! dynamic_sidebar( 'sidebar-1' ) ) { if ( ! dynamic_sidebar( 'sidebar-1' ) ) {
generate_do_default_sidebar_widgets( 'right-sidebar' ); generate_do_default_sidebar_widgets( 'right-sidebar' );
} }
/** /**
* generate_after_right_sidebar_content hook. * generate_after_right_sidebar_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_after_right_sidebar_content' ); do_action( 'generate_after_right_sidebar_content' );
?> ?>
</div> </div>
</div> </div>

View File

@ -1,54 +1,54 @@
<?php <?php
/** /**
* The Template for displaying all single posts. * The Template for displaying all single posts.
* *
* @package GeneratePress * @package GeneratePress
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
get_header(); ?> get_header(); ?>
<div id="primary" <?php generate_do_element_classes( 'content' ); ?>> <div id="primary" <?php generate_do_element_classes( 'content' ); ?>>
<main id="main" <?php generate_do_element_classes( 'main' ); ?>> <main id="main" <?php generate_do_element_classes( 'main' ); ?>>
<?php <?php
/** /**
* generate_before_main_content hook. * generate_before_main_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_before_main_content' ); do_action( 'generate_before_main_content' );
if ( generate_has_default_loop() ) { if ( generate_has_default_loop() ) {
while ( have_posts() ) : while ( have_posts() ) :
the_post(); the_post();
generate_do_template_part( 'single' ); generate_do_template_part( 'single' );
endwhile; endwhile;
} }
/** /**
* generate_after_main_content hook. * generate_after_main_content hook.
* *
* @since 0.1 * @since 0.1
*/ */
do_action( 'generate_after_main_content' ); do_action( 'generate_after_main_content' );
?> ?>
</main> </main>
</div> </div>
<?php <?php
/** /**
* generate_after_primary_content_area hook. * generate_after_primary_content_area hook.
* *
* @since 2.0 * @since 2.0
*/ */
do_action( 'generate_after_primary_content_area' ); do_action( 'generate_after_primary_content_area' );
generate_construct_sidebars(); generate_construct_sidebars();
get_footer(); get_footer();

View File

@ -1,22 +1,22 @@
/* /*
Theme Name: GeneratePress Theme Name: GeneratePress
Theme URI: https://generatepress.com Theme URI: https://generatepress.com
Author: Tom Usborne Author: Tom Usborne
Author URI: https://tomusborne.com Author URI: https://tomusborne.com
Description: GeneratePress is a lightweight WordPress theme built with a focus on speed and usability. Performance is important to us, which is why a fresh GeneratePress install adds less than 10kb (gzipped) to your page size. We take full advantage of the new block editor (Gutenberg), which gives you more control over creating your content. If you use page builders, GeneratePress is the right theme for you. It is completely compatible with all major page builders, including Beaver Builder and Elementor. Thanks to our emphasis on WordPress coding standards, we can boast full compatibility with all well-coded plugins, including WooCommerce. GeneratePress is fully responsive, uses valid HTML/CSS and is translated into over 25 languages by our amazing community of users. A few of our many features include microdata integration, 9 widget areas, 5 navigation locations, 5 sidebar layouts, dropdown menus (click or hover) and navigation color presets. Learn more and check out our powerful premium version at https://generatepress.com Description: GeneratePress is a lightweight WordPress theme built with a focus on speed and usability. Performance is important to us, which is why a fresh GeneratePress install adds less than 10kb (gzipped) to your page size. We take full advantage of the new block editor (Gutenberg), which gives you more control over creating your content. If you use page builders, GeneratePress is the right theme for you. It is completely compatible with all major page builders, including Beaver Builder and Elementor. Thanks to our emphasis on WordPress coding standards, we can boast full compatibility with all well-coded plugins, including WooCommerce. GeneratePress is fully responsive, uses valid HTML/CSS and is translated into over 25 languages by our amazing community of users. A few of our many features include microdata integration, 9 widget areas, 5 navigation locations, 5 sidebar layouts, dropdown menus (click or hover) and navigation color presets. Learn more and check out our powerful premium version at https://generatepress.com
Version: 3.0.3 Version: 3.0.4
Requires at least: 4.5.0 Requires at least: 4.5.0
Tested up to: 5.7 Tested up to: 5.8
Requires PHP: 5.4.0 Requires PHP: 5.4.0
License: GNU General Public License v2 or later License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: generatepress Text Domain: generatepress
Tags: two-columns, three-columns, one-column, right-sidebar, left-sidebar, footer-widgets, blog, e-commerce, flexible-header, full-width-template, buddypress, custom-header, custom-background, custom-menu, custom-colors, sticky-post, threaded-comments, translation-ready, rtl-language-support, featured-images, theme-options Tags: two-columns, three-columns, one-column, right-sidebar, left-sidebar, footer-widgets, blog, e-commerce, flexible-header, full-width-template, buddypress, custom-header, custom-background, custom-menu, custom-colors, sticky-post, threaded-comments, translation-ready, rtl-language-support, featured-images, theme-options
GeneratePress, Copyright 2014-2021 EDGE22 Studios LTD. GeneratePress, Copyright 2014-2021 EDGE22 Studios LTD.
GeneratePress is distributed under the terms of the GNU GPL GeneratePress is distributed under the terms of the GNU GPL
GeneratePress is based on Underscores http://underscores.me/, (C) 2012-2021 Automattic, Inc. GeneratePress is based on Underscores http://underscores.me/, (C) 2012-2021 Automattic, Inc.
Actual CSS can be found in /assets/css/ folder. Actual CSS can be found in /assets/css/ folder.
*/ */