updated theme GeneratePress
version 3.1.0
This commit is contained in:
parent
d5dbb2bde7
commit
bdeb131b25
@ -1,46 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying 404 pages (Not Found).
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
get_header(); ?>
|
||||
|
||||
<div id="primary" <?php generate_do_element_classes( 'content' ); ?>>
|
||||
<main id="main" <?php generate_do_element_classes( 'main' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_main_content' );
|
||||
|
||||
generate_do_template_part( '404' );
|
||||
|
||||
/**
|
||||
* generate_after_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_main_content' );
|
||||
?>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_primary_content_area hook.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
do_action( 'generate_after_primary_content_area' );
|
||||
|
||||
generate_construct_sidebars();
|
||||
|
||||
get_footer();
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying 404 pages (Not Found).
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
get_header(); ?>
|
||||
|
||||
<div <?php generate_do_attr( 'content' ); ?>>
|
||||
<main <?php generate_do_attr( 'main' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_main_content' );
|
||||
|
||||
generate_do_template_part( '404' );
|
||||
|
||||
/**
|
||||
* generate_after_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_main_content' );
|
||||
?>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_primary_content_area hook.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
do_action( 'generate_after_primary_content_area' );
|
||||
|
||||
generate_construct_sidebars();
|
||||
|
||||
get_footer();
|
||||
|
@ -1,78 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying Archive pages.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
get_header(); ?>
|
||||
|
||||
<div id="primary" <?php generate_do_element_classes( 'content' ); ?>>
|
||||
<main id="main" <?php generate_do_element_classes( 'main' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_main_content' );
|
||||
|
||||
if ( generate_has_default_loop() ) {
|
||||
if ( have_posts() ) :
|
||||
|
||||
/**
|
||||
* generate_archive_title hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_archive_title - 10
|
||||
*/
|
||||
do_action( 'generate_archive_title' );
|
||||
|
||||
while ( have_posts() ) :
|
||||
|
||||
the_post();
|
||||
|
||||
generate_do_template_part( 'archive' );
|
||||
|
||||
endwhile;
|
||||
|
||||
/**
|
||||
* generate_after_loop hook.
|
||||
*
|
||||
* @since 2.3
|
||||
*/
|
||||
do_action( 'generate_after_loop', 'archive' );
|
||||
|
||||
else :
|
||||
|
||||
generate_do_template_part( 'none' );
|
||||
|
||||
endif;
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_main_content' );
|
||||
?>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_primary_content_area hook.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
do_action( 'generate_after_primary_content_area' );
|
||||
|
||||
generate_construct_sidebars();
|
||||
|
||||
get_footer();
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying Archive pages.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
get_header(); ?>
|
||||
|
||||
<div <?php generate_do_attr( 'content' ); ?>>
|
||||
<main <?php generate_do_attr( 'main' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_main_content' );
|
||||
|
||||
if ( generate_has_default_loop() ) {
|
||||
if ( have_posts() ) :
|
||||
|
||||
/**
|
||||
* generate_archive_title hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_archive_title - 10
|
||||
*/
|
||||
do_action( 'generate_archive_title' );
|
||||
|
||||
/**
|
||||
* generate_before_loop hook.
|
||||
*
|
||||
* @since 3.1.0
|
||||
*/
|
||||
do_action( 'generate_before_loop', 'archive' );
|
||||
|
||||
while ( have_posts() ) :
|
||||
|
||||
the_post();
|
||||
|
||||
generate_do_template_part( 'archive' );
|
||||
|
||||
endwhile;
|
||||
|
||||
/**
|
||||
* generate_after_loop hook.
|
||||
*
|
||||
* @since 2.3
|
||||
*/
|
||||
do_action( 'generate_after_loop', 'archive' );
|
||||
|
||||
else :
|
||||
|
||||
generate_do_template_part( 'none' );
|
||||
|
||||
endif;
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_main_content' );
|
||||
?>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_primary_content_area hook.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
do_action( 'generate_after_primary_content_area' );
|
||||
|
||||
generate_construct_sidebars();
|
||||
|
||||
get_footer();
|
||||
|
@ -1,165 +1,163 @@
|
||||
.block-editor-block-list__block a,
|
||||
.block-editor-block-list__block a:visited,
|
||||
.block-editor-block-list__block a:hover,
|
||||
.block-editor-block-list__block a:focus {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.block-editor-block-list__layout pre {
|
||||
background: rgba(0, 0, 0, 0.05);
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
line-height: normal;
|
||||
margin-bottom: 1.5em;
|
||||
padding: 20px;
|
||||
overflow: auto;
|
||||
max-width: 100%;
|
||||
color: inherit; /* editor only */
|
||||
}
|
||||
|
||||
body .block-editor-block-list__block blockquote {
|
||||
border-left: 5px solid rgba(0, 0, 0, 0.05);
|
||||
padding: 20px;
|
||||
font-size: 1.2em;
|
||||
font-style:italic;
|
||||
margin: 0 0 1.5em;
|
||||
position: relative;
|
||||
color: inherit; /* editor only */
|
||||
}
|
||||
|
||||
body .wp-block-quote:not(.is-large):not(.is-style-large) {
|
||||
border-left: 5px solid rgba(0, 0, 0, 0.05);
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
body .block-editor-block-list__block blockquote p:last-child {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.block-editor-block-list__layout table,
|
||||
.block-editor-block-list__layout th,
|
||||
.block-editor-block-list__layout td {
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
body .block-editor-block-list__block table {
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
border-width: 1px 0 0 1px;
|
||||
margin: 0 0 1.5em;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.block-editor-block-list__layout th,
|
||||
.block-editor-block-list__layout td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.block-editor-block-list__layout th {
|
||||
border-width: 0 1px 1px 0;
|
||||
}
|
||||
|
||||
.block-editor-block-list__layout td {
|
||||
border-width: 0 1px 1px 0;
|
||||
}
|
||||
|
||||
body .block-editor-block-list__block hr {
|
||||
background-color: rgba(0, 0, 0, 0.1);
|
||||
border: 0;
|
||||
height: 1px;
|
||||
margin-bottom: 40px;
|
||||
margin-top: 40px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
body .block-editor-block-list__block,
|
||||
body .block-editor-block-list__block p {
|
||||
font-size: inherit;
|
||||
}
|
||||
|
||||
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 {
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
## Gallery
|
||||
--------------------------------------------------------------*/
|
||||
|
||||
.block-editor-block-list__layout .wp-block-gallery li figcaption {
|
||||
background: rgba(255, 255, 255, 0.7);
|
||||
color: #000;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Button
|
||||
--------------------------------------------------------------*/
|
||||
|
||||
.block-editor-block-list__layout .wp-block-button .wp-block-button__link {
|
||||
font-size: inherit;
|
||||
padding: 10px 15px;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Content Title
|
||||
--------------------------------------------------------------*/
|
||||
|
||||
button.content-title-visibility {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
font-size: 30px;
|
||||
line-height: 30px;
|
||||
top: calc(50% - 15px);
|
||||
opacity: 0.4;
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
display: none;
|
||||
}
|
||||
|
||||
button.show-content-title:before {
|
||||
content: "\f530";
|
||||
}
|
||||
|
||||
button.disable-content-title:before {
|
||||
content: "\f177";
|
||||
}
|
||||
|
||||
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 {
|
||||
display: block;
|
||||
}
|
||||
|
||||
button.content-title-visibility:before {
|
||||
font-family: dashicons;
|
||||
}
|
||||
|
||||
.content-title-hidden .editor-post-title textarea {
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.edit-post-text-editor .editor-post-title__block .editor-post-title__input {
|
||||
color: initial;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Columns
|
||||
--------------------------------------------------------------*/
|
||||
|
||||
.block-editor-block-list__block .wp-block-columns .wp-block-column {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Fix shortcode block label color
|
||||
--------------------------------------------------------------*/
|
||||
|
||||
.wp-block-shortcode label,
|
||||
.wp-block-shortcode .block-editor-plain-text {
|
||||
color: initial;
|
||||
}
|
||||
.wp-block a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.block-editor-block-list__layout pre {
|
||||
background: rgba(0, 0, 0, 0.05);
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
line-height: normal;
|
||||
margin-bottom: 1.5em;
|
||||
padding: 20px;
|
||||
overflow: auto;
|
||||
max-width: 100%;
|
||||
color: inherit; /* editor only */
|
||||
}
|
||||
|
||||
body .block-editor-block-list__block blockquote {
|
||||
border-left: 5px solid rgba(0, 0, 0, 0.05);
|
||||
padding: 20px;
|
||||
font-size: 1.2em;
|
||||
font-style:italic;
|
||||
margin: 0 0 1.5em;
|
||||
position: relative;
|
||||
color: inherit; /* editor only */
|
||||
}
|
||||
|
||||
body .wp-block-quote:not(.is-large):not(.is-style-large) {
|
||||
border-left: 5px solid rgba(0, 0, 0, 0.05);
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
body .block-editor-block-list__block blockquote p:last-child {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.block-editor-block-list__layout table,
|
||||
.block-editor-block-list__layout th,
|
||||
.block-editor-block-list__layout td {
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
body .block-editor-block-list__block table {
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
border-width: 1px 0 0 1px;
|
||||
margin: 0 0 1.5em;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.block-editor-block-list__layout th,
|
||||
.block-editor-block-list__layout td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.block-editor-block-list__layout th {
|
||||
border-width: 0 1px 1px 0;
|
||||
}
|
||||
|
||||
.block-editor-block-list__layout td {
|
||||
border-width: 0 1px 1px 0;
|
||||
}
|
||||
|
||||
body .block-editor-block-list__block hr {
|
||||
background-color: rgba(0, 0, 0, 0.1);
|
||||
border: 0;
|
||||
height: 1px;
|
||||
margin-bottom: 40px;
|
||||
margin-top: 40px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
body .block-editor-block-list__block,
|
||||
body .block-editor-block-list__block p {
|
||||
font-size: inherit;
|
||||
}
|
||||
|
||||
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 {
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
## Gallery
|
||||
--------------------------------------------------------------*/
|
||||
|
||||
.block-editor-block-list__layout .wp-block-gallery li figcaption {
|
||||
background: rgba(255, 255, 255, 0.7);
|
||||
color: #000;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Button
|
||||
--------------------------------------------------------------*/
|
||||
|
||||
.block-editor-block-list__layout .wp-block-button .wp-block-button__link,
|
||||
.block-editor-block-list__layout .button {
|
||||
font-size: inherit;
|
||||
padding: 10px 15px;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Content Title
|
||||
--------------------------------------------------------------*/
|
||||
|
||||
button.content-title-visibility {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
font-size: 30px;
|
||||
line-height: 30px;
|
||||
top: calc(50% - 15px);
|
||||
opacity: 0.4;
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
display: none;
|
||||
}
|
||||
|
||||
button.show-content-title:before {
|
||||
content: "\f530";
|
||||
}
|
||||
|
||||
button.disable-content-title:before {
|
||||
content: "\f177";
|
||||
}
|
||||
|
||||
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 {
|
||||
display: block;
|
||||
}
|
||||
|
||||
button.content-title-visibility:before {
|
||||
font-family: dashicons;
|
||||
}
|
||||
|
||||
.content-title-hidden .editor-post-title textarea {
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.edit-post-text-editor .editor-post-title__block .editor-post-title__input {
|
||||
color: initial;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Columns
|
||||
--------------------------------------------------------------*/
|
||||
|
||||
.block-editor-block-list__block .wp-block-columns .wp-block-column {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Fix shortcode block label color
|
||||
--------------------------------------------------------------*/
|
||||
|
||||
.wp-block-shortcode label,
|
||||
.wp-block-shortcode .block-editor-plain-text {
|
||||
color: initial;
|
||||
}
|
||||
|
@ -0,0 +1,67 @@
|
||||
.editor-styles-wrapper {
|
||||
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
font-weight: normal;
|
||||
text-transform: none;
|
||||
font-size: 17px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.editor-styles-wrapper p {
|
||||
line-height: 1.5;
|
||||
margin-top: 0;
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
|
||||
.editor-styles-wrapper h1, .editor-styles-wrapper h2, .editor-styles-wrapper h3, .editor-styles-wrapper h4, .editor-styles-wrapper h5, .editor-styles-wrapper h6 {
|
||||
font-family: inherit;
|
||||
font-size: 100%;
|
||||
font-style: inherit;
|
||||
font-weight: inherit;
|
||||
}
|
||||
|
||||
.editor-styles-wrapper h1,
|
||||
.editor-styles-wrapper .editor-post-title__input {
|
||||
font-family: inherit;
|
||||
font-size: 42px;
|
||||
margin-bottom: 20px;
|
||||
margin-top: 0;
|
||||
line-height: 1.2em;
|
||||
font-weight: normal;
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
.editor-styles-wrapper h2 {
|
||||
font-family: inherit;
|
||||
font-size: 35px;
|
||||
margin-bottom: 20px;
|
||||
margin-top: 0;
|
||||
line-height: 1.2em;
|
||||
font-weight: normal;
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
.editor-styles-wrapper h3 {
|
||||
font-family: inherit;
|
||||
font-size: 29px;
|
||||
margin-bottom: 20px;
|
||||
margin-top: 0;
|
||||
line-height: 1.2em;
|
||||
font-weight: normal;
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
.editor-styles-wrapper h4 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.editor-styles-wrapper h5 {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.editor-styles-wrapper h4,
|
||||
.editor-styles-wrapper h5,
|
||||
.editor-styles-wrapper h6 {
|
||||
font-family: inherit;
|
||||
margin-bottom: 20px;
|
||||
margin-top: 0;
|
||||
}
|
@ -1,232 +1,232 @@
|
||||
.js .generate-metabox.postbox .hndle {
|
||||
cursor: inherit;
|
||||
}
|
||||
|
||||
.generate-metabox .clear {
|
||||
padding-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
border-bottom: 1px solid #DDD;
|
||||
}
|
||||
|
||||
.generate-metabox .clear:after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.customize-button a.button,
|
||||
.customize-button a.button:visited {
|
||||
font-size: 25px;
|
||||
padding: 10px 20px;
|
||||
line-height: normal;
|
||||
height: auto;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.customize-button {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.addon-container:before,
|
||||
.addon-container:after {
|
||||
content: ".";
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
visibility: hidden;
|
||||
font-size: 0;
|
||||
line-height: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
.addon-container:after {
|
||||
clear: both;
|
||||
}
|
||||
.premium-addons .gp-clear {
|
||||
margin: 0 !important;
|
||||
border: 0;
|
||||
padding: 0 !important;
|
||||
}
|
||||
.premium-addons .add-on.gp-clear {
|
||||
padding: 15px !important;
|
||||
margin: 0 !important;
|
||||
-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;
|
||||
box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1) inset;
|
||||
}
|
||||
.premium-addons .add-on:last-child {
|
||||
border: 0 !important;
|
||||
}
|
||||
.addon-action {
|
||||
float: right;
|
||||
clear: right;
|
||||
}
|
||||
.addon-name {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.addon-name a {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* New admin */
|
||||
.clearfix:after,
|
||||
.clearfix:before {
|
||||
content: ".";
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
visibility: hidden;
|
||||
font-size: 0;
|
||||
line-height: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.clearfix:after {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.gp-container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.gp-container a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.appearance_page_generate-options #wpcontent,
|
||||
.appearance_page_generate-options #wpbody-content .metabox-holder {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.appearance_page_generate-options .wrap {
|
||||
margin-top: 0;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.gp-masthead {
|
||||
background-color: #fff;
|
||||
text-align: center;
|
||||
box-shadow: 0 1px 0 rgba(200,215,225,0.5), 0 1px 2px #DDD;
|
||||
margin-bottom: 40px;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.gp-container .postbox {
|
||||
box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #DDD;
|
||||
border: 0;
|
||||
min-width: initial;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.gp-masthead .gp-title {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.gp-masthead .gp-title a {
|
||||
font-size: 20px;
|
||||
color: #000;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.gp-masthead .gp-masthead-links {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.gp-masthead-links a {
|
||||
display: inline-block;
|
||||
margin: 0 10px;
|
||||
}
|
||||
|
||||
.gp-masthead .gp-version {
|
||||
display: inline-block;
|
||||
background: #EFEFEF;
|
||||
padding: 1px 3px;
|
||||
border-radius: 2px;
|
||||
font-size: 11px;
|
||||
vertical-align: top;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.gp-options-footer {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.popular-articles ul {
|
||||
list-style-type: disc;
|
||||
margin-left: 20px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.popular-articles .hndle a {
|
||||
float:right;
|
||||
font-size:13px;
|
||||
}
|
||||
|
||||
#gen-delete p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.start-customizing li {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.start-customizing li span {
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.start-customizing ul {
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.gp-container .postbox > h3.hndle {
|
||||
padding-top: 12px;
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.hide-on-desktop {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.grid-70 {
|
||||
float: left;
|
||||
width: 70%;
|
||||
box-sizing: border-box;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.grid-30 {
|
||||
float: left;
|
||||
width: 30%;
|
||||
box-sizing: border-box;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.grid-parent {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.hide-on-mobile {
|
||||
display: none;
|
||||
}
|
||||
.gp-masthead .gp-masthead-links,
|
||||
.gp-masthead .gp-title {
|
||||
float: none;
|
||||
text-align: center;
|
||||
}
|
||||
.gp-masthead .gp-title {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
}
|
||||
.js .generate-metabox.postbox .hndle {
|
||||
cursor: inherit;
|
||||
}
|
||||
|
||||
.generate-metabox .clear {
|
||||
padding-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
border-bottom: 1px solid #DDD;
|
||||
}
|
||||
|
||||
.generate-metabox .clear:after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.customize-button a.button,
|
||||
.customize-button a.button:visited {
|
||||
font-size: 25px;
|
||||
padding: 10px 20px;
|
||||
line-height: normal;
|
||||
height: auto;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.customize-button {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.addon-container:before,
|
||||
.addon-container:after {
|
||||
content: ".";
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
visibility: hidden;
|
||||
font-size: 0;
|
||||
line-height: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
.addon-container:after {
|
||||
clear: both;
|
||||
}
|
||||
.premium-addons .gp-clear {
|
||||
margin: 0 !important;
|
||||
border: 0;
|
||||
padding: 0 !important;
|
||||
}
|
||||
.premium-addons .add-on.gp-clear {
|
||||
padding: 15px !important;
|
||||
margin: 0 !important;
|
||||
-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;
|
||||
box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1) inset;
|
||||
}
|
||||
.premium-addons .add-on:last-child {
|
||||
border: 0 !important;
|
||||
}
|
||||
.addon-action {
|
||||
float: right;
|
||||
clear: right;
|
||||
}
|
||||
.addon-name {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.addon-name a {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* New admin */
|
||||
.clearfix:after,
|
||||
.clearfix:before {
|
||||
content: ".";
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
visibility: hidden;
|
||||
font-size: 0;
|
||||
line-height: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.clearfix:after {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.gp-container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.gp-container a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.appearance_page_generate-options #wpcontent,
|
||||
.appearance_page_generate-options #wpbody-content .metabox-holder {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.appearance_page_generate-options .wrap {
|
||||
margin-top: 0;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.gp-masthead {
|
||||
background-color: #fff;
|
||||
text-align: center;
|
||||
box-shadow: 0 1px 0 rgba(200,215,225,0.5), 0 1px 2px #DDD;
|
||||
margin-bottom: 40px;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.gp-container .postbox {
|
||||
box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #DDD;
|
||||
border: 0;
|
||||
min-width: initial;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.gp-masthead .gp-title {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.gp-masthead .gp-title a {
|
||||
font-size: 20px;
|
||||
color: #000;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.gp-masthead .gp-masthead-links {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.gp-masthead-links a {
|
||||
display: inline-block;
|
||||
margin: 0 10px;
|
||||
}
|
||||
|
||||
.gp-masthead .gp-version {
|
||||
display: inline-block;
|
||||
background: #EFEFEF;
|
||||
padding: 1px 3px;
|
||||
border-radius: 2px;
|
||||
font-size: 11px;
|
||||
vertical-align: top;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.gp-options-footer {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.popular-articles ul {
|
||||
list-style-type: disc;
|
||||
margin-left: 20px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.popular-articles .hndle a {
|
||||
float:right;
|
||||
font-size:13px;
|
||||
}
|
||||
|
||||
#gen-delete p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.start-customizing li {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.start-customizing li span {
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.start-customizing ul {
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.gp-container .postbox > h3.hndle {
|
||||
padding-top: 12px;
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.hide-on-desktop {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.grid-70 {
|
||||
float: left;
|
||||
width: 70%;
|
||||
box-sizing: border-box;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.grid-30 {
|
||||
float: left;
|
||||
width: 30%;
|
||||
box-sizing: border-box;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.grid-parent {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.hide-on-mobile {
|
||||
display: none;
|
||||
}
|
||||
.gp-masthead .gp-masthead-links,
|
||||
.gp-masthead .gp-title {
|
||||
float: none;
|
||||
text-align: center;
|
||||
}
|
||||
.gp-masthead .gp-title {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,125 +1,129 @@
|
||||
.comment-content a {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.bypostauthor {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.comment,
|
||||
.comment-list {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.comment-author-info {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.comment-meta .avatar {
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.comment-author cite {
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.entry-meta.comment-metadata {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.comment-content {
|
||||
margin-top: 1.5em;
|
||||
}
|
||||
|
||||
.comment-respond {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.comment-form > .form-submit {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.comment-form input,
|
||||
.comment-form-comment {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.comment-form #author,
|
||||
.comment-form #email,
|
||||
.comment-form #url {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.comment-metadata .edit-link:before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.comment-body {
|
||||
padding: 30px 0;
|
||||
}
|
||||
|
||||
.comment-content {
|
||||
padding: 30px;
|
||||
border: 1px solid rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.depth-1.parent > .children {
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.comment .children {
|
||||
padding-left: 30px;
|
||||
margin-top: -30px;
|
||||
border-left: 1px solid rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.pingback .comment-body,
|
||||
.trackback .comment-body {
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.pingback .edit-link {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.comment-content p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.comment-list > .comment:first-child {
|
||||
padding-top: 0;
|
||||
margin-top: 0;
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
ol.comment-list {
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
|
||||
.comment-form-cookies-consent {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.comment-form-cookies-consent input {
|
||||
margin-right: 0.5em;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.one-container .comments-area {
|
||||
margin-top: 1.5em;
|
||||
}
|
||||
|
||||
.comment-content .reply {
|
||||
font-size: 85%;
|
||||
}
|
||||
|
||||
#cancel-comment-reply-link {
|
||||
padding-left: 10px;
|
||||
}
|
||||
.comment-content a {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.bypostauthor {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.comment,
|
||||
.comment-list {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.comment-author-info {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.comment-meta .avatar {
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.comment-author cite {
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.entry-meta.comment-metadata {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.comment-content {
|
||||
margin-top: 1.5em;
|
||||
}
|
||||
|
||||
.comment-respond {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.comment-form > .form-submit {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.comment-form input,
|
||||
.comment-form-comment {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.comment-form-comment textarea {
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.comment-form #author,
|
||||
.comment-form #email,
|
||||
.comment-form #url {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.comment-metadata .edit-link:before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.comment-body {
|
||||
padding: 30px 0;
|
||||
}
|
||||
|
||||
.comment-content {
|
||||
padding: 30px;
|
||||
border: 1px solid rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.depth-1.parent > .children {
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.comment .children {
|
||||
padding-left: 30px;
|
||||
margin-top: -30px;
|
||||
border-left: 1px solid rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.pingback .comment-body,
|
||||
.trackback .comment-body {
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.pingback .edit-link {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.comment-content p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.comment-list > .comment:first-child {
|
||||
padding-top: 0;
|
||||
margin-top: 0;
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
ol.comment-list {
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
|
||||
.comment-form-cookies-consent {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.comment-form-cookies-consent input {
|
||||
margin-right: 0.5em;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.one-container .comments-area {
|
||||
margin-top: 1.5em;
|
||||
}
|
||||
|
||||
.comment-content .reply {
|
||||
font-size: 85%;
|
||||
}
|
||||
|
||||
#cancel-comment-reply-link {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
.comment-content a{word-wrap:break-word}.bypostauthor{display:block}.comment,.comment-list{list-style-type:none;padding:0;margin:0}.comment-author-info{display:inline-block;vertical-align:middle}.comment-meta .avatar{float:left;margin-right:10px;border-radius:50%}.comment-author cite{font-style:normal;font-weight:700}.entry-meta.comment-metadata{margin-top:0}.comment-content{margin-top:1.5em}.comment-respond{margin-top:0}.comment-form>.form-submit{margin-bottom:0}.comment-form input,.comment-form-comment{margin-bottom:10px}.comment-form #author,.comment-form #email,.comment-form #url{display:block}.comment-metadata .edit-link:before{display:none}.comment-body{padding:30px 0}.comment-content{padding:30px;border:1px solid rgba(0,0,0,.05)}.depth-1.parent>.children{border-bottom:1px solid rgba(0,0,0,.05)}.comment .children{padding-left:30px;margin-top:-30px;border-left:1px solid rgba(0,0,0,.05)}.pingback .comment-body,.trackback .comment-body{border-bottom:1px solid rgba(0,0,0,.05)}.pingback .edit-link{font-size:13px}.comment-content p:last-child{margin-bottom:0}.comment-list>.comment:first-child{padding-top:0;margin-top:0;border-top:0}ol.comment-list{margin-bottom:1.5em}.comment-form-cookies-consent{display:flex;align-items:center}.comment-form-cookies-consent input{margin-right:.5em;margin-bottom:0}.one-container .comments-area{margin-top:1.5em}.comment-content .reply{font-size:85%}#cancel-comment-reply-link{padding-left:10px}
|
||||
.comment-content a{word-wrap:break-word}.bypostauthor{display:block}.comment,.comment-list{list-style-type:none;padding:0;margin:0}.comment-author-info{display:inline-block;vertical-align:middle}.comment-meta .avatar{float:left;margin-right:10px;border-radius:50%}.comment-author cite{font-style:normal;font-weight:700}.entry-meta.comment-metadata{margin-top:0}.comment-content{margin-top:1.5em}.comment-respond{margin-top:0}.comment-form>.form-submit{margin-bottom:0}.comment-form input,.comment-form-comment{margin-bottom:10px}.comment-form-comment textarea{resize:vertical}.comment-form #author,.comment-form #email,.comment-form #url{display:block}.comment-metadata .edit-link:before{display:none}.comment-body{padding:30px 0}.comment-content{padding:30px;border:1px solid rgba(0,0,0,.05)}.depth-1.parent>.children{border-bottom:1px solid rgba(0,0,0,.05)}.comment .children{padding-left:30px;margin-top:-30px;border-left:1px solid rgba(0,0,0,.05)}.pingback .comment-body,.trackback .comment-body{border-bottom:1px solid rgba(0,0,0,.05)}.pingback .edit-link{font-size:13px}.comment-content p:last-child{margin-bottom:0}.comment-list>.comment:first-child{padding-top:0;margin-top:0;border-top:0}ol.comment-list{margin-bottom:1.5em}.comment-form-cookies-consent{display:flex;align-items:center}.comment-form-cookies-consent input{margin-right:.5em;margin-bottom:0}.one-container .comments-area{margin-top:1.5em}.comment-content .reply{font-size:85%}#cancel-comment-reply-link{padding-left:10px}
|
@ -1,162 +1,174 @@
|
||||
@font-face {
|
||||
font-family: "GeneratePress";
|
||||
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");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.menu-toggle:before,
|
||||
.search-item a:before,
|
||||
.dropdown-menu-toggle:before,
|
||||
.cat-links:before,
|
||||
.tags-links:before,
|
||||
.comments-link:before,
|
||||
.nav-previous .prev:before,
|
||||
.nav-next .next:before,
|
||||
.generate-back-to-top:before {
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
font-style: normal;
|
||||
font-variant: normal;
|
||||
text-rendering: auto;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.cat-links:before,
|
||||
.tags-links:before,
|
||||
.comments-link:before,
|
||||
.nav-previous .prev:before,
|
||||
.nav-next .next:before {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Mobile Menu
|
||||
--------------------------------------------------------------*/
|
||||
.menu-toggle:before {
|
||||
content: "\f0c9";
|
||||
font-family: GeneratePress;
|
||||
width: 1.28571429em;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.toggled .menu-toggle:before {
|
||||
content: "\f00d";
|
||||
}
|
||||
|
||||
.main-navigation.toggled .sfHover > a .dropdown-menu-toggle:before {
|
||||
content: "\f106";
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Navigation Search
|
||||
--------------------------------------------------------------*/
|
||||
.search-item a:before {
|
||||
content: "\f002";
|
||||
font-family: GeneratePress;
|
||||
width: 1.28571429em;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.search-item.close-search a:before {
|
||||
content: "\f00d";
|
||||
}
|
||||
|
||||
.widget .search-form button:before {
|
||||
content: "\f002";
|
||||
font-family: GeneratePress;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Navigation Dropdowns
|
||||
--------------------------------------------------------------*/
|
||||
.dropdown-menu-toggle:before {
|
||||
content: "\f107";
|
||||
font-family: GeneratePress;
|
||||
display: inline-block;
|
||||
width: 0.8em;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
nav:not(.toggled) ul ul .dropdown-menu-toggle:before {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.dropdown-hover .sub-menu-left:not(.toggled) ul ul .dropdown-menu-toggle:before {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.dropdown-click .menu-item-has-children.sfHover > a .dropdown-menu-toggle:before {
|
||||
content: "\f106";
|
||||
}
|
||||
|
||||
.dropdown-hover nav:not(.toggled) ul ul .dropdown-menu-toggle:before {
|
||||
content: "\f105";
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Post Content
|
||||
--------------------------------------------------------------*/
|
||||
.entry-header .cat-links:before,
|
||||
.entry-header .tags-links:before,
|
||||
.entry-header .comments-link:before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.cat-links:before,
|
||||
.tags-links:before,
|
||||
.comments-link:before,
|
||||
.nav-previous .prev:before,
|
||||
.nav-next .next:before {
|
||||
font-family: GeneratePress;
|
||||
text-decoration: inherit;
|
||||
position: relative;
|
||||
margin-right: 0.6em;
|
||||
width: 13px;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.cat-links:before {
|
||||
content: "\f07b";
|
||||
}
|
||||
|
||||
.tags-links:before {
|
||||
content: "\f02c";
|
||||
}
|
||||
|
||||
.comments-link:before {
|
||||
content: "\f086";
|
||||
}
|
||||
|
||||
.nav-previous .prev:before {
|
||||
content: "\f104";
|
||||
}
|
||||
|
||||
.nav-next .next:before {
|
||||
content: "\f105";
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Sidebar Navigation
|
||||
--------------------------------------------------------------*/
|
||||
.dropdown-hover.both-right .inside-left-sidebar .dropdown-menu-toggle:before,
|
||||
.dropdown-hover .inside-right-sidebar .dropdown-menu-toggle:before {
|
||||
content: "\f104";
|
||||
}
|
||||
|
||||
.dropdown-hover.both-left .inside-right-sidebar .dropdown-menu-toggle:before,
|
||||
.dropdown-hover .inside-left-sidebar .dropdown-menu-toggle:before {
|
||||
content: "\f105";
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Back to Top Button
|
||||
--------------------------------------------------------------*/
|
||||
.generate-back-to-top:before {
|
||||
content: "\f106";
|
||||
font-family: GeneratePress;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "GeneratePress";
|
||||
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");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.menu-toggle:before,
|
||||
.search-item a:before,
|
||||
.dropdown-menu-toggle:before,
|
||||
.cat-links:before,
|
||||
.tags-links:before,
|
||||
.comments-link:before,
|
||||
.nav-previous .prev:before,
|
||||
.nav-next .next:before,
|
||||
.generate-back-to-top:before,
|
||||
.search-form .search-submit:before {
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
font-style: normal;
|
||||
font-variant: normal;
|
||||
text-rendering: auto;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.cat-links:before,
|
||||
.tags-links:before,
|
||||
.comments-link:before,
|
||||
.nav-previous .prev:before,
|
||||
.nav-next .next:before {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Mobile Menu
|
||||
--------------------------------------------------------------*/
|
||||
.menu-toggle:before {
|
||||
content: "\f0c9";
|
||||
font-family: GeneratePress;
|
||||
width: 1.28571429em;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.toggled .menu-toggle:before {
|
||||
content: "\f00d";
|
||||
}
|
||||
|
||||
.main-navigation.toggled .sfHover > a .dropdown-menu-toggle:before {
|
||||
content: "\f106";
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Navigation Search
|
||||
--------------------------------------------------------------*/
|
||||
.search-item a:before {
|
||||
content: "\f002";
|
||||
font-family: GeneratePress;
|
||||
width: 1.28571429em;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.search-item.close-search a:before {
|
||||
content: "\f00d";
|
||||
}
|
||||
|
||||
.widget .search-form button:before {
|
||||
content: "\f002";
|
||||
font-family: GeneratePress;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Navigation Dropdowns
|
||||
--------------------------------------------------------------*/
|
||||
.dropdown-menu-toggle:before {
|
||||
content: "\f107";
|
||||
font-family: GeneratePress;
|
||||
display: inline-block;
|
||||
width: 0.8em;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
nav:not(.toggled) ul ul .dropdown-menu-toggle:before {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.dropdown-hover .sub-menu-left:not(.toggled) ul ul .dropdown-menu-toggle:before {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.dropdown-click .menu-item-has-children.sfHover > a .dropdown-menu-toggle:before {
|
||||
content: "\f106";
|
||||
}
|
||||
|
||||
.dropdown-hover nav:not(.toggled) ul ul .dropdown-menu-toggle:before {
|
||||
content: "\f105";
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Post Content
|
||||
--------------------------------------------------------------*/
|
||||
.entry-header .cat-links:before,
|
||||
.entry-header .tags-links:before,
|
||||
.entry-header .comments-link:before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.cat-links:before,
|
||||
.tags-links:before,
|
||||
.comments-link:before,
|
||||
.nav-previous .prev:before,
|
||||
.nav-next .next:before {
|
||||
font-family: GeneratePress;
|
||||
text-decoration: inherit;
|
||||
position: relative;
|
||||
margin-right: 0.6em;
|
||||
width: 13px;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.cat-links:before {
|
||||
content: "\f07b";
|
||||
}
|
||||
|
||||
.tags-links:before {
|
||||
content: "\f02c";
|
||||
}
|
||||
|
||||
.comments-link:before {
|
||||
content: "\f086";
|
||||
}
|
||||
|
||||
.nav-previous .prev:before {
|
||||
content: "\f104";
|
||||
}
|
||||
|
||||
.nav-next .next:before {
|
||||
content: "\f105";
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Sidebar Navigation
|
||||
--------------------------------------------------------------*/
|
||||
.dropdown-hover.both-right .inside-left-sidebar .dropdown-menu-toggle:before,
|
||||
.dropdown-hover .inside-right-sidebar .dropdown-menu-toggle:before {
|
||||
content: "\f104";
|
||||
}
|
||||
|
||||
.dropdown-hover.both-left .inside-right-sidebar .dropdown-menu-toggle:before,
|
||||
.dropdown-hover .inside-left-sidebar .dropdown-menu-toggle:before {
|
||||
content: "\f105";
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Back to Top Button
|
||||
--------------------------------------------------------------*/
|
||||
.generate-back-to-top:before {
|
||||
content: "\f106";
|
||||
font-family: GeneratePress;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Search button
|
||||
--------------------------------------------------------------*/
|
||||
.search-form .search-submit:before {
|
||||
content: "\f002";
|
||||
font-family: GeneratePress;
|
||||
width: 1.28571429em;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
@font-face{font-family:GeneratePress;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");font-weight:400;font-style:normal}.cat-links:before,.comments-link:before,.dropdown-menu-toggle:before,.generate-back-to-top:before,.menu-toggle:before,.nav-next .next:before,.nav-previous .prev:before,.search-item a:before,.tags-links:before{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-style:normal;font-variant:normal;text-rendering:auto;line-height:1}.cat-links:before,.comments-link:before,.nav-next .next:before,.nav-previous .prev:before,.tags-links:before{opacity:.7}.menu-toggle:before{content:"\f0c9";font-family:GeneratePress;width:1.28571429em;text-align:center;display:inline-block}.toggled .menu-toggle:before{content:"\f00d"}.main-navigation.toggled .sfHover>a .dropdown-menu-toggle:before{content:"\f106"}.search-item a:before{content:"\f002";font-family:GeneratePress;width:1.28571429em;text-align:center;display:inline-block}.search-item.close-search a:before{content:"\f00d"}.widget .search-form button:before{content:"\f002";font-family:GeneratePress}.dropdown-menu-toggle:before{content:"\f107";font-family:GeneratePress;display:inline-block;width:.8em;text-align:left}nav:not(.toggled) ul ul .dropdown-menu-toggle:before{text-align:right}.dropdown-hover .sub-menu-left:not(.toggled) ul ul .dropdown-menu-toggle:before{transform:rotate(180deg)}.dropdown-click .menu-item-has-children.sfHover>a .dropdown-menu-toggle:before{content:"\f106"}.dropdown-hover nav:not(.toggled) ul ul .dropdown-menu-toggle:before{content:"\f105"}.entry-header .cat-links:before,.entry-header .comments-link:before,.entry-header .tags-links:before{display:none}.cat-links:before,.comments-link:before,.nav-next .next:before,.nav-previous .prev:before,.tags-links:before{font-family:GeneratePress;text-decoration:inherit;position:relative;margin-right:.6em;width:13px;text-align:center;display:inline-block}.cat-links:before{content:"\f07b"}.tags-links:before{content:"\f02c"}.comments-link:before{content:"\f086"}.nav-previous .prev:before{content:"\f104"}.nav-next .next:before{content:"\f105"}.dropdown-hover .inside-right-sidebar .dropdown-menu-toggle:before,.dropdown-hover.both-right .inside-left-sidebar .dropdown-menu-toggle:before{content:"\f104"}.dropdown-hover .inside-left-sidebar .dropdown-menu-toggle:before,.dropdown-hover.both-left .inside-right-sidebar .dropdown-menu-toggle:before{content:"\f105"}.generate-back-to-top:before{content:"\f106";font-family:GeneratePress}
|
||||
@font-face{font-family:GeneratePress;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");font-weight:400;font-style:normal}.cat-links:before,.comments-link:before,.dropdown-menu-toggle:before,.generate-back-to-top:before,.menu-toggle:before,.nav-next .next:before,.nav-previous .prev:before,.search-form .search-submit:before,.search-item a:before,.tags-links:before{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-style:normal;font-variant:normal;text-rendering:auto;line-height:1}.cat-links:before,.comments-link:before,.nav-next .next:before,.nav-previous .prev:before,.tags-links:before{opacity:.7}.menu-toggle:before{content:"\f0c9";font-family:GeneratePress;width:1.28571429em;text-align:center;display:inline-block}.toggled .menu-toggle:before{content:"\f00d"}.main-navigation.toggled .sfHover>a .dropdown-menu-toggle:before{content:"\f106"}.search-item a:before{content:"\f002";font-family:GeneratePress;width:1.28571429em;text-align:center;display:inline-block}.search-item.close-search a:before{content:"\f00d"}.widget .search-form button:before{content:"\f002";font-family:GeneratePress}.dropdown-menu-toggle:before{content:"\f107";font-family:GeneratePress;display:inline-block;width:.8em;text-align:left}nav:not(.toggled) ul ul .dropdown-menu-toggle:before{text-align:right}.dropdown-hover .sub-menu-left:not(.toggled) ul ul .dropdown-menu-toggle:before{transform:rotate(180deg)}.dropdown-click .menu-item-has-children.sfHover>a .dropdown-menu-toggle:before{content:"\f106"}.dropdown-hover nav:not(.toggled) ul ul .dropdown-menu-toggle:before{content:"\f105"}.entry-header .cat-links:before,.entry-header .comments-link:before,.entry-header .tags-links:before{display:none}.cat-links:before,.comments-link:before,.nav-next .next:before,.nav-previous .prev:before,.tags-links:before{font-family:GeneratePress;text-decoration:inherit;position:relative;margin-right:.6em;width:13px;text-align:center;display:inline-block}.cat-links:before{content:"\f07b"}.tags-links:before{content:"\f02c"}.comments-link:before{content:"\f086"}.nav-previous .prev:before{content:"\f104"}.nav-next .next:before{content:"\f105"}.dropdown-hover .inside-right-sidebar .dropdown-menu-toggle:before,.dropdown-hover.both-right .inside-left-sidebar .dropdown-menu-toggle:before{content:"\f104"}.dropdown-hover .inside-left-sidebar .dropdown-menu-toggle:before,.dropdown-hover.both-left .inside-right-sidebar .dropdown-menu-toggle:before{content:"\f105"}.generate-back-to-top:before{content:"\f106";font-family:GeneratePress}.search-form .search-submit:before{content:"\f002";font-family:GeneratePress;width:1.28571429em;text-align:center;display:inline-block}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,258 +1,258 @@
|
||||
/*--------------------------------------------------------------
|
||||
# Mobile Menu
|
||||
--------------------------------------------------------------*/
|
||||
.menu-toggle,
|
||||
.mobile-bar-items,
|
||||
.sidebar-nav-mobile {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.menu-toggle {
|
||||
padding: 0 20px;
|
||||
line-height: 60px;
|
||||
margin: 0;
|
||||
font-weight: normal;
|
||||
text-transform: none;
|
||||
font-size: 15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button.menu-toggle {
|
||||
background-color: transparent;
|
||||
width: 100%;
|
||||
border: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
button.menu-toggle:hover,
|
||||
button.menu-toggle:active,
|
||||
button.menu-toggle:focus {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.menu-toggle .mobile-menu {
|
||||
padding-left: 3px;
|
||||
}
|
||||
|
||||
.menu-toggle .gp-icon + .mobile-menu {
|
||||
padding-left: 9px;
|
||||
}
|
||||
|
||||
.menu-toggle .mobile-menu:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.nav-search-enabled .main-navigation .menu-toggle {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.mobile-bar-items {
|
||||
display: none;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
z-index: 21;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
.mobile-bar-items a {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
nav.toggled ul ul.sub-menu {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dropdown-hover .main-navigation.toggled ul li:hover > ul,
|
||||
.dropdown-hover .main-navigation.toggled ul li.sfHover > ul {
|
||||
transition-delay: 0s;
|
||||
}
|
||||
|
||||
.toggled .menu-item-has-children .dropdown-menu-toggle {
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.main-navigation.toggled ul ul {
|
||||
transition: 0s;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.main-navigation.toggled .main-nav > ul {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.main-navigation.toggled .main-nav ul ul.toggled-on {
|
||||
position: relative;
|
||||
top: 0;
|
||||
left: auto !important;
|
||||
right: auto !important;
|
||||
width: 100%;
|
||||
pointer-events: auto;
|
||||
height: auto;
|
||||
opacity: 1;
|
||||
display: block;
|
||||
visibility: visible;
|
||||
float: none;
|
||||
}
|
||||
|
||||
.main-navigation.toggled .main-nav li {
|
||||
float: none;
|
||||
clear: both;
|
||||
display: block;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.main-navigation.toggled .main-nav li.hide-on-mobile {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.main-navigation.toggled .menu-item-has-children .dropdown-menu-toggle {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.main-navigation.toggled .menu li.search-item {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.main-navigation.toggled .sf-menu > li.menu-item-float-right {
|
||||
float: none;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Breakpoint (768px)
|
||||
--------------------------------------------------------------*/
|
||||
@media (max-width: 768px) {
|
||||
/*--------------------------------------------------------------
|
||||
## Links
|
||||
--------------------------------------------------------------*/
|
||||
a, body, button, input, select, textarea {
|
||||
transition: all 0s ease-in-out;
|
||||
}
|
||||
/*--------------------------------------------------------------
|
||||
## Top Bar
|
||||
--------------------------------------------------------------*/
|
||||
.top-bar.top-bar-align-left,
|
||||
.top-bar.top-bar-align-right {
|
||||
text-align: center;
|
||||
}
|
||||
.top-bar .widget {
|
||||
float: none !important;
|
||||
margin: 0 10px !important;
|
||||
}
|
||||
.top-bar .widget_nav_menu li {
|
||||
float: none;
|
||||
display: inline-block;
|
||||
padding: 5px 0;
|
||||
}
|
||||
.footer-bar .widget_nav_menu li:first-child {
|
||||
margin-left: 10px;
|
||||
}
|
||||
.footer-bar .widget_nav_menu li:last-child {
|
||||
margin-right: 10px;
|
||||
}
|
||||
/*--------------------------------------------------------------
|
||||
## Header
|
||||
--------------------------------------------------------------*/
|
||||
.inside-header > *:not(:last-child):not(.main-navigation) {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.site-header,
|
||||
.header-aligned-right .site-header {
|
||||
text-align: center;
|
||||
}
|
||||
.header-widget {
|
||||
float: none;
|
||||
max-width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
/*--------------------------------------------------------------
|
||||
## Content Area
|
||||
--------------------------------------------------------------*/
|
||||
.sidebar,
|
||||
.content-area,
|
||||
.inside-footer-widgets > div {
|
||||
float: none;
|
||||
width: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
.site-main {
|
||||
margin-left: 0 !important;
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
body:not(.no-sidebar) .site-main {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
.one-container .sidebar {
|
||||
margin-top: 40px;
|
||||
}
|
||||
.separate-containers #left-sidebar + #right-sidebar .inside-right-sidebar {
|
||||
margin-top: 0;
|
||||
}
|
||||
.both-right.separate-containers .inside-left-sidebar,
|
||||
.both-left.separate-containers .inside-left-sidebar,
|
||||
.both-right.separate-containers .inside-right-sidebar,
|
||||
.both-left.separate-containers .inside-right-sidebar {
|
||||
margin-right: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
.alignleft,
|
||||
.alignright {
|
||||
float: none;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
.post-image-aligned-left .post-image,
|
||||
.post-image-aligned-right .post-image {
|
||||
float: none;
|
||||
margin: 2em 0;
|
||||
text-align: center;
|
||||
}
|
||||
.comment .children {
|
||||
padding-left: 10px;
|
||||
margin-left: 0;
|
||||
}
|
||||
.edd_download {
|
||||
display: block;
|
||||
float: none !important;
|
||||
margin-bottom: 1.5em;
|
||||
width: 100% !important;
|
||||
}
|
||||
.entry-meta {
|
||||
font-size: inherit;
|
||||
}
|
||||
.entry-meta a {
|
||||
line-height: 1.8em;
|
||||
}
|
||||
/*--------------------------------------------------------------
|
||||
## Footer
|
||||
--------------------------------------------------------------*/
|
||||
.site-info {
|
||||
text-align: center;
|
||||
}
|
||||
.copyright-bar {
|
||||
float: none !important;
|
||||
text-align: center !important;
|
||||
}
|
||||
.footer-bar {
|
||||
float: none !important;
|
||||
text-align: center !important;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.footer-bar .widget_nav_menu li {
|
||||
float: none;
|
||||
display: inline-block;
|
||||
padding: 5px 0;
|
||||
}
|
||||
.inside-footer-widgets > div:not(:last-child) {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.site-footer .footer-widgets .footer-widgets-container .inside-footer-widgets {
|
||||
margin: 0;
|
||||
}
|
||||
.site-footer .footer-widgets .footer-widgets-container .inner-padding {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
/*--------------------------------------------------------------
|
||||
# Mobile Menu
|
||||
--------------------------------------------------------------*/
|
||||
.menu-toggle,
|
||||
.mobile-bar-items,
|
||||
.sidebar-nav-mobile {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.menu-toggle {
|
||||
padding: 0 20px;
|
||||
line-height: 60px;
|
||||
margin: 0;
|
||||
font-weight: normal;
|
||||
text-transform: none;
|
||||
font-size: 15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button.menu-toggle {
|
||||
background-color: transparent;
|
||||
width: 100%;
|
||||
border: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
button.menu-toggle:hover,
|
||||
button.menu-toggle:active,
|
||||
button.menu-toggle:focus {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.menu-toggle .mobile-menu {
|
||||
padding-left: 3px;
|
||||
}
|
||||
|
||||
.menu-toggle .gp-icon + .mobile-menu {
|
||||
padding-left: 9px;
|
||||
}
|
||||
|
||||
.menu-toggle .mobile-menu:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.nav-search-enabled .main-navigation .menu-toggle {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.mobile-bar-items {
|
||||
display: none;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
z-index: 21;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
.mobile-bar-items a {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
nav.toggled ul ul.sub-menu {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dropdown-hover .main-navigation.toggled ul li:hover > ul,
|
||||
.dropdown-hover .main-navigation.toggled ul li.sfHover > ul {
|
||||
transition-delay: 0s;
|
||||
}
|
||||
|
||||
.toggled .menu-item-has-children .dropdown-menu-toggle {
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.main-navigation.toggled ul ul {
|
||||
transition: 0s;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.main-navigation.toggled .main-nav > ul {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.main-navigation.toggled .main-nav ul ul.toggled-on {
|
||||
position: relative;
|
||||
top: 0;
|
||||
left: auto !important;
|
||||
right: auto !important;
|
||||
width: 100%;
|
||||
pointer-events: auto;
|
||||
height: auto;
|
||||
opacity: 1;
|
||||
display: block;
|
||||
visibility: visible;
|
||||
float: none;
|
||||
}
|
||||
|
||||
.main-navigation.toggled .main-nav li {
|
||||
float: none;
|
||||
clear: both;
|
||||
display: block;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.main-navigation.toggled .main-nav li.hide-on-mobile {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.main-navigation.toggled .menu-item-has-children .dropdown-menu-toggle {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.main-navigation.toggled .menu li.search-item {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.main-navigation.toggled .sf-menu > li.menu-item-float-right {
|
||||
float: none;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Breakpoint (768px)
|
||||
--------------------------------------------------------------*/
|
||||
@media (max-width: 768px) {
|
||||
/*--------------------------------------------------------------
|
||||
## Links
|
||||
--------------------------------------------------------------*/
|
||||
a, body, button, input, select, textarea {
|
||||
transition: all 0s ease-in-out;
|
||||
}
|
||||
/*--------------------------------------------------------------
|
||||
## Top Bar
|
||||
--------------------------------------------------------------*/
|
||||
.top-bar.top-bar-align-left,
|
||||
.top-bar.top-bar-align-right {
|
||||
text-align: center;
|
||||
}
|
||||
.top-bar .widget {
|
||||
float: none !important;
|
||||
margin: 0 10px !important;
|
||||
}
|
||||
.top-bar .widget_nav_menu li {
|
||||
float: none;
|
||||
display: inline-block;
|
||||
padding: 5px 0;
|
||||
}
|
||||
.footer-bar .widget_nav_menu li:first-child {
|
||||
margin-left: 10px;
|
||||
}
|
||||
.footer-bar .widget_nav_menu li:last-child {
|
||||
margin-right: 10px;
|
||||
}
|
||||
/*--------------------------------------------------------------
|
||||
## Header
|
||||
--------------------------------------------------------------*/
|
||||
.inside-header > *:not(:last-child):not(.main-navigation) {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.site-header,
|
||||
.header-aligned-right .site-header {
|
||||
text-align: center;
|
||||
}
|
||||
.header-widget {
|
||||
float: none;
|
||||
max-width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
/*--------------------------------------------------------------
|
||||
## Content Area
|
||||
--------------------------------------------------------------*/
|
||||
.sidebar,
|
||||
.content-area,
|
||||
.inside-footer-widgets > div {
|
||||
float: none;
|
||||
width: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
.site-main {
|
||||
margin-left: 0 !important;
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
body:not(.no-sidebar) .site-main {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
.one-container .sidebar {
|
||||
margin-top: 40px;
|
||||
}
|
||||
.separate-containers #left-sidebar + #right-sidebar .inside-right-sidebar {
|
||||
margin-top: 0;
|
||||
}
|
||||
.both-right.separate-containers .inside-left-sidebar,
|
||||
.both-left.separate-containers .inside-left-sidebar,
|
||||
.both-right.separate-containers .inside-right-sidebar,
|
||||
.both-left.separate-containers .inside-right-sidebar {
|
||||
margin-right: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
.alignleft,
|
||||
.alignright {
|
||||
float: none;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
.post-image-aligned-left .post-image,
|
||||
.post-image-aligned-right .post-image {
|
||||
float: none;
|
||||
margin: 2em 0;
|
||||
text-align: center;
|
||||
}
|
||||
.comment .children {
|
||||
padding-left: 10px;
|
||||
margin-left: 0;
|
||||
}
|
||||
.edd_download {
|
||||
display: block;
|
||||
float: none !important;
|
||||
margin-bottom: 1.5em;
|
||||
width: 100% !important;
|
||||
}
|
||||
.entry-meta {
|
||||
font-size: inherit;
|
||||
}
|
||||
.entry-meta a {
|
||||
line-height: 1.8em;
|
||||
}
|
||||
/*--------------------------------------------------------------
|
||||
## Footer
|
||||
--------------------------------------------------------------*/
|
||||
.site-info {
|
||||
text-align: center;
|
||||
}
|
||||
.copyright-bar {
|
||||
float: none !important;
|
||||
text-align: center !important;
|
||||
}
|
||||
.footer-bar {
|
||||
float: none !important;
|
||||
text-align: center !important;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.footer-bar .widget_nav_menu li {
|
||||
float: none;
|
||||
display: inline-block;
|
||||
padding: 5px 0;
|
||||
}
|
||||
.inside-footer-widgets > div:not(:last-child) {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.site-footer .footer-widgets .footer-widgets-container .inside-footer-widgets {
|
||||
margin: 0;
|
||||
}
|
||||
.site-footer .footer-widgets .footer-widgets-container .inner-padding {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
1
wp-content/themes/generatepress/assets/dist/block-editor.asset.php
vendored
Normal file
1
wp-content/themes/generatepress/assets/dist/block-editor.asset.php
vendored
Normal file
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('wp-data', 'wp-plugins', 'wp-polyfill'), 'version' => '11ef0750a5fe7ac2ec7219a41656ae84');
|
1
wp-content/themes/generatepress/assets/dist/block-editor.js
vendored
Normal file
1
wp-content/themes/generatepress/assets/dist/block-editor.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=57)}({11:function(e,t){e.exports=window.wp.data},27:function(e,t){e.exports=window.wp.plugins},57:function(e,t,r){"use strict";r.r(t);var n=r(27),o=r(11);Object(o.select)("core/edit-post")&&Object(o.select)("core/edit-post").__experimentalGetPreviewDeviceType&&Object(n.registerPlugin)("generatepress-responsive-classes",{render:function(){var e=Object(o.useSelect)((function(){var e=Object(o.select)("core/edit-post").__experimentalGetPreviewDeviceType;return e?{deviceType:e()}:{deviceType:null}}),[]).deviceType;return document.querySelector("body").classList.remove("gp-is-device-desktop","gp-is-device-tablet","gp-is-device-mobile"),document.querySelector("body").classList.add("gp-is-device-"+e.toLowerCase()),null}})}});
|
1
wp-content/themes/generatepress/assets/dist/customizer.asset.php
vendored
Normal file
1
wp-content/themes/generatepress/assets/dist/customizer.asset.php
vendored
Normal file
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'react-dom', 'wp-components', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => 'cce88a99e1e77f1e8791fa8ad107481c');
|
5
wp-content/themes/generatepress/assets/dist/customizer.js
vendored
Normal file
5
wp-content/themes/generatepress/assets/dist/customizer.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
wp-content/themes/generatepress/assets/dist/dashboard.asset.php
vendored
Normal file
1
wp-content/themes/generatepress/assets/dist/dashboard.asset.php
vendored
Normal file
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('wp-api-fetch', 'wp-components', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => '1544fd10034784b46bf2292e69917371');
|
1
wp-content/themes/generatepress/assets/dist/dashboard.js
vendored
Normal file
1
wp-content/themes/generatepress/assets/dist/dashboard.js
vendored
Normal file
File diff suppressed because one or more lines are too long
10
wp-content/themes/generatepress/assets/dist/style-customizer.css
vendored
Normal file
10
wp-content/themes/generatepress/assets/dist/style-customizer.css
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
.components-base-control__help{margin-top:2px;margin-bottom:0}.components-base-control__label{display:block;margin-bottom:10px}.generate-customize-control-wrapper{display:flex}.generate-customize-control-wrapper[data-wrapper-type=color]>div:first-child{flex-grow:1}.generate-customize-control-wrapper[data-wrapper-type=color]>div:not(:first-child):not(:empty){margin-left:5px}.generate-customize-control-wrapper[data-wrapper-type=two-col]>div{flex-basis:calc(50% - 5px)}.generate-customize-control-wrapper[data-wrapper-type=two-col]>div:nth-child(odd){margin-right:5px}.generate-customize-control-wrapper[data-wrapper-type=two-col]>div:nth-child(even){margin-left:5px}.generate-customize-control--popover>.components-popover__content{padding:15px;width:280px;box-sizing:border-box}.generate-customize-control--popover .components-base-control:not(:last-child){margin-bottom:15px}.customize-control[data-toggleid]{display:none}#customize-control-generate_settings-google_font_display{margin-top:10px;display:flex;flex-direction:column}#customize-control-generate_settings-google_font_display .description{order:10;margin-bottom:0;margin-top:5px}
|
||||
|
||||
.generate-component-color-picker .components-color-picker{box-sizing:border-box}.generate-component-color-picker .components-color-picker__inputs-wrapper{display:none}.generate-component-color-picker .generate-color-input-wrapper{display:flex;padding:0}.generate-component-color-picker .generate-color-input-wrapper .generate-color-input{flex-grow:1}.generate-component-color-picker .generate-color-input-wrapper .components-color-clear-color{margin-left:5px}.generate-component-color-picker .generate-color-input-wrapper input{margin-right:5px}.generate-component-color-picker .generate-color-input-wrapper .components-base-control__field{margin-bottom:0}.generate-component-color-picker>.components-base-control:first-child{margin-bottom:0}.generate-component-color-picker .components-color-picker__inputs-wrapper{min-width:auto}.generate-component-color-picker .generate-component-color-picker-palette{padding:16px 0 0}.generate-component-color-picker .generate-component-color-picker-palette .components-circular-option-picker{display:flex;flex-wrap:wrap}.generate-component-color-picker .generate-component-color-picker-palette .components-circular-option-picker .components-circular-option-picker__option-wrapper{margin:0 8px 8px 0}.generate-component-color-picker .components-color-palette{margin:0}.generate-component-color-picker .components-color-picker{padding:5px}.generate-component-color-picker .components-color-picker__body{padding-bottom:0}.generate-component-color-picker .components-popover__content{padding:10px;width:295px;box-sizing:border-box}.generate-component-color-picker .components-color-clear-color{height:auto}.generate-component-color-picker .components-circular-option-picker__option.is-pressed+svg{fill:#fff;background:#000;transform:scale(0.6)}.generate-component-color-picker[data-x-axis=left] .components-popover__content{margin-right:-35px !important}.generate-customize-control-wrapper{display:flex}.generate-customize-control-wrapper.generate-customize-color-control-wrapper>div:first-child{flex-grow:1}.generate-customize-control-wrapper.generate-customize-color-control-wrapper>div:not(:last-child){margin-right:5px}.generate-component-color-picker-wrapper>.components-base-control__field{position:relative;display:flex;align-items:center;justify-content:space-between}.generate-component-color-picker-wrapper>.components-base-control__field .components-color-palette__item-wrapper{margin:0}.generate-component-color-picker-palette button,.generate-color-picker-area button{width:28px;height:28px;position:relative}.generate-component-color-picker-palette button:hover,.generate-color-picker-area button:hover{background-color:inherit}.generate-component-color-picker-palette button:focus:after,.generate-color-picker-area button:focus:after{width:28px;height:28px}.generate-customize-control--popover .components-color-picker{box-sizing:border-box}.generate-customize-control--popover .components-color-picker__inputs-wrapper{display:none}.generate-customize-control--popover>.components-base-control:first-child{margin-bottom:0}.generate-customize-control--popover .components-color-picker__inputs-wrapper{min-width:auto}.generate-customize-control--popover .components-color-picker{padding:5px}.generate-customize-control--popover .components-color-picker__body{padding-bottom:0}.generate-customize-control--popover .components-color-clear-color{height:auto}.generate-component-color-picker[data-x-axis=left] .components-popover__content{margin-right:-35px !important}.generate-color-input--icon{align-items:center;justify-content:center;display:flex;padding:5px;border:1px solid currentColor;border-right:0;border-top-left-radius:3px;border-bottom-left-radius:3px}.generate-color-input--icon svg{height:1em;width:1em;transform:scale(1.3)}.generate-color-option-area{padding:16px 16px 0}.generate-color-input--css-var-name-wrapper{position:relative}.generate-color-input--css-var-name-wrapper button{position:absolute;bottom:0;right:0;padding:0 8px;min-height:30px;height:auto}.generate-color-input--css-var-name-wrapper button svg{width:1em;height:1em;fill:none}
|
||||
.generate-font-manager--item{margin-bottom:10px}.generate-font-manager--item .generate-font-manager--header{display:flex;align-items:center}.generate-font-manager--item .generate-font-manager--header .generate-font-manager--label{flex-grow:1;padding-left:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.generate-font-manager--item .generate-font-manager--header .components-button:not(.generate-font-manager--label){background:#fff;border:1px solid #777;padding:0;display:flex;justify-content:center;align-items:center;width:30px;height:30px;min-width:30px;margin-left:5px;border-radius:100%;flex-shrink:0}.generate-font-manager--item .generate-font-manager--header .components-button:not(.generate-font-manager--label) svg{margin-right:0;width:1em;height:1em}.generate-font-manager--item .generate-font-manager--header .components-button:not(.generate-font-manager--label).generate-font-manager--open svg{fill:none}.generate-font-manager--item .generate-font-manager--options{margin-top:15px}.generate-font-manager--item .generate-font-manager--footer{margin-top:15px;padding-top:15px;border-top:1px solid #ddd}.generate-font-manager--item .generate-font-manager-google-font--field{margin-top:10px}.generate-font-manager--item .generate-font-manager--google-font-options{display:flex;flex-wrap:wrap;margin-top:15px}.generate-font-manager--item .generate-font-manager--google-font-options>div{flex-basis:calc(50% - 10px);margin-bottom:0}.generate-font-manager--item .generate-font-manager--google-font-options>div:nth-child(even){margin-left:5px}.generate-font-manager--item .generate-font-manager--google-font-options>div:nth-child(odd){margin-right:5px}.generate-font-manager--item .generate-font-manager--google-font-options .components-base-control__field{margin-bottom:0 !important}.generate-font-manager--item .generate-font-manager--select-options{display:flex;flex-wrap:wrap}.generate-font-manager--item .generate-font-manager--select-options>div{flex-basis:calc(50% - 5px)}.generate-font-manager--item .generate-font-manager--select-options>div:nth-child(even){margin-left:5px}.generate-font-manager--item .generate-font-manager--select-options>div:nth-child(odd){margin-right:5px}.generate-font-manager--item .components-select-control__input--generate-fontfamily{margin-bottom:3px}.generate-font-manager--item .generate-advanced-select__menu{position:relative !important}.generate-font-manager-group{margin-top:10px;margin-bottom:20px}.generate-font-manager-group__label{margin-top:0;color:#000;text-transform:uppercase;font-size:11px;margin-bottom:10px}.generate-font-manager-group .generate-font-manager--item:last-child{margin-bottom:0}.generate-customize-control--font-dropdown{background:#fff;padding:15px;margin-top:10px;position:relative}.generate-customize-control--font-dropdown:before{content:"";position:absolute;left:11px;top:-10px;width:0;height:0;border-style:solid;border-width:0 10px 10px 10px;border-color:transparent transparent #fff transparent;z-index:10}.generate-customize-control--font-dropdown>.components-base-control:not(:last-child){margin-bottom:15px}.generate-customize-control--font-dropdown>.components-base-control:last-child .components-base-control__field{margin-bottom:0}
|
||||
.generate-advanced-select__control{margin-bottom:12px}.generate-advanced-select__value-container{padding:0 6px !important}.generate-advanced-select__value-container>div{padding:0;margin:0}.generate-advanced-select__input input[type=text]:focus{box-shadow:none}.generate-advanced-select__option--is-selected{color:rgba(255,255,255,.5) !important}
|
||||
.components-generate-units-control-header__units{display:flex;justify-content:space-between;margin-bottom:5px;align-items:center}.components-generate-control__units .components-generate-control-buttons__units button.components-button{background:#fff;box-shadow:none !important;color:#929da7;font-size:10px;padding:0 5px;position:relative;text-align:center;text-shadow:none;border:0;border-radius:0 !important;line-height:20px;padding:0 5px;height:auto}.components-generate-control__units .components-generate-control-buttons__units button.components-button.is-primary{background:#fff !important;color:#000 !important;cursor:default;z-index:1;font-weight:bold}.generate-component-device-field[data-device=desktop],.generate-component-device-field[data-device=tablet],.generate-component-device-field[data-device=mobile]{display:none}.preview-desktop .generate-component-device-field[data-device=desktop]{display:block}.preview-desktop .components-generate-control__units button.components-generate-control-button__units--desktop{color:#000}.preview-tablet .generate-component-device-field[data-device=tablet]{display:block}.preview-tablet .components-generate-control__units button.components-generate-control-button__units--tablet{color:#000}.preview-mobile .generate-component-device-field[data-device=mobile]{display:block}.preview-mobile .components-generate-control__units button.components-generate-control-button__units--mobile{color:#000}
|
||||
.components-generate-range-control .components-generate-range-control--wrapper{display:flex;justify-content:space-between}.components-generate-range-control .components-generate-range-control--wrapper .components-generate-range-control--range{width:calc(100% - 80px)}.components-generate-range-control .components-generate-range-control--wrapper .components-generate-range-control-input{width:65px}.components-generate-range-control .components-base-control__help{margin-top:-8px;font-size:12px;font-style:normal;color:#757575}
|
||||
.components-generate--control__units{display:flex}.generate-component-input-with-unit{display:flex;align-items:center}.generate-component-input-with-unit>div:not(.components-generate--control__units){flex-grow:1}.generate-component-input-with-unit div{margin-bottom:0}.generate-component-input-with-unit .components-generate-range-control--range{max-height:30px}.generate-component-input-with-unit .components-generate-range-control-input input{max-height:30px}.generate-component-control--unit-picker button{height:auto;min-height:30px;margin-left:2px;border:1px solid #444;font-weight:500;font-size:11px;text-transform:uppercase;width:40px;justify-content:center}.components-generate--control-buttons__units{display:flex}.components-generate--control-buttons__units button.components-button{text-transform:uppercase;padding:10px;height:auto;line-height:normal;font-weight:500}
|
||||
.generate-color-manager-wrapper{display:flex;flex-wrap:wrap}.generate-color-manager-wrapper .generate-color-manager--item{position:relative;margin-right:5px;margin-bottom:5px}.generate-color-manager-wrapper .generate-color-manager--item:last-child{margin-right:0}.generate-color-manager-wrapper .generate-color-manager--item .components-button.generate-color-manager--delete-color{position:absolute;top:-10px;right:-10px;height:auto;min-width:0;padding:2px;background:rgba(0,0,0,.7);color:#fff;border-radius:100%;opacity:0;pointer-events:none;transition:opacity 500ms ease}.generate-color-manager-wrapper .generate-color-manager--item .components-button.generate-color-manager--delete-color svg{width:15px;height:15px;margin-right:0 !important}.generate-color-manager-wrapper .generate-color-manager--item:hover .components-button.generate-color-manager--delete-color{opacity:1;pointer-events:auto}.generate-color-manager-wrapper .generate-color-manager--item .components-button.generate-color-manager--delete-color:focus{opacity:1;pointer-events:auto}.generate-color-manager-wrapper .generate-color-manager--item .components-circular-option-picker__option-wrapper{margin:0}.generate-color-manager-wrapper .generate-color-manager--item .components-button.generate-color-manager--add-color{padding:0;width:28px;height:28px;display:flex;align-items:center;justify-content:center;border-radius:100%;background:#fff;border:1px solid #777}.generate-color-manager-wrapper .generate-color-manager--item .components-button.generate-color-manager--add-color svg{width:20px}
|
||||
.generate-customize-control-title{display:flex;justify-content:space-between}.generate-customize-control-title button.generate-customize-control-title--label{font-size:14px;font-weight:500;padding:0;height:auto}.generate-customize-control-title button.generate-customize-control-title--toggle{background:#fff;border-radius:100%;border:1px solid #777;padding:0;width:28px;height:28px;display:flex;justify-content:center;align-items:center}.generate-customize-control-title button.generate-customize-control-title--toggle svg{width:1em;height:1em;fill:none}.generate-customize-control-title h3{font-size:14px !important;font-weight:500;margin-bottom:0}
|
4
wp-content/themes/generatepress/assets/dist/style-dashboard.css
vendored
Normal file
4
wp-content/themes/generatepress/assets/dist/style-dashboard.css
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
.generate-dashboard-page .wrap{margin-right:0}.generate-dashboard-page #wpcontent{padding-left:0}.generate-dashboard-page .update-nag{margin-bottom:20px;margin-left:22px}.generate-dashboard-page.edit-php #wpbody-content .wrap{padding:0 20px;margin:0}.generatepress-dashboard-header{background:#fff;border-bottom:1px solid #e2e4e7;padding:0 20px;text-align:center;display:flex;justify-content:space-between;align-items:center}.generatepress-dashboard-header h1{font-size:17px;font-weight:600;padding-bottom:0;display:flex;align-items:center}.generatepress-dashboard-header h1 svg{width:1em;height:1em;padding-right:10px;fill:#006eb7}.generatepress-dashboard-header__navigation{background:#fff;display:flex}.generatepress-dashboard-header__navigation a{padding:1rem;display:flex;align-items:center;color:inherit;text-decoration:none}.generatepress-dashboard-header__navigation a.active{font-weight:600;box-shadow:inset 0 -3px #007cba}.generatepress-dashboard{max-width:1000px;margin:40px auto;font-size:15px}.generatepress-dashboard h2{font-size:25px;margin:0;line-height:1.2em}.generatepress-dashboard__placeholder.components-placeholder{outline:none;background:none;margin-bottom:50px;box-shadow:none;padding:0}.generatepress-dashboard__section-title{display:flex;align-items:center;margin-bottom:15px}.generatepress-dashboard__section-title>h2:first-child:not(:last-child){margin-right:10px}.generatepress-dashboard__section-description{margin-top:-10px;margin-bottom:20px}.generatepress-dashboard__section-description p{font-size:15px;margin:0}.generatepress-dashboard__section{color:#555;margin-bottom:50px}.generatepress-dashboard__section-item{padding:20px;background:#fff;display:flex;justify-content:space-between;align-items:center}.generatepress-dashboard__section-item:not(:last-child){border-bottom:1px solid #ddd}.generatepress-dashboard__section-item-title{font-weight:600}.generatepress-dashboard__section-item-action{padding-left:20px;display:flex;align-items:center}.generatepress-dashboard__section-item-action>*:not(:last-child){margin-right:10px}.generatepress-dashboard__section-item-action .is-primary .components-spinner{margin-top:0;background:#000}.generatepress-dashboard__section-item-description{font-size:13px;color:#80879a;margin-top:3px}.generatepress-dashboard__section-item-message{display:none;font-size:12px;color:#555;background:#fafafa;padding:5px 10px;border-radius:3px;box-shadow:1px 1px 1px rgba(0,0,0,.05)}.generatepress-dashboard__section-item-message__show{display:inline;color:green}.generatepress-dashboard__section-item-message__error{color:red}.generatepress-dashboard__reset-button.is-primary{background-color:#e02a2a}.generatepress-dashboard__reset-button.is-primary:hover:not(:disabled){background-color:darkred}@media(max-width: 768px){.generatepress-dashboard-header{flex-direction:column}.generatepress-dashboard{padding-left:20px;padding-right:20px}}
|
||||
.generatepress-start-customizing{display:flex;flex-wrap:wrap;margin-left:-30px;color:#555}.generatepress-start-customizing__item{padding:30px;background:#fff;margin-left:30px;margin-bottom:30px;width:calc(50% - 30px);box-sizing:border-box;box-shadow:0 0 2px rgba(0,0,0,.1)}.generatepress-start-customizing__icon{color:#fff;background:#1e72bd;height:50px;width:50px;display:flex;align-items:center;justify-content:center;border-radius:100%;margin-bottom:25px}.generatepress-start-customizing__title{font-weight:500;margin-bottom:1em}.generatepress-start-customizing__description{margin-bottom:1em;font-weight:300;line-height:1.5em}.generatepress-start-customizing__action{margin-top:auto}.generatepress-start-customizing__pro{font-size:11px;background:#f0544f;padding:0 5px;display:inline-block;margin-left:5px;color:#fff;border-radius:2px}
|
||||
.generatepress-dashboard__premium{display:flex;flex-wrap:wrap;margin-left:-30px;color:#555}.generatepress-dashboard__premium-item{padding:30px;background:#fff;margin-left:30px;margin-bottom:30px;width:calc(50% - 30px);box-sizing:border-box;box-shadow:0 0 2px rgba(0,0,0,.1);flex-grow:1}.generatepress-dashboard__premium-item-icon{color:#fff;background:#1e72bd;height:50px;width:50px;display:flex;align-items:center;justify-content:center;border-radius:100%;margin-bottom:25px}.generatepress-dashboard__premium-item-icon svg{width:25px;height:25px}.generatepress-dashboard__premium-item-title{font-weight:500;margin-bottom:10px;display:flex;align-items:center;font-size:17px}.generatepress-dashboard__premium-item-description{margin-bottom:1em;font-weight:300;line-height:1.5em}.generatepress-dashboard__premium-item-action{margin-top:auto}.generatepress-dashboard__premium-item-pro{font-size:11px;background:#f0544f;padding:0 5px;display:inline-block;margin-left:5px;color:#fff;border-radius:2px}
|
||||
.generatepress-dashboard__section-item-modules{margin-top:20px}
|
@ -1,127 +0,0 @@
|
||||
( function() {
|
||||
'use strict';
|
||||
|
||||
if ( 'querySelector' in document && 'addEventListener' in window ) {
|
||||
var body = document.body;
|
||||
|
||||
body.addEventListener( 'mousedown', function() {
|
||||
body.classList.add( 'using-mouse' );
|
||||
} );
|
||||
|
||||
body.addEventListener( 'keydown', function() {
|
||||
body.classList.remove( 'using-mouse' );
|
||||
} );
|
||||
|
||||
if ( body.classList.contains( 'dropdown-hover' ) ) {
|
||||
var navLinks = document.querySelectorAll( 'nav .main-nav ul a' ),
|
||||
menuBarItems = document.querySelectorAll( '.menu-bar-items .menu-bar-item > a' );
|
||||
|
||||
/**
|
||||
* Make menu items tab accessible when using the hover dropdown type
|
||||
*/
|
||||
var toggleFocus = function() {
|
||||
if ( this.closest( 'nav' ).classList.contains( 'toggled' ) || this.closest( 'nav' ).classList.contains( 'slideout-navigation' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
|
||||
while ( -1 === self.className.indexOf( 'main-nav' ) ) {
|
||||
if ( 'li' === self.tagName.toLowerCase() ) {
|
||||
self.classList.toggle( 'sfHover' );
|
||||
}
|
||||
|
||||
self = self.parentElement;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make our menu bar items tab accessible.
|
||||
*/
|
||||
var toggleMenuBarItemFocus = function() {
|
||||
if ( this.closest( 'nav' ).classList.contains( 'toggled' ) || this.closest( 'nav' ).classList.contains( 'slideout-navigation' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
|
||||
while ( -1 === self.className.indexOf( 'menu-bar-items' ) ) {
|
||||
if ( self.classList.contains( 'menu-bar-item' ) ) {
|
||||
self.classList.toggle( 'sfHover' );
|
||||
}
|
||||
|
||||
self = self.parentElement;
|
||||
}
|
||||
}
|
||||
|
||||
for ( var i = 0; i < navLinks.length; i++ ) {
|
||||
navLinks[i].addEventListener( 'focus', toggleFocus );
|
||||
navLinks[i].addEventListener( 'blur', toggleFocus );
|
||||
}
|
||||
|
||||
for ( var i = 0; i < menuBarItems.length; i++ ) {
|
||||
menuBarItems[i].addEventListener( 'focus', toggleMenuBarItemFocus );
|
||||
menuBarItems[i].addEventListener( 'blur', toggleMenuBarItemFocus );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make hover dropdown touch-friendly.
|
||||
*/
|
||||
if ( 'ontouchend' in document.documentElement && document.body.classList.contains( 'dropdown-hover' ) ) {
|
||||
var parentElements = document.querySelectorAll( '.sf-menu .menu-item-has-children' );
|
||||
|
||||
for ( var i = 0; i < parentElements.length; i++ ) {
|
||||
parentElements[i].addEventListener( 'touchend', function( e ) {
|
||||
|
||||
// Bail on mobile
|
||||
if ( this.closest( 'nav' ).classList.contains( 'toggled' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( e.touches.length === 1 || e.touches.length === 0 ) {
|
||||
// Prevent touch events within dropdown bubbling down to document
|
||||
e.stopPropagation();
|
||||
|
||||
// Toggle hover
|
||||
if ( ! this.classList.contains( 'sfHover' ) ) {
|
||||
// Prevent link on first touch
|
||||
if ( e.target === this || e.target.parentNode === this || e.target.parentNode.parentNode ) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
var getSiblings = function( elem ) {
|
||||
return Array.prototype.filter.call( elem.parentNode.children, function( sibling ) {
|
||||
return sibling !== elem;
|
||||
} );
|
||||
};
|
||||
|
||||
// Close other sub-menus.
|
||||
var closestLi = this.closest( 'li' ),
|
||||
siblings = getSiblings( closestLi );
|
||||
|
||||
for ( var i = 0; i < siblings.length; i++ ) {
|
||||
if ( siblings[i].classList.contains( 'sfHover' ) ) {
|
||||
siblings[i].classList.remove( 'sfHover' );
|
||||
}
|
||||
}
|
||||
|
||||
this.classList.add( 'sfHover' );
|
||||
|
||||
// Hide dropdown on touch outside
|
||||
var closeDropdown,
|
||||
thisItem = this;
|
||||
|
||||
document.addEventListener( 'touchend', closeDropdown = function(e) {
|
||||
e.stopPropagation();
|
||||
|
||||
thisItem.classList.remove( 'sfHover' );
|
||||
document.removeEventListener( 'touchend', closeDropdown );
|
||||
} );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
} )();
|
@ -1 +0,0 @@
|
||||
!function(){"use strict";if("querySelector"in document&&"addEventListener"in window){var e=document.body;if(e.addEventListener("mousedown",function(){e.classList.add("using-mouse")}),e.addEventListener("keydown",function(){e.classList.remove("using-mouse")}),e.classList.contains("dropdown-hover")){for(var t=document.querySelectorAll("nav .main-nav ul a"),s=document.querySelectorAll(".menu-bar-items .menu-bar-item > a"),n=function(){if(!this.closest("nav").classList.contains("toggled")&&!this.closest("nav").classList.contains("slideout-navigation"))for(var e=this;-1===e.className.indexOf("main-nav");)"li"===e.tagName.toLowerCase()&&e.classList.toggle("sfHover"),e=e.parentElement},o=function(){if(!this.closest("nav").classList.contains("toggled")&&!this.closest("nav").classList.contains("slideout-navigation"))for(var e=this;-1===e.className.indexOf("menu-bar-items");)e.classList.contains("menu-bar-item")&&e.classList.toggle("sfHover"),e=e.parentElement},i=0;i<t.length;i++)t[i].addEventListener("focus",n),t[i].addEventListener("blur",n);for(i=0;i<s.length;i++)s[i].addEventListener("focus",o),s[i].addEventListener("blur",o)}}if("ontouchend"in document.documentElement&&document.body.classList.contains("dropdown-hover"))for(var a=document.querySelectorAll(".sf-menu .menu-item-has-children"),i=0;i<a.length;i++)a[i].addEventListener("touchend",function(e){var t;if(!this.closest("nav").classList.contains("toggled")&&((1===e.touches.length||0===e.touches.length)&&(e.stopPropagation(),!this.classList.contains("sfHover")))){e.target!==this&&e.target.parentNode!==this&&!e.target.parentNode.parentNode||e.preventDefault();for(var s=this.closest("li"),n=(t=s,Array.prototype.filter.call(t.parentNode.children,function(e){return e!==t})),o=0;o<n.length;o++)n[o].classList.contains("sfHover")&&n[o].classList.remove("sfHover");this.classList.add("sfHover");var i,a=this;document.addEventListener("touchend",i=function(e){e.stopPropagation(),a.classList.remove("sfHover"),document.removeEventListener("touchend",i)})}})}();
|
@ -1,65 +1,67 @@
|
||||
( function() {
|
||||
'use strict';
|
||||
|
||||
// Feature Test
|
||||
if ( 'querySelector' in document && 'addEventListener' in window ) {
|
||||
|
||||
var goTopBtn = document.querySelector( '.generate-back-to-top' );
|
||||
|
||||
var trackScroll = function() {
|
||||
var scrolled = window.pageYOffset;
|
||||
var coords = goTopBtn.getAttribute( 'data-start-scroll' ) ;
|
||||
|
||||
if ( scrolled > coords ) {
|
||||
goTopBtn.style.opacity = '1';
|
||||
goTopBtn.style.visibility = 'visible';
|
||||
}
|
||||
|
||||
if (scrolled < coords) {
|
||||
goTopBtn.style.opacity = '0';
|
||||
goTopBtn.style.visibility = 'hidden';
|
||||
}
|
||||
};
|
||||
|
||||
// Function to animate the scroll
|
||||
var smoothScroll = function (anchor, duration) {
|
||||
// Calculate how far and how fast to scroll
|
||||
var startLocation = window.pageYOffset;
|
||||
var endLocation = document.body.offsetTop;
|
||||
var distance = endLocation - startLocation;
|
||||
var increments = distance/(duration/16);
|
||||
var stopAnimation;
|
||||
|
||||
// Scroll the page by an increment, and check if it's time to stop
|
||||
var animateScroll = function () {
|
||||
window.scrollBy(0, increments);
|
||||
stopAnimation();
|
||||
};
|
||||
|
||||
// Stop animation when you reach the anchor OR the top of the page
|
||||
stopAnimation = function () {
|
||||
var travelled = window.pageYOffset;
|
||||
if ( travelled <= (endLocation || 0) ) {
|
||||
clearInterval(runAnimation);
|
||||
document.activeElement.blur();
|
||||
}
|
||||
};
|
||||
|
||||
// Loop the animation function
|
||||
var runAnimation = setInterval(animateScroll, 16);
|
||||
};
|
||||
|
||||
if ( goTopBtn ) {
|
||||
// Show the button when scrolling down.
|
||||
window.addEventListener( 'scroll', trackScroll );
|
||||
|
||||
// Scroll back to top when clicked.
|
||||
goTopBtn.addEventListener( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
smoothScroll( document.body, goTopBtn.getAttribute( 'data-scroll-speed' ) || 400 );
|
||||
}, false );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} )();
|
||||
( function() {
|
||||
'use strict';
|
||||
|
||||
// Feature Test
|
||||
if ( 'querySelector' in document && 'addEventListener' in window ) {
|
||||
var goTopBtn = document.querySelector( '.generate-back-to-top' );
|
||||
|
||||
var trackScroll = function() {
|
||||
var scrolled = window.pageYOffset;
|
||||
var coords = goTopBtn.getAttribute( 'data-start-scroll' );
|
||||
|
||||
if ( scrolled > coords ) {
|
||||
goTopBtn.style.opacity = '1';
|
||||
goTopBtn.style.visibility = 'visible';
|
||||
}
|
||||
|
||||
if ( scrolled < coords ) {
|
||||
goTopBtn.style.opacity = '0';
|
||||
goTopBtn.style.visibility = 'hidden';
|
||||
}
|
||||
};
|
||||
|
||||
// Function to animate the scroll
|
||||
var smoothScroll = function( anchor, duration ) {
|
||||
// Calculate how far and how fast to scroll
|
||||
var startLocation = window.pageYOffset;
|
||||
var endLocation = document.body.offsetTop;
|
||||
var distance = endLocation - startLocation;
|
||||
var increments = distance / ( duration / 16 );
|
||||
var stopAnimation;
|
||||
|
||||
// Scroll the page by an increment, and check if it's time to stop
|
||||
var animateScroll = function() {
|
||||
window.scrollBy( 0, increments );
|
||||
stopAnimation();
|
||||
};
|
||||
|
||||
// Stop animation when you reach the anchor OR the top of the page
|
||||
stopAnimation = function() {
|
||||
var travelled = window.pageYOffset;
|
||||
if ( travelled <= ( endLocation || 0 ) ) {
|
||||
clearInterval( runAnimation );
|
||||
document.activeElement.blur();
|
||||
}
|
||||
};
|
||||
|
||||
// Loop the animation function
|
||||
var runAnimation = setInterval( animateScroll, 16 );
|
||||
};
|
||||
|
||||
if ( goTopBtn ) {
|
||||
// Show the button when scrolling down.
|
||||
window.addEventListener( 'scroll', trackScroll );
|
||||
|
||||
// Scroll back to top when clicked.
|
||||
goTopBtn.addEventListener( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
if ( generatepressBackToTop.smooth ) {
|
||||
smoothScroll( document.body, goTopBtn.getAttribute( 'data-scroll-speed' ) || 400 );
|
||||
} else {
|
||||
window.scrollTo( 0, 0 );
|
||||
}
|
||||
}, false );
|
||||
}
|
||||
}
|
||||
}() );
|
||||
|
@ -1 +1 @@
|
||||
!function(){"use strict";var l;"querySelector"in document&&"addEventListener"in window&&(l=document.querySelector(".generate-back-to-top"),l&&(window.addEventListener("scroll",function(){var t=window.pageYOffset,e=l.getAttribute("data-start-scroll");e<t&&(l.style.opacity="1",l.style.visibility="visible"),t<e&&(l.style.opacity="0",l.style.visibility="hidden")}),l.addEventListener("click",function(t){var e,n,i,o,c,d;t.preventDefault(),document.body,e=l.getAttribute("data-scroll-speed")||400,n=window.pageYOffset,i=document.body.offsetTop,o=(i-n)/(e/16),c=function(){window.pageYOffset<=(i||0)&&(clearInterval(d),document.activeElement.blur())},d=setInterval(function(){window.scrollBy(0,o),c()},16)},!1)))}();
|
||||
!function(){"use strict";var s;"querySelector"in document&&"addEventListener"in window&&(s=document.querySelector(".generate-back-to-top"),s&&(window.addEventListener("scroll",function(){var e=window.pageYOffset,t=s.getAttribute("data-start-scroll");t<e&&(s.style.opacity="1",s.style.visibility="visible"),e<t&&(s.style.opacity="0",s.style.visibility="hidden")}),s.addEventListener("click",function(e){var t,n,o,i,r;e.preventDefault(),generatepressBackToTop.smooth?(document.body,t=s.getAttribute("data-scroll-speed")||400,e=window.pageYOffset,n=document.body.offsetTop,o=(n-e)/(t/16),i=function(){window.pageYOffset<=(n||0)&&(clearInterval(r),document.activeElement.blur())},r=setInterval(function(){window.scrollBy(0,o),i()},16)):window.scrollTo(0,0)},!1)))}();
|
@ -1,124 +1,123 @@
|
||||
( function() {
|
||||
'use strict';
|
||||
|
||||
if ( 'querySelector' in document && 'addEventListener' in window ) {
|
||||
var body = document.body;
|
||||
/**
|
||||
* Dropdown click
|
||||
*
|
||||
* @param e The event.
|
||||
* @param _this The clicked item.
|
||||
*/
|
||||
var dropdownClick = function( e, _this ) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
if ( ! _this ) {
|
||||
var _this = this;
|
||||
}
|
||||
|
||||
var closestLi = _this.closest( 'li' );
|
||||
|
||||
// Close other sub-menus
|
||||
var openedSubMenus = _this.closest( 'nav' ).querySelectorAll( 'ul.toggled-on' );
|
||||
if ( openedSubMenus && ! _this.closest( 'ul' ).classList.contains( 'toggled-on' ) && ! _this.closest( 'li' ).classList.contains( 'sfHover' ) ) {
|
||||
for ( var o = 0; o < openedSubMenus.length; o++ ) {
|
||||
openedSubMenus[o].classList.remove( 'toggled-on' );
|
||||
openedSubMenus[o].closest( 'li' ).classList.remove( 'sfHover' );
|
||||
}
|
||||
}
|
||||
|
||||
// Add sfHover class to parent li
|
||||
closestLi.classList.toggle( 'sfHover' );
|
||||
|
||||
// Set aria-expanded on arrow
|
||||
var dropdownToggle = closestLi.querySelector( '.dropdown-menu-toggle' );
|
||||
if ( 'false' === dropdownToggle.getAttribute( 'aria-expanded' ) || ! dropdownToggle.getAttribute( 'aria-expanded' ) ) {
|
||||
dropdownToggle.setAttribute( 'aria-expanded', 'true' );
|
||||
} else {
|
||||
dropdownToggle.setAttribute( 'aria-expanded', 'false' );
|
||||
}
|
||||
|
||||
if ( closestLi.querySelector( '.sub-menu' ) ) {
|
||||
var subMenuSelector = '.sub-menu';
|
||||
} else {
|
||||
var subMenuSelector = '.children';
|
||||
}
|
||||
|
||||
// Open the sub-menu
|
||||
if ( body.classList.contains( 'dropdown-click-menu-item' ) ) {
|
||||
_this.parentNode.querySelector( subMenuSelector ).classList.toggle( 'toggled-on' );
|
||||
} else if ( body.classList.contains( 'dropdown-click-arrow' ) ) {
|
||||
closestLi.querySelector( subMenuSelector ).classList.toggle( 'toggled-on' );
|
||||
}
|
||||
}
|
||||
|
||||
// Do stuff if click dropdown if enabled
|
||||
var parentElementLinks = document.querySelectorAll( '.main-nav .menu-item-has-children > a' );
|
||||
|
||||
// Open the sub-menu by clicking on the entire link element
|
||||
if ( body.classList.contains( 'dropdown-click-menu-item' ) ) {
|
||||
for ( var i = 0; i < parentElementLinks.length; i++ ) {
|
||||
parentElementLinks[i].addEventListener( 'click', dropdownClick, true );
|
||||
}
|
||||
}
|
||||
|
||||
// Open the sub-menu by clicking on a dropdown arrow
|
||||
if ( body.classList.contains( 'dropdown-click-arrow' ) ) {
|
||||
// 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++ ) {
|
||||
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' );
|
||||
}
|
||||
}
|
||||
|
||||
var dropdownToggleLinks = document.querySelectorAll( '.main-nav .menu-item-has-children > a .dropdown-menu-toggle' );
|
||||
for ( var i = 0; i < dropdownToggleLinks.length; i++ ) {
|
||||
dropdownToggleLinks[i].addEventListener( 'click', dropdownClick, false );
|
||||
|
||||
dropdownToggleLinks[i].addEventListener( 'keydown', function( e ) {
|
||||
var _this = this;
|
||||
var key = e.which || e.keyCode;
|
||||
if ( key === 13 ) { // 13 is enter
|
||||
dropdownClick( e, _this );
|
||||
}
|
||||
}, false );
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
var closeSubMenus = function() {
|
||||
if ( document.querySelector( 'nav ul .toggled-on' ) ) {
|
||||
var activeSubMenus = document.querySelectorAll( 'nav ul .toggled-on' );
|
||||
var activeDropdownToggles = document.querySelectorAll( 'nav .dropdown-menu-toggle' );
|
||||
for ( var i = 0; i < activeSubMenus.length; i++ ) {
|
||||
activeSubMenus[i].classList.remove( 'toggled-on' );
|
||||
activeSubMenus[i].closest( '.sfHover' ).classList.remove( 'sfHover' );
|
||||
}
|
||||
|
||||
for ( var i = 0; i < activeDropdownToggles.length; i++ ) {
|
||||
activeDropdownToggles[i].setAttribute( 'aria-expanded', 'false' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Close sub-menus when clicking elsewhere
|
||||
document.addEventListener( 'click', function ( event ) {
|
||||
if ( ! event.target.closest( '.sfHover' ) ) {
|
||||
closeSubMenus();
|
||||
}
|
||||
}, false);
|
||||
|
||||
// Close sub-menus on escape key
|
||||
document.addEventListener( 'keydown', function( e ) {
|
||||
var key = e.which || e.keyCode;
|
||||
if ( key === 27 ) { // 27 is esc
|
||||
closeSubMenus();
|
||||
}
|
||||
}, false );
|
||||
}
|
||||
|
||||
})();
|
||||
( function() {
|
||||
'use strict';
|
||||
|
||||
if ( 'querySelector' in document && 'addEventListener' in window ) {
|
||||
var body = document.body,
|
||||
i;
|
||||
/**
|
||||
* Dropdown click
|
||||
*
|
||||
* @param {Object} e The event.
|
||||
* @param {Object} _this The clicked item.
|
||||
*/
|
||||
var dropdownClick = function( e, _this ) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
if ( ! _this ) {
|
||||
_this = this;
|
||||
}
|
||||
|
||||
var closestLi = _this.closest( 'li' );
|
||||
|
||||
// Close other sub-menus
|
||||
var openedSubMenus = _this.closest( 'nav' ).querySelectorAll( 'ul.toggled-on' );
|
||||
if ( openedSubMenus && ! _this.closest( 'ul' ).classList.contains( 'toggled-on' ) && ! _this.closest( 'li' ).classList.contains( 'sfHover' ) ) {
|
||||
for ( var o = 0; o < openedSubMenus.length; o++ ) {
|
||||
openedSubMenus[ o ].classList.remove( 'toggled-on' );
|
||||
openedSubMenus[ o ].closest( 'li' ).classList.remove( 'sfHover' );
|
||||
}
|
||||
}
|
||||
|
||||
// Add sfHover class to parent li
|
||||
closestLi.classList.toggle( 'sfHover' );
|
||||
|
||||
// Set aria-expanded on arrow
|
||||
var dropdownToggle = closestLi.querySelector( '.dropdown-menu-toggle' );
|
||||
if ( 'false' === dropdownToggle.getAttribute( 'aria-expanded' ) || ! dropdownToggle.getAttribute( 'aria-expanded' ) ) {
|
||||
dropdownToggle.setAttribute( 'aria-expanded', 'true' );
|
||||
} else {
|
||||
dropdownToggle.setAttribute( 'aria-expanded', 'false' );
|
||||
}
|
||||
|
||||
if ( closestLi.querySelector( '.sub-menu' ) ) {
|
||||
var subMenuSelector = '.sub-menu';
|
||||
} else {
|
||||
subMenuSelector = '.children';
|
||||
}
|
||||
|
||||
// Open the sub-menu
|
||||
if ( body.classList.contains( 'dropdown-click-menu-item' ) ) {
|
||||
_this.parentNode.querySelector( subMenuSelector ).classList.toggle( 'toggled-on' );
|
||||
} else if ( body.classList.contains( 'dropdown-click-arrow' ) ) {
|
||||
closestLi.querySelector( subMenuSelector ).classList.toggle( 'toggled-on' );
|
||||
}
|
||||
};
|
||||
|
||||
// Do stuff if click dropdown if enabled
|
||||
var parentElementLinks = document.querySelectorAll( '.main-nav .menu-item-has-children > a' );
|
||||
|
||||
// Open the sub-menu by clicking on the entire link element
|
||||
if ( body.classList.contains( 'dropdown-click-menu-item' ) ) {
|
||||
for ( i = 0; i < parentElementLinks.length; i++ ) {
|
||||
parentElementLinks[ i ].addEventListener( 'click', dropdownClick, true );
|
||||
}
|
||||
}
|
||||
|
||||
// Open the sub-menu by clicking on a dropdown arrow
|
||||
if ( body.classList.contains( 'dropdown-click-arrow' ) ) {
|
||||
// Add a class to sub-menu items that are set to #
|
||||
for ( 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' ) ) {
|
||||
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' );
|
||||
for ( i = 0; i < dropdownToggleLinks.length; i++ ) {
|
||||
dropdownToggleLinks[ i ].addEventListener( 'click', dropdownClick, false );
|
||||
|
||||
dropdownToggleLinks[ i ].addEventListener( 'keydown', function( e ) {
|
||||
var _this = this;
|
||||
|
||||
if ( 'Enter' === e.key ) {
|
||||
dropdownClick( e, _this );
|
||||
}
|
||||
}, false );
|
||||
}
|
||||
|
||||
for ( 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 );
|
||||
}
|
||||
}
|
||||
|
||||
var closeSubMenus = function() {
|
||||
if ( document.querySelector( 'nav ul .toggled-on' ) ) {
|
||||
var activeSubMenus = document.querySelectorAll( 'nav ul .toggled-on' );
|
||||
var activeDropdownToggles = document.querySelectorAll( 'nav .dropdown-menu-toggle' );
|
||||
for ( i = 0; i < activeSubMenus.length; i++ ) {
|
||||
activeSubMenus[ i ].classList.remove( 'toggled-on' );
|
||||
activeSubMenus[ i ].closest( '.sfHover' ).classList.remove( 'sfHover' );
|
||||
}
|
||||
|
||||
for ( i = 0; i < activeDropdownToggles.length; i++ ) {
|
||||
activeDropdownToggles[ i ].setAttribute( 'aria-expanded', 'false' );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Close sub-menus when clicking elsewhere
|
||||
document.addEventListener( 'click', function( event ) {
|
||||
if ( ! event.target.closest( '.sfHover' ) ) {
|
||||
closeSubMenus();
|
||||
}
|
||||
}, false );
|
||||
|
||||
// Close sub-menus on escape key
|
||||
document.addEventListener( 'keydown', function( e ) {
|
||||
if ( 'Escape' === e.key ) { // 27 is esc
|
||||
closeSubMenus();
|
||||
}
|
||||
}, false );
|
||||
}
|
||||
}() );
|
||||
|
@ -1 +1 @@
|
||||
!function(){"use strict";if("querySelector"in document&&"addEventListener"in window){var c=document.body,t=function(e,t){e.preventDefault(),e.stopPropagation();var n=(t=t||this).closest("li"),o=t.closest("nav").querySelectorAll("ul.toggled-on");if(o&&!t.closest("ul").classList.contains("toggled-on")&&!t.closest("li").classList.contains("sfHover"))for(var l=0;l<o.length;l++)o[l].classList.remove("toggled-on"),o[l].closest("li").classList.remove("sfHover");n.classList.toggle("sfHover");var r,i=n.querySelector(".dropdown-menu-toggle");"false"!==i.getAttribute("aria-expanded")&&i.getAttribute("aria-expanded")?i.setAttribute("aria-expanded","false"):i.setAttribute("aria-expanded","true"),r=n.querySelector(".sub-menu")?".sub-menu":".children",c.classList.contains("dropdown-click-menu-item")?t.parentNode.querySelector(r).classList.toggle("toggled-on"):c.classList.contains("dropdown-click-arrow")&&n.querySelector(r).classList.toggle("toggled-on")},e=document.querySelectorAll(".main-nav .menu-item-has-children > a");if(c.classList.contains("dropdown-click-menu-item"))for(var n=0;n<e.length;n++)e[n].addEventListener("click",t,!0);if(c.classList.contains("dropdown-click-arrow")){for(n=0;n<document.querySelectorAll(".main-nav .menu-item-has-children > a").length;n++)"#"==document.querySelectorAll(".main-nav .menu-item-has-children > a")[n].getAttribute("href")&&document.querySelectorAll(".main-nav .menu-item-has-children > a")[n].classList.add("menu-item-dropdown-click");for(var o=document.querySelectorAll(".main-nav .menu-item-has-children > a .dropdown-menu-toggle"),n=0;n<o.length;n++)o[n].addEventListener("click",t,!1),o[n].addEventListener("keydown",function(e){13===(e.which||e.keyCode)&&t(e,this)},!1);for(n=0;n<document.querySelectorAll(".main-nav .menu-item-has-children > a.menu-item-dropdown-click").length;n++)document.querySelectorAll(".main-nav .menu-item-has-children > a.menu-item-dropdown-click")[n].addEventListener("click",t,!1)}var l=function(){if(document.querySelector("nav ul .toggled-on")){for(var e=document.querySelectorAll("nav ul .toggled-on"),t=document.querySelectorAll("nav .dropdown-menu-toggle"),n=0;n<e.length;n++)e[n].classList.remove("toggled-on"),e[n].closest(".sfHover").classList.remove("sfHover");for(n=0;n<t.length;n++)t[n].setAttribute("aria-expanded","false")}};document.addEventListener("click",function(e){e.target.closest(".sfHover")||l()},!1),document.addEventListener("keydown",function(e){27===(e.which||e.keyCode)&&l()},!1)}}();
|
||||
!function(){"use strict";if("querySelector"in document&&"addEventListener"in window){var r=document.body,t=function(e,t){e.preventDefault(),e.stopPropagation();var n=(t=t||this).closest("li"),o=t.closest("nav").querySelectorAll("ul.toggled-on");if(o&&!t.closest("ul").classList.contains("toggled-on")&&!t.closest("li").classList.contains("sfHover"))for(var l=0;l<o.length;l++)o[l].classList.remove("toggled-on"),o[l].closest("li").classList.remove("sfHover");n.classList.toggle("sfHover");e=n.querySelector(".dropdown-menu-toggle");"false"!==e.getAttribute("aria-expanded")&&e.getAttribute("aria-expanded")?e.setAttribute("aria-expanded","false"):e.setAttribute("aria-expanded","true"),e=n.querySelector(".sub-menu")?".sub-menu":".children",r.classList.contains("dropdown-click-menu-item")?t.parentNode.querySelector(e).classList.toggle("toggled-on"):r.classList.contains("dropdown-click-arrow")&&n.querySelector(e).classList.toggle("toggled-on")},e=document.querySelectorAll(".main-nav .menu-item-has-children > a");if(r.classList.contains("dropdown-click-menu-item"))for(o=0;o<e.length;o++)e[o].addEventListener("click",t,!0);if(r.classList.contains("dropdown-click-arrow")){for(o=0;o<document.querySelectorAll(".main-nav .menu-item-has-children > a").length;o++)"#"===document.querySelectorAll(".main-nav .menu-item-has-children > a")[o].getAttribute("href")&&document.querySelectorAll(".main-nav .menu-item-has-children > a")[o].classList.add("menu-item-dropdown-click");for(var n=document.querySelectorAll(".main-nav .menu-item-has-children > a .dropdown-menu-toggle"),o=0;o<n.length;o++)n[o].addEventListener("click",t,!1),n[o].addEventListener("keydown",function(e){"Enter"===e.key&&t(e,this)},!1);for(o=0;o<document.querySelectorAll(".main-nav .menu-item-has-children > a.menu-item-dropdown-click").length;o++)document.querySelectorAll(".main-nav .menu-item-has-children > a.menu-item-dropdown-click")[o].addEventListener("click",t,!1)}var l=function(){if(document.querySelector("nav ul .toggled-on")){var e=document.querySelectorAll("nav ul .toggled-on"),t=document.querySelectorAll("nav .dropdown-menu-toggle");for(o=0;o<e.length;o++)e[o].classList.remove("toggled-on"),e[o].closest(".sfHover").classList.remove("sfHover");for(o=0;o<t.length;o++)t[o].setAttribute("aria-expanded","false")}};document.addEventListener("click",function(e){e.target.closest(".sfHover")||l()},!1),document.addEventListener("keydown",function(e){"Escape"===e.key&&l()},!1)}}();
|
@ -1,430 +0,0 @@
|
||||
( function() {
|
||||
'use strict';
|
||||
|
||||
if ( 'querySelector' in document && 'addEventListener' in window ) {
|
||||
/**
|
||||
* matches() pollyfil
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Browser_compatibility
|
||||
*/
|
||||
if ( ! Element.prototype.matches ) {
|
||||
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
||||
}
|
||||
|
||||
/**
|
||||
* closest() pollyfil
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Browser_compatibility
|
||||
*/
|
||||
if ( ! Element.prototype.closest ) {
|
||||
Element.prototype.closest = function( s ) {
|
||||
var el = this;
|
||||
var ancestor = this;
|
||||
if ( ! document.documentElement.contains( el ) ) {
|
||||
return null;
|
||||
}
|
||||
do {
|
||||
if ( ancestor.matches( s ) ) {
|
||||
return ancestor;
|
||||
}
|
||||
ancestor = ancestor.parentElement;
|
||||
} while ( ancestor !== null );
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
var getSiblings = function( elem ) {
|
||||
return Array.prototype.filter.call( elem.parentNode.children, function( sibling ) {
|
||||
return sibling !== elem;
|
||||
} );
|
||||
};
|
||||
|
||||
var allNavToggles = document.querySelectorAll( '.menu-toggle' ),
|
||||
dropdownToggle = document.querySelectorAll( 'nav .dropdown-menu-toggle' ),
|
||||
navLinks = document.querySelectorAll( 'nav ul a' ),
|
||||
mobileMenuControls = document.querySelector( '.mobile-menu-control-wrapper' ),
|
||||
body = document.body,
|
||||
htmlEl = document.documentElement;
|
||||
|
||||
var enableDropdownArrows = function( nav ) {
|
||||
if ( body.classList.contains( 'dropdown-hover' ) ) {
|
||||
var dropdownItems = nav.querySelectorAll( 'li.menu-item-has-children' );
|
||||
|
||||
for ( var i = 0; i < dropdownItems.length; i++ ) {
|
||||
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( 'aria-expanded', 'false' );
|
||||
dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'aria-label', generatepressMenu.openSubMenuLabel );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var disableDropdownArrows = function( nav ) {
|
||||
if ( body.classList.contains( 'dropdown-hover' ) ) {
|
||||
var dropdownItems = nav.querySelectorAll( 'li.menu-item-has-children' );
|
||||
|
||||
for ( var i = 0; i < dropdownItems.length; i++ ) {
|
||||
dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).removeAttribute( 'tabindex' );
|
||||
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-label' );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var setDropdownArrowAttributes = function( arrow ) {
|
||||
if ( 'false' === arrow.getAttribute( 'aria-expanded' ) || ! arrow.getAttribute( 'aria-expanded' ) ) {
|
||||
arrow.setAttribute( 'aria-expanded', 'true' );
|
||||
arrow.setAttribute( 'aria-label', generatepressMenu.closeSubMenuLabel );
|
||||
} else {
|
||||
arrow.setAttribute( 'aria-expanded', 'false' );
|
||||
arrow.setAttribute( 'aria-label', generatepressMenu.openSubMenuLabel );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Start mobile menu toggle.
|
||||
*
|
||||
* @param e The event.
|
||||
* @param _this The clicked item.
|
||||
*/
|
||||
var toggleNav = function( e, _this ) {
|
||||
if ( ! _this ) {
|
||||
var _this = this;
|
||||
}
|
||||
|
||||
var parentContainer = '';
|
||||
|
||||
if ( _this.getAttribute( 'data-nav' ) ) {
|
||||
parentContainer = document.getElementById( _this.getAttribute( 'data-nav' ) );
|
||||
} else {
|
||||
parentContainer = document.getElementById( _this.closest( 'nav' ).getAttribute( 'id' ) );
|
||||
}
|
||||
|
||||
if ( ! parentContainer ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var isExternalToggle = false;
|
||||
|
||||
if ( _this.closest( '.mobile-menu-control-wrapper' ) ) {
|
||||
isExternalToggle = true;
|
||||
}
|
||||
|
||||
var nav = parentContainer.getElementsByTagName( 'ul' )[0];
|
||||
|
||||
if ( parentContainer.classList.contains( 'toggled' ) ) {
|
||||
parentContainer.classList.remove( 'toggled' );
|
||||
htmlEl.classList.remove( 'mobile-menu-open' );
|
||||
nav.setAttribute( 'aria-hidden', 'true' );
|
||||
_this.setAttribute( 'aria-expanded', 'false' );
|
||||
|
||||
if ( isExternalToggle ) {
|
||||
mobileMenuControls.classList.remove( 'toggled' );
|
||||
} else if ( mobileMenuControls && parentContainer.classList.contains( 'main-navigation' ) ) {
|
||||
mobileMenuControls.classList.remove( 'toggled' );
|
||||
}
|
||||
|
||||
disableDropdownArrows( nav );
|
||||
} else {
|
||||
parentContainer.classList.add( 'toggled' );
|
||||
htmlEl.classList.add( 'mobile-menu-open' );
|
||||
nav.setAttribute( 'aria-hidden', 'false' );
|
||||
_this.setAttribute( 'aria-expanded', 'true' );
|
||||
|
||||
if ( isExternalToggle ) {
|
||||
mobileMenuControls.classList.add( 'toggled' );
|
||||
|
||||
if ( mobileMenuControls.querySelector( '.search-item' ) ) {
|
||||
if ( mobileMenuControls.querySelector( '.search-item' ).classList.contains( 'active' ) ) {
|
||||
mobileMenuControls.querySelector( '.search-item' ).click();
|
||||
}
|
||||
}
|
||||
} else if ( mobileMenuControls && parentContainer.classList.contains( 'main-navigation' ) ) {
|
||||
mobileMenuControls.classList.add( 'toggled' );
|
||||
}
|
||||
|
||||
enableDropdownArrows( nav );
|
||||
}
|
||||
}
|
||||
|
||||
for ( var i = 0; i < allNavToggles.length; i++ ) {
|
||||
allNavToggles[i].addEventListener( 'click', toggleNav, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Open sub-menus
|
||||
*
|
||||
* @param e The event.
|
||||
* @param _this The clicked item.
|
||||
*/
|
||||
var toggleSubNav = function( e, _this ) {
|
||||
|
||||
if ( ! _this ) {
|
||||
var _this = this;
|
||||
}
|
||||
|
||||
if ( ( _this.closest( 'nav' ).classList.contains( 'toggled' ) || htmlEl.classList.contains( 'slide-opened' ) ) && ! body.classList.contains( 'dropdown-click' ) ) {
|
||||
e.preventDefault();
|
||||
var closestLi = _this.closest( 'li' );
|
||||
|
||||
setDropdownArrowAttributes( closestLi.querySelector( '.dropdown-menu-toggle' ) );
|
||||
|
||||
if ( closestLi.querySelector( '.sub-menu' ) ) {
|
||||
var subMenu = closestLi.querySelector( '.sub-menu' );
|
||||
} else {
|
||||
var subMenu = closestLi.querySelector( '.children' );
|
||||
}
|
||||
|
||||
if ( generatepressMenu.toggleOpenedSubMenus ) {
|
||||
var siblings = getSiblings( closestLi );
|
||||
|
||||
for ( var i = 0; i < siblings.length; i++ ) {
|
||||
if ( siblings[i].classList.contains( 'sfHover' ) ) {
|
||||
siblings[i].classList.remove( 'sfHover' );
|
||||
siblings[i].querySelector( '.toggled-on' ).classList.remove( 'toggled-on' );
|
||||
setDropdownArrowAttributes( siblings[i].querySelector( '.dropdown-menu-toggle' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closestLi.classList.toggle( 'sfHover' );
|
||||
subMenu.classList.toggle( 'toggled-on' );
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
for ( var i = 0; i < dropdownToggle.length; i++ ) {
|
||||
dropdownToggle[i].addEventListener( 'click', toggleSubNav, false );
|
||||
dropdownToggle[i].addEventListener( 'keypress', function( e ) {
|
||||
var key = e.which || e.keyCode;
|
||||
if (key === 13) { // 13 is enter
|
||||
toggleSubNav( e, this );
|
||||
}
|
||||
}, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the mobile menu if our toggle isn't visible.
|
||||
* Makes it possible to style mobile item with .toggled class.
|
||||
*/
|
||||
var checkMobile = function() {
|
||||
var openedMobileMenus = document.querySelectorAll( '.toggled, .has-active-search' );
|
||||
|
||||
for ( var i = 0; i < openedMobileMenus.length; i++ ) {
|
||||
var menuToggle = openedMobileMenus[i].querySelector( '.menu-toggle' );
|
||||
|
||||
if ( mobileMenuControls && ! menuToggle.closest( 'nav' ).classList.contains( 'mobile-menu-control-wrapper' ) ) {
|
||||
menuToggle = mobileMenuControls.querySelector( '.menu-toggle' );
|
||||
}
|
||||
|
||||
if ( menuToggle && menuToggle.offsetParent === null ) {
|
||||
if ( openedMobileMenus[i].classList.contains( 'toggled' ) ) {
|
||||
var remoteNav = false;
|
||||
|
||||
if ( openedMobileMenus[i].classList.contains( 'mobile-menu-control-wrapper' ) ) {
|
||||
remoteNav = true;
|
||||
}
|
||||
|
||||
if ( ! remoteNav ) {
|
||||
// Navigation is toggled, but .menu-toggle isn't visible on the page (display: none).
|
||||
var closestNav = openedMobileMenus[i].getElementsByTagName( 'ul' )[ 0 ],
|
||||
closestNavItems = closestNav.getElementsByTagName( 'li' ),
|
||||
closestSubMenus = closestNav.getElementsByTagName( 'ul' );
|
||||
}
|
||||
|
||||
document.activeElement.blur();
|
||||
openedMobileMenus[i].classList.remove( 'toggled' );
|
||||
|
||||
htmlEl.classList.remove( 'mobile-menu-open' );
|
||||
menuToggle.setAttribute( 'aria-expanded', 'false' );
|
||||
|
||||
if ( ! remoteNav ) {
|
||||
for ( var li = 0; li < closestNavItems.length; li++ ) {
|
||||
closestNavItems[li].classList.remove( 'sfHover' );
|
||||
}
|
||||
|
||||
for ( var sm = 0; sm < closestSubMenus.length; sm++ ) {
|
||||
closestSubMenus[sm].classList.remove( 'toggled-on' );
|
||||
}
|
||||
|
||||
if ( closestNav ) {
|
||||
closestNav.removeAttribute( 'aria-hidden' );
|
||||
}
|
||||
}
|
||||
|
||||
disableDropdownArrows( openedMobileMenus[i] );
|
||||
}
|
||||
|
||||
if ( mobileMenuControls.querySelector( '.search-item' ) ) {
|
||||
if ( mobileMenuControls.querySelector( '.search-item' ).classList.contains( 'active' ) ) {
|
||||
mobileMenuControls.querySelector( '.search-item' ).click();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
window.addEventListener( 'resize', checkMobile, false );
|
||||
window.addEventListener( 'orientationchange', checkMobile, false );
|
||||
|
||||
if ( body.classList.contains( 'dropdown-hover' ) ) {
|
||||
/**
|
||||
* Do some essential things when menu items are clicked.
|
||||
*/
|
||||
for ( var i = 0; i < navLinks.length; i++ ) {
|
||||
navLinks[i].addEventListener( 'click', function( e ) {
|
||||
// Remove sfHover class if we're going to another site.
|
||||
if ( this.hostname !== window.location.hostname ) {
|
||||
document.activeElement.blur();
|
||||
}
|
||||
|
||||
var closest_nav = this.closest( 'nav' );
|
||||
if ( closest_nav.classList.contains( 'toggled' ) || htmlEl.classList.contains( 'slide-opened' ) ) {
|
||||
var url = this.getAttribute( 'href' );
|
||||
|
||||
// Open the sub-menu if the link has no destination
|
||||
if ( '#' == url || '' == url ) {
|
||||
e.preventDefault();
|
||||
var closestLi = this.closest( 'li' );
|
||||
closestLi.classList.toggle( 'sfHover' );
|
||||
var subMenu = closestLi.querySelector( '.sub-menu' );
|
||||
|
||||
if ( subMenu ) {
|
||||
subMenu.classList.toggle( 'toggled-on' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}, false );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
( function() {
|
||||
'use strict';
|
||||
|
||||
if ( 'querySelector' in document && 'addEventListener' in window ) {
|
||||
var body = document.body;
|
||||
|
||||
body.addEventListener( 'mousedown', function() {
|
||||
body.classList.add( 'using-mouse' );
|
||||
} );
|
||||
|
||||
body.addEventListener( 'keydown', function() {
|
||||
body.classList.remove( 'using-mouse' );
|
||||
} );
|
||||
|
||||
if ( body.classList.contains( 'dropdown-hover' ) ) {
|
||||
var navLinks = document.querySelectorAll( 'nav .main-nav ul a' ),
|
||||
menuBarItems = document.querySelectorAll( '.menu-bar-items .menu-bar-item > a' );
|
||||
|
||||
/**
|
||||
* Make menu items tab accessible when using the hover dropdown type
|
||||
*/
|
||||
var toggleFocus = function() {
|
||||
if ( this.closest( 'nav' ).classList.contains( 'toggled' ) || this.closest( 'nav' ).classList.contains( 'slideout-navigation' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
|
||||
while ( -1 === self.className.indexOf( 'main-nav' ) ) {
|
||||
if ( 'li' === self.tagName.toLowerCase() ) {
|
||||
self.classList.toggle( 'sfHover' );
|
||||
}
|
||||
|
||||
self = self.parentElement;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make our menu bar items tab accessible.
|
||||
*/
|
||||
var toggleMenuBarItemFocus = function() {
|
||||
if ( this.closest( 'nav' ).classList.contains( 'toggled' ) || this.closest( 'nav' ).classList.contains( 'slideout-navigation' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
|
||||
while ( -1 === self.className.indexOf( 'menu-bar-items' ) ) {
|
||||
if ( self.classList.contains( 'menu-bar-item' ) ) {
|
||||
self.classList.toggle( 'sfHover' );
|
||||
}
|
||||
|
||||
self = self.parentElement;
|
||||
}
|
||||
}
|
||||
|
||||
for ( var i = 0; i < navLinks.length; i++ ) {
|
||||
navLinks[i].addEventListener( 'focus', toggleFocus );
|
||||
navLinks[i].addEventListener( 'blur', toggleFocus );
|
||||
}
|
||||
|
||||
for ( var i = 0; i < menuBarItems.length; i++ ) {
|
||||
menuBarItems[i].addEventListener( 'focus', toggleMenuBarItemFocus );
|
||||
menuBarItems[i].addEventListener( 'blur', toggleMenuBarItemFocus );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make hover dropdown touch-friendly.
|
||||
*/
|
||||
if ( 'ontouchend' in document.documentElement && document.body.classList.contains( 'dropdown-hover' ) ) {
|
||||
var parentElements = document.querySelectorAll( '.sf-menu .menu-item-has-children' );
|
||||
|
||||
for ( var i = 0; i < parentElements.length; i++ ) {
|
||||
parentElements[i].addEventListener( 'touchend', function( e ) {
|
||||
|
||||
// Bail on mobile
|
||||
if ( this.closest( 'nav' ).classList.contains( 'toggled' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( e.touches.length === 1 || e.touches.length === 0 ) {
|
||||
// Prevent touch events within dropdown bubbling down to document
|
||||
e.stopPropagation();
|
||||
|
||||
// Toggle hover
|
||||
if ( ! this.classList.contains( 'sfHover' ) ) {
|
||||
// Prevent link on first touch
|
||||
if ( e.target === this || e.target.parentNode === this || e.target.parentNode.parentNode ) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
var getSiblings = function( elem ) {
|
||||
return Array.prototype.filter.call( elem.parentNode.children, function( sibling ) {
|
||||
return sibling !== elem;
|
||||
} );
|
||||
};
|
||||
|
||||
// Close other sub-menus.
|
||||
var closestLi = this.closest( 'li' ),
|
||||
siblings = getSiblings( closestLi );
|
||||
|
||||
for ( var i = 0; i < siblings.length; i++ ) {
|
||||
if ( siblings[i].classList.contains( 'sfHover' ) ) {
|
||||
siblings[i].classList.remove( 'sfHover' );
|
||||
}
|
||||
}
|
||||
|
||||
this.classList.add( 'sfHover' );
|
||||
|
||||
// Hide dropdown on touch outside
|
||||
var closeDropdown,
|
||||
thisItem = this;
|
||||
|
||||
document.addEventListener( 'touchend', closeDropdown = function(e) {
|
||||
e.stopPropagation();
|
||||
|
||||
thisItem.classList.remove( 'sfHover' );
|
||||
document.removeEventListener( 'touchend', closeDropdown );
|
||||
} );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
} )();
|
File diff suppressed because one or more lines are too long
@ -1,302 +1,407 @@
|
||||
( function() {
|
||||
'use strict';
|
||||
|
||||
if ( 'querySelector' in document && 'addEventListener' in window ) {
|
||||
/**
|
||||
* matches() pollyfil
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Browser_compatibility
|
||||
*/
|
||||
if ( ! Element.prototype.matches ) {
|
||||
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
||||
}
|
||||
|
||||
/**
|
||||
* closest() pollyfil
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Browser_compatibility
|
||||
*/
|
||||
if ( ! Element.prototype.closest ) {
|
||||
Element.prototype.closest = function( s ) {
|
||||
var el = this;
|
||||
var ancestor = this;
|
||||
if ( ! document.documentElement.contains( el ) ) {
|
||||
return null;
|
||||
}
|
||||
do {
|
||||
if ( ancestor.matches( s ) ) {
|
||||
return ancestor;
|
||||
}
|
||||
ancestor = ancestor.parentElement;
|
||||
} while ( ancestor !== null );
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
var getSiblings = function( elem ) {
|
||||
return Array.prototype.filter.call( elem.parentNode.children, function( sibling ) {
|
||||
return sibling !== elem;
|
||||
} );
|
||||
};
|
||||
|
||||
var allNavToggles = document.querySelectorAll( '.menu-toggle' ),
|
||||
dropdownToggle = document.querySelectorAll( 'nav .dropdown-menu-toggle' ),
|
||||
navLinks = document.querySelectorAll( 'nav ul a' ),
|
||||
mobileMenuControls = document.querySelector( '.mobile-menu-control-wrapper' ),
|
||||
body = document.body,
|
||||
htmlEl = document.documentElement;
|
||||
|
||||
var enableDropdownArrows = function( nav ) {
|
||||
if ( body.classList.contains( 'dropdown-hover' ) ) {
|
||||
var dropdownItems = nav.querySelectorAll( 'li.menu-item-has-children' );
|
||||
|
||||
for ( var i = 0; i < dropdownItems.length; i++ ) {
|
||||
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( 'aria-expanded', 'false' );
|
||||
dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'aria-label', generatepressMenu.openSubMenuLabel );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var disableDropdownArrows = function( nav ) {
|
||||
if ( body.classList.contains( 'dropdown-hover' ) ) {
|
||||
var dropdownItems = nav.querySelectorAll( 'li.menu-item-has-children' );
|
||||
|
||||
for ( var i = 0; i < dropdownItems.length; i++ ) {
|
||||
dropdownItems[i].querySelector( '.dropdown-menu-toggle' ).removeAttribute( 'tabindex' );
|
||||
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-label' );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var setDropdownArrowAttributes = function( arrow ) {
|
||||
if ( 'false' === arrow.getAttribute( 'aria-expanded' ) || ! arrow.getAttribute( 'aria-expanded' ) ) {
|
||||
arrow.setAttribute( 'aria-expanded', 'true' );
|
||||
arrow.setAttribute( 'aria-label', generatepressMenu.closeSubMenuLabel );
|
||||
} else {
|
||||
arrow.setAttribute( 'aria-expanded', 'false' );
|
||||
arrow.setAttribute( 'aria-label', generatepressMenu.openSubMenuLabel );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Start mobile menu toggle.
|
||||
*
|
||||
* @param e The event.
|
||||
* @param _this The clicked item.
|
||||
*/
|
||||
var toggleNav = function( e, _this ) {
|
||||
if ( ! _this ) {
|
||||
var _this = this;
|
||||
}
|
||||
|
||||
var parentContainer = '';
|
||||
|
||||
if ( _this.getAttribute( 'data-nav' ) ) {
|
||||
parentContainer = document.getElementById( _this.getAttribute( 'data-nav' ) );
|
||||
} else {
|
||||
parentContainer = document.getElementById( _this.closest( 'nav' ).getAttribute( 'id' ) );
|
||||
}
|
||||
|
||||
if ( ! parentContainer ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var isExternalToggle = false;
|
||||
|
||||
if ( _this.closest( '.mobile-menu-control-wrapper' ) ) {
|
||||
isExternalToggle = true;
|
||||
}
|
||||
|
||||
var nav = parentContainer.getElementsByTagName( 'ul' )[0];
|
||||
|
||||
if ( parentContainer.classList.contains( 'toggled' ) ) {
|
||||
parentContainer.classList.remove( 'toggled' );
|
||||
htmlEl.classList.remove( 'mobile-menu-open' );
|
||||
nav.setAttribute( 'aria-hidden', 'true' );
|
||||
_this.setAttribute( 'aria-expanded', 'false' );
|
||||
|
||||
if ( isExternalToggle ) {
|
||||
mobileMenuControls.classList.remove( 'toggled' );
|
||||
} else if ( mobileMenuControls && parentContainer.classList.contains( 'main-navigation' ) ) {
|
||||
mobileMenuControls.classList.remove( 'toggled' );
|
||||
}
|
||||
|
||||
disableDropdownArrows( nav );
|
||||
} else {
|
||||
parentContainer.classList.add( 'toggled' );
|
||||
htmlEl.classList.add( 'mobile-menu-open' );
|
||||
nav.setAttribute( 'aria-hidden', 'false' );
|
||||
_this.setAttribute( 'aria-expanded', 'true' );
|
||||
|
||||
if ( isExternalToggle ) {
|
||||
mobileMenuControls.classList.add( 'toggled' );
|
||||
|
||||
if ( mobileMenuControls.querySelector( '.search-item' ) ) {
|
||||
if ( mobileMenuControls.querySelector( '.search-item' ).classList.contains( 'active' ) ) {
|
||||
mobileMenuControls.querySelector( '.search-item' ).click();
|
||||
}
|
||||
}
|
||||
} else if ( mobileMenuControls && parentContainer.classList.contains( 'main-navigation' ) ) {
|
||||
mobileMenuControls.classList.add( 'toggled' );
|
||||
}
|
||||
|
||||
enableDropdownArrows( nav );
|
||||
}
|
||||
}
|
||||
|
||||
for ( var i = 0; i < allNavToggles.length; i++ ) {
|
||||
allNavToggles[i].addEventListener( 'click', toggleNav, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Open sub-menus
|
||||
*
|
||||
* @param e The event.
|
||||
* @param _this The clicked item.
|
||||
*/
|
||||
var toggleSubNav = function( e, _this ) {
|
||||
|
||||
if ( ! _this ) {
|
||||
var _this = this;
|
||||
}
|
||||
|
||||
if ( ( _this.closest( 'nav' ).classList.contains( 'toggled' ) || htmlEl.classList.contains( 'slide-opened' ) ) && ! body.classList.contains( 'dropdown-click' ) ) {
|
||||
e.preventDefault();
|
||||
var closestLi = _this.closest( 'li' );
|
||||
|
||||
setDropdownArrowAttributes( closestLi.querySelector( '.dropdown-menu-toggle' ) );
|
||||
|
||||
if ( closestLi.querySelector( '.sub-menu' ) ) {
|
||||
var subMenu = closestLi.querySelector( '.sub-menu' );
|
||||
} else {
|
||||
var subMenu = closestLi.querySelector( '.children' );
|
||||
}
|
||||
|
||||
if ( generatepressMenu.toggleOpenedSubMenus ) {
|
||||
var siblings = getSiblings( closestLi );
|
||||
|
||||
for ( var i = 0; i < siblings.length; i++ ) {
|
||||
if ( siblings[i].classList.contains( 'sfHover' ) ) {
|
||||
siblings[i].classList.remove( 'sfHover' );
|
||||
siblings[i].querySelector( '.toggled-on' ).classList.remove( 'toggled-on' );
|
||||
setDropdownArrowAttributes( siblings[i].querySelector( '.dropdown-menu-toggle' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closestLi.classList.toggle( 'sfHover' );
|
||||
subMenu.classList.toggle( 'toggled-on' );
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
for ( var i = 0; i < dropdownToggle.length; i++ ) {
|
||||
dropdownToggle[i].addEventListener( 'click', toggleSubNav, false );
|
||||
dropdownToggle[i].addEventListener( 'keypress', function( e ) {
|
||||
var key = e.which || e.keyCode;
|
||||
if (key === 13) { // 13 is enter
|
||||
toggleSubNav( e, this );
|
||||
}
|
||||
}, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the mobile menu if our toggle isn't visible.
|
||||
* Makes it possible to style mobile item with .toggled class.
|
||||
*/
|
||||
var checkMobile = function() {
|
||||
var openedMobileMenus = document.querySelectorAll( '.toggled, .has-active-search' );
|
||||
|
||||
for ( var i = 0; i < openedMobileMenus.length; i++ ) {
|
||||
var menuToggle = openedMobileMenus[i].querySelector( '.menu-toggle' );
|
||||
|
||||
if ( mobileMenuControls && ! menuToggle.closest( 'nav' ).classList.contains( 'mobile-menu-control-wrapper' ) ) {
|
||||
menuToggle = mobileMenuControls.querySelector( '.menu-toggle' );
|
||||
}
|
||||
|
||||
if ( menuToggle && menuToggle.offsetParent === null ) {
|
||||
if ( openedMobileMenus[i].classList.contains( 'toggled' ) ) {
|
||||
var remoteNav = false;
|
||||
|
||||
if ( openedMobileMenus[i].classList.contains( 'mobile-menu-control-wrapper' ) ) {
|
||||
remoteNav = true;
|
||||
}
|
||||
|
||||
if ( ! remoteNav ) {
|
||||
// Navigation is toggled, but .menu-toggle isn't visible on the page (display: none).
|
||||
var closestNav = openedMobileMenus[i].getElementsByTagName( 'ul' )[ 0 ],
|
||||
closestNavItems = closestNav.getElementsByTagName( 'li' ),
|
||||
closestSubMenus = closestNav.getElementsByTagName( 'ul' );
|
||||
}
|
||||
|
||||
document.activeElement.blur();
|
||||
openedMobileMenus[i].classList.remove( 'toggled' );
|
||||
|
||||
htmlEl.classList.remove( 'mobile-menu-open' );
|
||||
menuToggle.setAttribute( 'aria-expanded', 'false' );
|
||||
|
||||
if ( ! remoteNav ) {
|
||||
for ( var li = 0; li < closestNavItems.length; li++ ) {
|
||||
closestNavItems[li].classList.remove( 'sfHover' );
|
||||
}
|
||||
|
||||
for ( var sm = 0; sm < closestSubMenus.length; sm++ ) {
|
||||
closestSubMenus[sm].classList.remove( 'toggled-on' );
|
||||
}
|
||||
|
||||
if ( closestNav ) {
|
||||
closestNav.removeAttribute( 'aria-hidden' );
|
||||
}
|
||||
}
|
||||
|
||||
disableDropdownArrows( openedMobileMenus[i] );
|
||||
}
|
||||
|
||||
if ( mobileMenuControls.querySelector( '.search-item' ) ) {
|
||||
if ( mobileMenuControls.querySelector( '.search-item' ).classList.contains( 'active' ) ) {
|
||||
mobileMenuControls.querySelector( '.search-item' ).click();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
window.addEventListener( 'resize', checkMobile, false );
|
||||
window.addEventListener( 'orientationchange', checkMobile, false );
|
||||
|
||||
if ( body.classList.contains( 'dropdown-hover' ) ) {
|
||||
/**
|
||||
* Do some essential things when menu items are clicked.
|
||||
*/
|
||||
for ( var i = 0; i < navLinks.length; i++ ) {
|
||||
navLinks[i].addEventListener( 'click', function( e ) {
|
||||
// Remove sfHover class if we're going to another site.
|
||||
if ( this.hostname !== window.location.hostname ) {
|
||||
document.activeElement.blur();
|
||||
}
|
||||
|
||||
var closest_nav = this.closest( 'nav' );
|
||||
if ( closest_nav.classList.contains( 'toggled' ) || htmlEl.classList.contains( 'slide-opened' ) ) {
|
||||
var url = this.getAttribute( 'href' );
|
||||
|
||||
// Open the sub-menu if the link has no destination
|
||||
if ( '#' == url || '' == url ) {
|
||||
e.preventDefault();
|
||||
var closestLi = this.closest( 'li' );
|
||||
closestLi.classList.toggle( 'sfHover' );
|
||||
var subMenu = closestLi.querySelector( '.sub-menu' );
|
||||
|
||||
if ( subMenu ) {
|
||||
subMenu.classList.toggle( 'toggled-on' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}, false );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
( function() {
|
||||
'use strict';
|
||||
|
||||
if ( 'querySelector' in document && 'addEventListener' in window ) {
|
||||
/**
|
||||
* matches() pollyfil
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Browser_compatibility
|
||||
*/
|
||||
if ( ! Element.prototype.matches ) {
|
||||
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
||||
}
|
||||
|
||||
/**
|
||||
* closest() pollyfil
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Browser_compatibility
|
||||
* @param {Object} s The element to check.
|
||||
* @return {Object} The closest object.
|
||||
*/
|
||||
if ( ! Element.prototype.closest ) {
|
||||
Element.prototype.closest = function( s ) {
|
||||
var el = this;
|
||||
var ancestor = this;
|
||||
if ( ! document.documentElement.contains( el ) ) {
|
||||
return null;
|
||||
}
|
||||
do {
|
||||
if ( ancestor.matches( s ) ) {
|
||||
return ancestor;
|
||||
}
|
||||
ancestor = ancestor.parentElement;
|
||||
} while ( ancestor !== null );
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
var getSiblings = function( elem ) {
|
||||
return Array.prototype.filter.call( elem.parentNode.children, function( sibling ) {
|
||||
return sibling !== elem;
|
||||
} );
|
||||
};
|
||||
|
||||
var allNavToggles = document.querySelectorAll( '.menu-toggle' ),
|
||||
dropdownToggles = document.querySelectorAll( 'nav .dropdown-menu-toggle' ),
|
||||
navLinks = document.querySelectorAll( 'nav .main-nav ul a' ),
|
||||
mobileMenuControls = document.querySelector( '.mobile-menu-control-wrapper' ),
|
||||
body = document.body,
|
||||
htmlEl = document.documentElement,
|
||||
i;
|
||||
|
||||
var enableDropdownArrows = function( nav ) {
|
||||
if ( body.classList.contains( 'dropdown-hover' ) ) {
|
||||
var dropdownItems = nav.querySelectorAll( 'li.menu-item-has-children' );
|
||||
|
||||
for ( i = 0; i < dropdownItems.length; i++ ) {
|
||||
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( 'aria-expanded', 'false' );
|
||||
dropdownItems[ i ].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'aria-label', generatepressMenu.openSubMenuLabel );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var disableDropdownArrows = function( nav ) {
|
||||
if ( body.classList.contains( 'dropdown-hover' ) ) {
|
||||
var dropdownItems = nav.querySelectorAll( 'li.menu-item-has-children' );
|
||||
|
||||
for ( i = 0; i < dropdownItems.length; i++ ) {
|
||||
dropdownItems[ i ].querySelector( '.dropdown-menu-toggle' ).removeAttribute( 'tabindex' );
|
||||
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-label' );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var setDropdownArrowAttributes = function( arrow ) {
|
||||
if ( 'false' === arrow.getAttribute( 'aria-expanded' ) || ! arrow.getAttribute( 'aria-expanded' ) ) {
|
||||
arrow.setAttribute( 'aria-expanded', 'true' );
|
||||
arrow.setAttribute( 'aria-label', generatepressMenu.closeSubMenuLabel );
|
||||
} else {
|
||||
arrow.setAttribute( 'aria-expanded', 'false' );
|
||||
arrow.setAttribute( 'aria-label', generatepressMenu.openSubMenuLabel );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Start mobile menu toggle.
|
||||
*
|
||||
* @param {Object} e The event.
|
||||
* @param {Object} _this The clicked item.
|
||||
*/
|
||||
var toggleNav = function( e, _this ) {
|
||||
if ( ! _this ) {
|
||||
_this = this;
|
||||
}
|
||||
|
||||
var parentContainer = '';
|
||||
|
||||
if ( _this.getAttribute( 'data-nav' ) ) {
|
||||
parentContainer = document.getElementById( _this.getAttribute( 'data-nav' ) );
|
||||
} else {
|
||||
parentContainer = document.getElementById( _this.closest( 'nav' ).getAttribute( 'id' ) );
|
||||
}
|
||||
|
||||
if ( ! parentContainer ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var isExternalToggle = false;
|
||||
|
||||
if ( _this.closest( '.mobile-menu-control-wrapper' ) ) {
|
||||
isExternalToggle = true;
|
||||
}
|
||||
|
||||
var nav = parentContainer.getElementsByTagName( 'ul' )[ 0 ];
|
||||
|
||||
if ( parentContainer.classList.contains( 'toggled' ) ) {
|
||||
parentContainer.classList.remove( 'toggled' );
|
||||
htmlEl.classList.remove( 'mobile-menu-open' );
|
||||
nav.setAttribute( 'aria-hidden', 'true' );
|
||||
_this.setAttribute( 'aria-expanded', 'false' );
|
||||
|
||||
if ( isExternalToggle ) {
|
||||
mobileMenuControls.classList.remove( 'toggled' );
|
||||
} else if ( mobileMenuControls && parentContainer.classList.contains( 'main-navigation' ) ) {
|
||||
mobileMenuControls.classList.remove( 'toggled' );
|
||||
}
|
||||
|
||||
disableDropdownArrows( nav );
|
||||
} else {
|
||||
parentContainer.classList.add( 'toggled' );
|
||||
htmlEl.classList.add( 'mobile-menu-open' );
|
||||
nav.setAttribute( 'aria-hidden', 'false' );
|
||||
_this.setAttribute( 'aria-expanded', 'true' );
|
||||
|
||||
if ( isExternalToggle ) {
|
||||
mobileMenuControls.classList.add( 'toggled' );
|
||||
|
||||
if ( mobileMenuControls.querySelector( '.search-item' ) ) {
|
||||
if ( mobileMenuControls.querySelector( '.search-item' ).classList.contains( 'active' ) ) {
|
||||
mobileMenuControls.querySelector( '.search-item' ).click();
|
||||
}
|
||||
}
|
||||
} else if ( mobileMenuControls && parentContainer.classList.contains( 'main-navigation' ) ) {
|
||||
mobileMenuControls.classList.add( 'toggled' );
|
||||
}
|
||||
|
||||
enableDropdownArrows( nav );
|
||||
}
|
||||
};
|
||||
|
||||
for ( i = 0; i < allNavToggles.length; i++ ) {
|
||||
allNavToggles[ i ].addEventListener( 'click', toggleNav, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Open sub-menus
|
||||
*
|
||||
* @param {Object} e The event.
|
||||
* @param {Object} _this The clicked item.
|
||||
*/
|
||||
var toggleSubNav = function( e, _this ) {
|
||||
if ( ! _this ) {
|
||||
_this = this;
|
||||
}
|
||||
|
||||
if ( ( _this.closest( 'nav' ).classList.contains( 'toggled' ) || htmlEl.classList.contains( 'slide-opened' ) ) && ! body.classList.contains( 'dropdown-click' ) ) {
|
||||
e.preventDefault();
|
||||
var closestLi = _this.closest( 'li' );
|
||||
|
||||
setDropdownArrowAttributes( closestLi.querySelector( '.dropdown-menu-toggle' ) );
|
||||
|
||||
if ( closestLi.querySelector( '.sub-menu' ) ) {
|
||||
var subMenu = closestLi.querySelector( '.sub-menu' );
|
||||
} else {
|
||||
subMenu = closestLi.querySelector( '.children' );
|
||||
}
|
||||
|
||||
if ( generatepressMenu.toggleOpenedSubMenus ) {
|
||||
var siblings = getSiblings( closestLi );
|
||||
|
||||
for ( i = 0; i < siblings.length; i++ ) {
|
||||
if ( siblings[ i ].classList.contains( 'sfHover' ) ) {
|
||||
siblings[ i ].classList.remove( 'sfHover' );
|
||||
siblings[ i ].querySelector( '.toggled-on' ).classList.remove( 'toggled-on' );
|
||||
setDropdownArrowAttributes( siblings[ i ].querySelector( '.dropdown-menu-toggle' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closestLi.classList.toggle( 'sfHover' );
|
||||
subMenu.classList.toggle( 'toggled-on' );
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
};
|
||||
|
||||
for ( i = 0; i < dropdownToggles.length; i++ ) {
|
||||
dropdownToggles[ i ].addEventListener( 'click', toggleSubNav, false );
|
||||
dropdownToggles[ i ].addEventListener( 'keypress', function( e ) {
|
||||
if ( 'Enter' === e.key ) { // 13 is enter
|
||||
toggleSubNav( e, this );
|
||||
}
|
||||
}, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the mobile menu if our toggle isn't visible.
|
||||
* Makes it possible to style mobile item with .toggled class.
|
||||
*/
|
||||
var checkMobile = function() {
|
||||
var openedMobileMenus = document.querySelectorAll( '.toggled, .has-active-search' );
|
||||
|
||||
for ( i = 0; i < openedMobileMenus.length; i++ ) {
|
||||
var menuToggle = openedMobileMenus[ i ].querySelector( '.menu-toggle' );
|
||||
|
||||
if ( mobileMenuControls && ! menuToggle.closest( 'nav' ).classList.contains( 'mobile-menu-control-wrapper' ) ) {
|
||||
menuToggle = mobileMenuControls.querySelector( '.menu-toggle' );
|
||||
}
|
||||
|
||||
if ( menuToggle && menuToggle.offsetParent === null ) {
|
||||
if ( openedMobileMenus[ i ].classList.contains( 'toggled' ) ) {
|
||||
var remoteNav = false;
|
||||
|
||||
if ( openedMobileMenus[ i ].classList.contains( 'mobile-menu-control-wrapper' ) ) {
|
||||
remoteNav = true;
|
||||
}
|
||||
|
||||
if ( ! remoteNav ) {
|
||||
// Navigation is toggled, but .menu-toggle isn't visible on the page (display: none).
|
||||
var closestNav = openedMobileMenus[ i ].getElementsByTagName( 'ul' )[ 0 ],
|
||||
closestNavItems = closestNav.getElementsByTagName( 'li' ),
|
||||
closestSubMenus = closestNav.getElementsByTagName( 'ul' );
|
||||
}
|
||||
|
||||
document.activeElement.blur();
|
||||
openedMobileMenus[ i ].classList.remove( 'toggled' );
|
||||
|
||||
htmlEl.classList.remove( 'mobile-menu-open' );
|
||||
menuToggle.setAttribute( 'aria-expanded', 'false' );
|
||||
|
||||
if ( ! remoteNav ) {
|
||||
for ( var li = 0; li < closestNavItems.length; li++ ) {
|
||||
closestNavItems[ li ].classList.remove( 'sfHover' );
|
||||
}
|
||||
|
||||
for ( var sm = 0; sm < closestSubMenus.length; sm++ ) {
|
||||
closestSubMenus[ sm ].classList.remove( 'toggled-on' );
|
||||
}
|
||||
|
||||
if ( closestNav ) {
|
||||
closestNav.removeAttribute( 'aria-hidden' );
|
||||
}
|
||||
}
|
||||
|
||||
disableDropdownArrows( openedMobileMenus[ i ] );
|
||||
}
|
||||
|
||||
if ( mobileMenuControls.querySelector( '.search-item' ) ) {
|
||||
if ( mobileMenuControls.querySelector( '.search-item' ).classList.contains( 'active' ) ) {
|
||||
mobileMenuControls.querySelector( '.search-item' ).click();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
window.addEventListener( 'resize', checkMobile, false );
|
||||
window.addEventListener( 'orientationchange', checkMobile, false );
|
||||
|
||||
if ( body.classList.contains( 'dropdown-hover' ) ) {
|
||||
/**
|
||||
* Do some essential things when menu items are clicked.
|
||||
*/
|
||||
for ( i = 0; i < navLinks.length; i++ ) {
|
||||
navLinks[ i ].addEventListener( 'click', function( e ) {
|
||||
// Remove sfHover class if we're going to another site.
|
||||
if ( this.hostname !== window.location.hostname ) {
|
||||
document.activeElement.blur();
|
||||
}
|
||||
|
||||
var closestNav = this.closest( 'nav' );
|
||||
if ( closestNav.classList.contains( 'toggled' ) || htmlEl.classList.contains( 'slide-opened' ) ) {
|
||||
var url = this.getAttribute( 'href' );
|
||||
|
||||
// Open the sub-menu if the link has no destination
|
||||
if ( '#' === url || '' === url ) {
|
||||
e.preventDefault();
|
||||
var closestLi = this.closest( 'li' );
|
||||
closestLi.classList.toggle( 'sfHover' );
|
||||
var subMenu = closestLi.querySelector( '.sub-menu' );
|
||||
|
||||
if ( subMenu ) {
|
||||
subMenu.classList.toggle( 'toggled-on' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}, false );
|
||||
}
|
||||
}
|
||||
|
||||
if ( body.classList.contains( 'dropdown-hover' ) ) {
|
||||
var menuBarItems = document.querySelectorAll( '.menu-bar-items .menu-bar-item > a' );
|
||||
|
||||
/**
|
||||
* Make menu items tab accessible when using the hover dropdown type
|
||||
*/
|
||||
var toggleFocus = function() {
|
||||
if ( this.closest( 'nav' ).classList.contains( 'toggled' ) || this.closest( 'nav' ).classList.contains( 'slideout-navigation' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
|
||||
while ( -1 === self.className.indexOf( 'main-nav' ) ) {
|
||||
if ( 'li' === self.tagName.toLowerCase() ) {
|
||||
self.classList.toggle( 'sfHover' );
|
||||
}
|
||||
|
||||
self = self.parentElement;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Make our menu bar items tab accessible.
|
||||
*/
|
||||
var toggleMenuBarItemFocus = function() {
|
||||
if ( this.closest( 'nav' ).classList.contains( 'toggled' ) || this.closest( 'nav' ).classList.contains( 'slideout-navigation' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
|
||||
while ( -1 === self.className.indexOf( 'menu-bar-items' ) ) {
|
||||
if ( self.classList.contains( 'menu-bar-item' ) ) {
|
||||
self.classList.toggle( 'sfHover' );
|
||||
}
|
||||
|
||||
self = self.parentElement;
|
||||
}
|
||||
};
|
||||
|
||||
for ( i = 0; i < navLinks.length; i++ ) {
|
||||
navLinks[ i ].addEventListener( 'focus', toggleFocus );
|
||||
navLinks[ i ].addEventListener( 'blur', toggleFocus );
|
||||
}
|
||||
|
||||
for ( i = 0; i < menuBarItems.length; i++ ) {
|
||||
menuBarItems[ i ].addEventListener( 'focus', toggleMenuBarItemFocus );
|
||||
menuBarItems[ i ].addEventListener( 'blur', toggleMenuBarItemFocus );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make hover dropdown touch-friendly.
|
||||
*/
|
||||
if ( 'ontouchend' in document.documentElement && document.body.classList.contains( 'dropdown-hover' ) ) {
|
||||
var parentElements = document.querySelectorAll( '.sf-menu .menu-item-has-children' );
|
||||
|
||||
for ( i = 0; i < parentElements.length; i++ ) {
|
||||
parentElements[ i ].addEventListener( 'touchend', function( e ) {
|
||||
// Bail on mobile
|
||||
if ( this.closest( 'nav' ).classList.contains( 'toggled' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( e.touches.length === 1 || e.touches.length === 0 ) {
|
||||
// Prevent touch events within dropdown bubbling down to document
|
||||
e.stopPropagation();
|
||||
|
||||
// Toggle hover
|
||||
if ( ! this.classList.contains( 'sfHover' ) ) {
|
||||
// Prevent link on first touch
|
||||
if ( e.target === this || e.target.parentNode === this || e.target.parentNode.parentNode ) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
// Close other sub-menus.
|
||||
var closestLi = this.closest( 'li' ),
|
||||
siblings = getSiblings( closestLi );
|
||||
|
||||
for ( i = 0; i < siblings.length; i++ ) {
|
||||
if ( siblings[ i ].classList.contains( 'sfHover' ) ) {
|
||||
siblings[ i ].classList.remove( 'sfHover' );
|
||||
}
|
||||
}
|
||||
|
||||
this.classList.add( 'sfHover' );
|
||||
|
||||
// Hide dropdown on touch outside
|
||||
var closeDropdown,
|
||||
thisItem = this;
|
||||
|
||||
document.addEventListener( 'touchend', closeDropdown = function( event ) {
|
||||
event.stopPropagation();
|
||||
|
||||
thisItem.classList.remove( 'sfHover' );
|
||||
document.removeEventListener( 'touchend', closeDropdown );
|
||||
} );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
}() );
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,128 +1,126 @@
|
||||
( function() {
|
||||
'use strict';
|
||||
|
||||
if ( 'querySelector' in document && 'addEventListener' in window ) {
|
||||
/**
|
||||
* Navigation search.
|
||||
*
|
||||
* @param e The event.
|
||||
* @param _this The clicked item.
|
||||
*/
|
||||
var toggleSearch = function( e, item ) {
|
||||
e.preventDefault();
|
||||
|
||||
if ( ! item ) {
|
||||
var item = this;
|
||||
}
|
||||
|
||||
var forms = document.querySelectorAll( '.navigation-search' ),
|
||||
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"]'),
|
||||
nav = '';
|
||||
|
||||
if ( item.closest( '.mobile-menu-control-wrapper' ) ) {
|
||||
nav = document.getElementById( 'site-navigation' );
|
||||
}
|
||||
|
||||
for ( var i = 0; i < forms.length; i++ ) {
|
||||
if ( forms[i].classList.contains( 'nav-search-active' ) ) {
|
||||
if ( forms[i].closest( '#sticky-placeholder' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
forms[i].classList.remove( 'nav-search-active' );
|
||||
|
||||
var activeSearch = document.querySelector( '.has-active-search' );;
|
||||
|
||||
if ( activeSearch ) {
|
||||
activeSearch.classList.remove( 'has-active-search' );
|
||||
}
|
||||
|
||||
for ( var t = 0; t < toggles.length; t++ ) {
|
||||
toggles[t].classList.remove( 'close-search' );
|
||||
toggles[t].classList.remove( 'active' );
|
||||
toggles[t].querySelector( 'a' ).setAttribute( 'aria-label', generatepressNavSearch.open );
|
||||
|
||||
// Allow tabindex on items again.
|
||||
for ( var f = 0; f < focusableEls.length; f++ ) {
|
||||
if ( ! focusableEls[f].closest( '.navigation-search' ) && ! focusableEls[f].closest( '.search-item' ) ) {
|
||||
focusableEls[f].removeAttribute( 'tabindex' );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
document.activeElement.blur();
|
||||
} else {
|
||||
if ( forms[i].closest( '#sticky-placeholder' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var openedMobileMenu = forms[i].closest( '.toggled' );
|
||||
|
||||
if ( openedMobileMenu ) {
|
||||
// Close the mobile menu.
|
||||
openedMobileMenu.querySelector( 'button.menu-toggle' ).click();
|
||||
}
|
||||
|
||||
if ( nav ) {
|
||||
nav.classList.add( 'has-active-search' );
|
||||
}
|
||||
|
||||
forms[i].classList.add( 'nav-search-active' );
|
||||
|
||||
var container = this.closest( 'nav' );
|
||||
|
||||
if ( container ) {
|
||||
if ( container.classList.contains( 'mobile-menu-control-wrapper' ) ) {
|
||||
container = nav;
|
||||
}
|
||||
|
||||
var searchField = container.querySelector( '.search-field' );
|
||||
|
||||
if ( searchField ) {
|
||||
searchField.focus();
|
||||
}
|
||||
}
|
||||
|
||||
for ( var t = 0; t < toggles.length; t++ ) {
|
||||
toggles[t].classList.add( 'active' );
|
||||
toggles[t].querySelector( 'a' ).setAttribute( 'aria-label', generatepressNavSearch.close );
|
||||
|
||||
// Trap tabindex within the search element
|
||||
for ( var f = 0; f < focusableEls.length; f++ ) {
|
||||
if ( ! focusableEls[f].closest( '.navigation-search' ) && ! focusableEls[f].closest( '.search-item' ) ) {
|
||||
focusableEls[f].setAttribute( 'tabindex', '-1' );
|
||||
}
|
||||
};
|
||||
|
||||
toggles[t].classList.add( 'close-search' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( document.body.classList.contains( 'nav-search-enabled' ) ) {
|
||||
var searchItems = document.querySelectorAll( '.search-item' );
|
||||
|
||||
for ( var i = 0; i < searchItems.length; i++ ) {
|
||||
searchItems[i].addEventListener( 'click', toggleSearch, false );
|
||||
}
|
||||
|
||||
// Close navigation search on escape key
|
||||
document.addEventListener( 'keydown', function( e ) {
|
||||
if ( document.querySelector( '.navigation-search.nav-search-active' ) ) {
|
||||
var key = e.which || e.keyCode;
|
||||
|
||||
if ( key === 27 ) { // 27 is esc
|
||||
var activeSearchItems = document.querySelectorAll( '.search-item.active' );
|
||||
|
||||
for ( var i = 0; i < activeSearchItems.length; i++ ) {
|
||||
toggleSearch( e, activeSearchItems[i] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}, false );
|
||||
}
|
||||
}
|
||||
})();
|
||||
( function() {
|
||||
'use strict';
|
||||
|
||||
if ( 'querySelector' in document && 'addEventListener' in window ) {
|
||||
/**
|
||||
* Navigation search.
|
||||
*
|
||||
* @param {Object} e The event.
|
||||
* @param {Object} item The clicked item.
|
||||
*/
|
||||
var toggleSearch = function( e, item ) {
|
||||
e.preventDefault();
|
||||
|
||||
if ( ! item ) {
|
||||
item = this;
|
||||
}
|
||||
|
||||
var forms = document.querySelectorAll( '.navigation-search' ),
|
||||
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"]' ),
|
||||
nav = '';
|
||||
|
||||
if ( item.closest( '.mobile-menu-control-wrapper' ) ) {
|
||||
nav = document.getElementById( 'site-navigation' );
|
||||
}
|
||||
|
||||
for ( var i = 0; i < forms.length; i++ ) {
|
||||
if ( forms[ i ].classList.contains( 'nav-search-active' ) ) {
|
||||
if ( forms[ i ].closest( '#sticky-placeholder' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
forms[ i ].classList.remove( 'nav-search-active' );
|
||||
|
||||
var activeSearch = document.querySelector( '.has-active-search' );
|
||||
|
||||
if ( activeSearch ) {
|
||||
activeSearch.classList.remove( 'has-active-search' );
|
||||
}
|
||||
|
||||
for ( var t = 0; t < toggles.length; t++ ) {
|
||||
toggles[ t ].classList.remove( 'close-search' );
|
||||
toggles[ t ].classList.remove( 'active' );
|
||||
toggles[ t ].querySelector( 'a' ).setAttribute( 'aria-label', generatepressNavSearch.open );
|
||||
|
||||
// Allow tabindex on items again.
|
||||
for ( var f = 0; f < focusableEls.length; f++ ) {
|
||||
if ( ! focusableEls[ f ].closest( '.navigation-search' ) && ! focusableEls[ f ].closest( '.search-item' ) ) {
|
||||
focusableEls[ f ].removeAttribute( 'tabindex' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.activeElement.blur();
|
||||
} else {
|
||||
if ( forms[ i ].closest( '#sticky-placeholder' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var openedMobileMenu = forms[ i ].closest( '.toggled' );
|
||||
|
||||
if ( openedMobileMenu ) {
|
||||
// Close the mobile menu.
|
||||
openedMobileMenu.querySelector( 'button.menu-toggle' ).click();
|
||||
}
|
||||
|
||||
if ( nav ) {
|
||||
nav.classList.add( 'has-active-search' );
|
||||
}
|
||||
|
||||
forms[ i ].classList.add( 'nav-search-active' );
|
||||
|
||||
var container = this.closest( 'nav' );
|
||||
|
||||
if ( container ) {
|
||||
if ( container.classList.contains( 'mobile-menu-control-wrapper' ) ) {
|
||||
container = nav;
|
||||
}
|
||||
|
||||
var searchField = container.querySelector( '.search-field' );
|
||||
|
||||
if ( searchField ) {
|
||||
searchField.focus();
|
||||
}
|
||||
}
|
||||
|
||||
for ( t = 0; t < toggles.length; t++ ) {
|
||||
toggles[ t ].classList.add( 'active' );
|
||||
toggles[ t ].querySelector( 'a' ).setAttribute( 'aria-label', generatepressNavSearch.close );
|
||||
|
||||
// Trap tabindex within the search element
|
||||
for ( f = 0; f < focusableEls.length; f++ ) {
|
||||
if ( ! focusableEls[ f ].closest( '.navigation-search' ) && ! focusableEls[ f ].closest( '.search-item' ) ) {
|
||||
focusableEls[ f ].setAttribute( 'tabindex', '-1' );
|
||||
}
|
||||
}
|
||||
|
||||
toggles[ t ].classList.add( 'close-search' );
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if ( document.body.classList.contains( 'nav-search-enabled' ) ) {
|
||||
var searchItems = document.querySelectorAll( '.search-item' );
|
||||
|
||||
for ( var i = 0; i < searchItems.length; i++ ) {
|
||||
searchItems[ i ].addEventListener( 'click', toggleSearch, false );
|
||||
}
|
||||
|
||||
// Close navigation search on escape key
|
||||
document.addEventListener( 'keydown', function( e ) {
|
||||
if ( document.querySelector( '.navigation-search.nav-search-active' ) ) {
|
||||
if ( 'Escape' === e.key ) {
|
||||
var activeSearchItems = document.querySelectorAll( '.search-item.active' );
|
||||
|
||||
for ( var activeSearchItem = 0; activeSearchItem < activeSearchItems.length; activeSearchItem++ ) {
|
||||
toggleSearch( e, activeSearchItems[ activeSearchItem ] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}, false );
|
||||
}
|
||||
}
|
||||
}() );
|
||||
|
@ -1 +1 @@
|
||||
!function(){"use strict";if("querySelector"in document&&"addEventListener"in window){var s=function(e,t){e.preventDefault(),t=t||this;var a=document.querySelectorAll(".navigation-search"),s=document.querySelectorAll(".search-item"),c=document.querySelectorAll('a[href], area[href], input:not([disabled]):not(.navigation-search), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]'),r="";t.closest(".mobile-menu-control-wrapper")&&(r=document.getElementById("site-navigation"));for(var n=0;n<a.length;n++)if(a[n].classList.contains("nav-search-active")){if(a[n].closest("#sticky-placeholder"))continue;a[n].classList.remove("nav-search-active");var i=document.querySelector(".has-active-search");i&&i.classList.remove("has-active-search");for(var o=0;o<s.length;o++){s[o].classList.remove("close-search"),s[o].classList.remove("active"),s[o].querySelector("a").setAttribute("aria-label",generatepressNavSearch.open);for(var l=0;l<c.length;l++)c[l].closest(".navigation-search")||c[l].closest(".search-item")||c[l].removeAttribute("tabindex")}document.activeElement.blur()}else{if(a[n].closest("#sticky-placeholder"))continue;var d=a[n].closest(".toggled");d&&d.querySelector("button.menu-toggle").click(),r&&r.classList.add("has-active-search"),a[n].classList.add("nav-search-active");var v,u=this.closest("nav");u&&(u.classList.contains("mobile-menu-control-wrapper")&&(u=r),(v=u.querySelector(".search-field"))&&v.focus());for(o=0;o<s.length;o++){s[o].classList.add("active"),s[o].querySelector("a").setAttribute("aria-label",generatepressNavSearch.close);for(l=0;l<c.length;l++)c[l].closest(".navigation-search")||c[l].closest(".search-item")||c[l].setAttribute("tabindex","-1");s[o].classList.add("close-search")}}};if(document.body.classList.contains("nav-search-enabled")){for(var e=document.querySelectorAll(".search-item"),t=0;t<e.length;t++)e[t].addEventListener("click",s,!1);document.addEventListener("keydown",function(e){if(document.querySelector(".navigation-search.nav-search-active")&&27===(e.which||e.keyCode))for(var t=document.querySelectorAll(".search-item.active"),a=0;a<t.length;a++){s(e,t[a]);break}},!1)}}}();
|
||||
!function(){"use strict";if("querySelector"in document&&"addEventListener"in window){var s=function(e,t){e.preventDefault(),t=t||this;var a=document.querySelectorAll(".navigation-search"),s=document.querySelectorAll(".search-item"),c=document.querySelectorAll('a[href], area[href], input:not([disabled]):not(.navigation-search), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]'),r="";t.closest(".mobile-menu-control-wrapper")&&(r=document.getElementById("site-navigation"));for(var i=0;i<a.length;i++)if(a[i].classList.contains("nav-search-active")){if(!a[i].closest("#sticky-placeholder")){a[i].classList.remove("nav-search-active");var n=document.querySelector(".has-active-search");n&&n.classList.remove("has-active-search");for(var o=0;o<s.length;o++){s[o].classList.remove("close-search"),s[o].classList.remove("active"),s[o].querySelector("a").setAttribute("aria-label",generatepressNavSearch.open);for(var l=0;l<c.length;l++)c[l].closest(".navigation-search")||c[l].closest(".search-item")||c[l].removeAttribute("tabindex")}document.activeElement.blur()}}else if(!a[i].closest("#sticky-placeholder")){n=a[i].closest(".toggled");n&&n.querySelector("button.menu-toggle").click(),r&&r.classList.add("has-active-search"),a[i].classList.add("nav-search-active");n=this.closest("nav");for(!n||(n=(n=n.classList.contains("mobile-menu-control-wrapper")?r:n).querySelector(".search-field"))&&n.focus(),o=0;o<s.length;o++){for(s[o].classList.add("active"),s[o].querySelector("a").setAttribute("aria-label",generatepressNavSearch.close),l=0;l<c.length;l++)c[l].closest(".navigation-search")||c[l].closest(".search-item")||c[l].setAttribute("tabindex","-1");s[o].classList.add("close-search")}}};if(document.body.classList.contains("nav-search-enabled")){for(var e=document.querySelectorAll(".search-item"),t=0;t<e.length;t++)e[t].addEventListener("click",s,!1);document.addEventListener("keydown",function(e){if(document.querySelector(".navigation-search.nav-search-active")&&"Escape"===e.key)for(var t=document.querySelectorAll(".search-item.active"),a=0;a<t.length;a++){s(e,t[a]);break}},!1)}}}();
|
@ -1,67 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying 404 pages.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
<div class="inside-article">
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_before_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_featured_page_header_inside_single - 10
|
||||
*/
|
||||
do_action( 'generate_before_content' );
|
||||
?>
|
||||
|
||||
<header class="entry-header">
|
||||
<?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’t be found.', 'generatepress' ) ); ?></h1>
|
||||
</header>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_entry_header hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_post_image - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_header' );
|
||||
|
||||
$itemprop = '';
|
||||
|
||||
if ( 'microdata' === generate_get_schema_type() ) {
|
||||
$itemprop = ' itemprop="text"';
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
|
||||
<?php
|
||||
printf(
|
||||
'<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.
|
||||
);
|
||||
|
||||
get_search_form();
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_content' );
|
||||
?>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying 404 pages.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
<div class="inside-article">
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_before_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_featured_page_header_inside_single - 10
|
||||
*/
|
||||
do_action( 'generate_before_content' );
|
||||
?>
|
||||
|
||||
<header <?php generate_do_attr( 'entry-header' ); ?>>
|
||||
<?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’t be found.', 'generatepress' ) ); ?></h1>
|
||||
</header>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_entry_header hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_post_image - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_header' );
|
||||
|
||||
$itemprop = '';
|
||||
|
||||
if ( 'microdata' === generate_get_schema_type() ) {
|
||||
$itemprop = ' itemprop="text"';
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
|
||||
<?php
|
||||
printf(
|
||||
'<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.
|
||||
);
|
||||
|
||||
get_search_form();
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_content' );
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
@ -1,111 +1,111 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying Link post formats.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
|
||||
<div class="inside-article">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_featured_page_header_inside_single - 10
|
||||
*/
|
||||
do_action( 'generate_before_content' );
|
||||
|
||||
if ( generate_show_entry_header() ) :
|
||||
?>
|
||||
<header class="entry-header">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_entry_title hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_entry_title' );
|
||||
|
||||
if ( generate_show_title() ) {
|
||||
$params = generate_get_the_title_parameters();
|
||||
|
||||
the_title( $params['before'], $params['after'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_entry_title hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_post_meta - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_title' );
|
||||
?>
|
||||
</header>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
/**
|
||||
* generate_after_entry_header hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_post_image - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_header' );
|
||||
|
||||
$itemprop = '';
|
||||
|
||||
if ( 'microdata' === generate_get_schema_type() ) {
|
||||
$itemprop = ' itemprop="text"';
|
||||
}
|
||||
|
||||
if ( generate_show_excerpt() ) :
|
||||
?>
|
||||
|
||||
<div class="entry-summary"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
|
||||
<?php the_excerpt(); ?>
|
||||
</div>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
|
||||
<?php
|
||||
the_content();
|
||||
|
||||
wp_link_pages(
|
||||
array(
|
||||
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
|
||||
'after' => '</div>',
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
endif;
|
||||
|
||||
/**
|
||||
* generate_after_entry_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_footer_meta - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_content' );
|
||||
|
||||
/**
|
||||
* generate_after_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_content' );
|
||||
?>
|
||||
</div>
|
||||
</article>
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying Link post formats.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
|
||||
<div class="inside-article">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_featured_page_header_inside_single - 10
|
||||
*/
|
||||
do_action( 'generate_before_content' );
|
||||
|
||||
if ( generate_show_entry_header() ) :
|
||||
?>
|
||||
<header <?php generate_do_attr( 'entry-header' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_entry_title hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_entry_title' );
|
||||
|
||||
if ( generate_show_title() ) {
|
||||
$params = generate_get_the_title_parameters();
|
||||
|
||||
the_title( $params['before'], $params['after'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_entry_title hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_post_meta - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_title' );
|
||||
?>
|
||||
</header>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
/**
|
||||
* generate_after_entry_header hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_post_image - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_header' );
|
||||
|
||||
$itemprop = '';
|
||||
|
||||
if ( 'microdata' === generate_get_schema_type() ) {
|
||||
$itemprop = ' itemprop="text"';
|
||||
}
|
||||
|
||||
if ( generate_show_excerpt() ) :
|
||||
?>
|
||||
|
||||
<div class="entry-summary"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
|
||||
<?php the_excerpt(); ?>
|
||||
</div>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
|
||||
<?php
|
||||
the_content();
|
||||
|
||||
wp_link_pages(
|
||||
array(
|
||||
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
|
||||
'after' => '</div>',
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
endif;
|
||||
|
||||
/**
|
||||
* generate_after_entry_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_footer_meta - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_content' );
|
||||
|
||||
/**
|
||||
* generate_after_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_content' );
|
||||
?>
|
||||
</div>
|
||||
</article>
|
||||
|
@ -1,93 +1,93 @@
|
||||
<?php
|
||||
/**
|
||||
* The template used for displaying page content in page.php
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
|
||||
<div class="inside-article">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_featured_page_header_inside_single - 10
|
||||
*/
|
||||
do_action( 'generate_before_content' );
|
||||
|
||||
if ( generate_show_entry_header() ) :
|
||||
?>
|
||||
|
||||
<header class="entry-header">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_page_title hook.
|
||||
*
|
||||
* @since 2.4
|
||||
*/
|
||||
do_action( 'generate_before_page_title' );
|
||||
|
||||
if ( generate_show_title() ) {
|
||||
$params = generate_get_the_title_parameters();
|
||||
|
||||
the_title( $params['before'], $params['after'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_page_title hook.
|
||||
*
|
||||
* @since 2.4
|
||||
*/
|
||||
do_action( 'generate_after_page_title' );
|
||||
?>
|
||||
</header>
|
||||
|
||||
<?php
|
||||
endif;
|
||||
|
||||
/**
|
||||
* generate_after_entry_header hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_post_image - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_header' );
|
||||
|
||||
$itemprop = '';
|
||||
|
||||
if ( 'microdata' === generate_get_schema_type() ) {
|
||||
$itemprop = ' itemprop="text"';
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
|
||||
<?php
|
||||
the_content();
|
||||
|
||||
wp_link_pages(
|
||||
array(
|
||||
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
|
||||
'after' => '</div>',
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_content' );
|
||||
?>
|
||||
</div>
|
||||
</article>
|
||||
<?php
|
||||
/**
|
||||
* The template used for displaying page content in page.php
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
|
||||
<div class="inside-article">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_featured_page_header_inside_single - 10
|
||||
*/
|
||||
do_action( 'generate_before_content' );
|
||||
|
||||
if ( generate_show_entry_header() ) :
|
||||
?>
|
||||
|
||||
<header <?php generate_do_attr( 'entry-header' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_page_title hook.
|
||||
*
|
||||
* @since 2.4
|
||||
*/
|
||||
do_action( 'generate_before_page_title' );
|
||||
|
||||
if ( generate_show_title() ) {
|
||||
$params = generate_get_the_title_parameters();
|
||||
|
||||
the_title( $params['before'], $params['after'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_page_title hook.
|
||||
*
|
||||
* @since 2.4
|
||||
*/
|
||||
do_action( 'generate_after_page_title' );
|
||||
?>
|
||||
</header>
|
||||
|
||||
<?php
|
||||
endif;
|
||||
|
||||
/**
|
||||
* generate_after_entry_header hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_post_image - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_header' );
|
||||
|
||||
$itemprop = '';
|
||||
|
||||
if ( 'microdata' === generate_get_schema_type() ) {
|
||||
$itemprop = ' itemprop="text"';
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
|
||||
<?php
|
||||
the_content();
|
||||
|
||||
wp_link_pages(
|
||||
array(
|
||||
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
|
||||
'after' => '</div>',
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_content' );
|
||||
?>
|
||||
</div>
|
||||
</article>
|
||||
|
@ -1,102 +1,102 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying single posts.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
|
||||
<div class="inside-article">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_featured_page_header_inside_single - 10
|
||||
*/
|
||||
do_action( 'generate_before_content' );
|
||||
|
||||
if ( generate_show_entry_header() ) :
|
||||
?>
|
||||
<header class="entry-header">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_entry_title hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_entry_title' );
|
||||
|
||||
if ( generate_show_title() ) {
|
||||
$params = generate_get_the_title_parameters();
|
||||
|
||||
the_title( $params['before'], $params['after'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_entry_title hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_post_meta - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_title' );
|
||||
?>
|
||||
</header>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
/**
|
||||
* generate_after_entry_header hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_post_image - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_header' );
|
||||
|
||||
$itemprop = '';
|
||||
|
||||
if ( 'microdata' === generate_get_schema_type() ) {
|
||||
$itemprop = ' itemprop="text"';
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
|
||||
<?php
|
||||
the_content();
|
||||
|
||||
wp_link_pages(
|
||||
array(
|
||||
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
|
||||
'after' => '</div>',
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_entry_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_footer_meta - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_content' );
|
||||
|
||||
/**
|
||||
* generate_after_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_content' );
|
||||
?>
|
||||
</div>
|
||||
</article>
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying single posts.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
|
||||
<div class="inside-article">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_featured_page_header_inside_single - 10
|
||||
*/
|
||||
do_action( 'generate_before_content' );
|
||||
|
||||
if ( generate_show_entry_header() ) :
|
||||
?>
|
||||
<header <?php generate_do_attr( 'entry-header' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_entry_title hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_entry_title' );
|
||||
|
||||
if ( generate_show_title() ) {
|
||||
$params = generate_get_the_title_parameters();
|
||||
|
||||
the_title( $params['before'], $params['after'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_entry_title hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_post_meta - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_title' );
|
||||
?>
|
||||
</header>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
/**
|
||||
* generate_after_entry_header hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_post_image - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_header' );
|
||||
|
||||
$itemprop = '';
|
||||
|
||||
if ( 'microdata' === generate_get_schema_type() ) {
|
||||
$itemprop = ' itemprop="text"';
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
|
||||
<?php
|
||||
the_content();
|
||||
|
||||
wp_link_pages(
|
||||
array(
|
||||
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
|
||||
'after' => '</div>',
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_entry_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_footer_meta - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_content' );
|
||||
|
||||
/**
|
||||
* generate_after_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_content' );
|
||||
?>
|
||||
</div>
|
||||
</article>
|
||||
|
@ -1,111 +1,111 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying posts within the loop.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
|
||||
<div class="inside-article">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_featured_page_header_inside_single - 10
|
||||
*/
|
||||
do_action( 'generate_before_content' );
|
||||
|
||||
if ( generate_show_entry_header() ) :
|
||||
?>
|
||||
<header class="entry-header">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_entry_title hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_entry_title' );
|
||||
|
||||
if ( generate_show_title() ) {
|
||||
$params = generate_get_the_title_parameters();
|
||||
|
||||
the_title( $params['before'], $params['after'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_entry_title hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_post_meta - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_title' );
|
||||
?>
|
||||
</header>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
/**
|
||||
* generate_after_entry_header hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_post_image - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_header' );
|
||||
|
||||
$itemprop = '';
|
||||
|
||||
if ( 'microdata' === generate_get_schema_type() ) {
|
||||
$itemprop = ' itemprop="text"';
|
||||
}
|
||||
|
||||
if ( generate_show_excerpt() ) :
|
||||
?>
|
||||
|
||||
<div class="entry-summary"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
|
||||
<?php the_excerpt(); ?>
|
||||
</div>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
|
||||
<?php
|
||||
the_content();
|
||||
|
||||
wp_link_pages(
|
||||
array(
|
||||
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
|
||||
'after' => '</div>',
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
endif;
|
||||
|
||||
/**
|
||||
* generate_after_entry_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_footer_meta - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_content' );
|
||||
|
||||
/**
|
||||
* generate_after_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_content' );
|
||||
?>
|
||||
</div>
|
||||
</article>
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying posts within the loop.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
|
||||
<div class="inside-article">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_featured_page_header_inside_single - 10
|
||||
*/
|
||||
do_action( 'generate_before_content' );
|
||||
|
||||
if ( generate_show_entry_header() ) :
|
||||
?>
|
||||
<header <?php generate_do_attr( 'entry-header' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_entry_title hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_entry_title' );
|
||||
|
||||
if ( generate_show_title() ) {
|
||||
$params = generate_get_the_title_parameters();
|
||||
|
||||
the_title( $params['before'], $params['after'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_entry_title hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_post_meta - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_title' );
|
||||
?>
|
||||
</header>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
/**
|
||||
* generate_after_entry_header hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_post_image - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_header' );
|
||||
|
||||
$itemprop = '';
|
||||
|
||||
if ( 'microdata' === generate_get_schema_type() ) {
|
||||
$itemprop = ' itemprop="text"';
|
||||
}
|
||||
|
||||
if ( generate_show_excerpt() ) :
|
||||
?>
|
||||
|
||||
<div class="entry-summary"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
|
||||
<?php the_excerpt(); ?>
|
||||
</div>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
|
||||
<?php
|
||||
the_content();
|
||||
|
||||
wp_link_pages(
|
||||
array(
|
||||
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
|
||||
'after' => '</div>',
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
endif;
|
||||
|
||||
/**
|
||||
* generate_after_entry_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_footer_meta - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_content' );
|
||||
|
||||
/**
|
||||
* generate_after_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_content' );
|
||||
?>
|
||||
</div>
|
||||
</article>
|
||||
|
@ -1,65 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying the footer.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_before_footer hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_footer' );
|
||||
?>
|
||||
|
||||
<div <?php generate_do_element_classes( 'footer' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_footer_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_footer_content' );
|
||||
|
||||
/**
|
||||
* generate_footer hook.
|
||||
*
|
||||
* @since 1.3.42
|
||||
*
|
||||
* @hooked generate_construct_footer_widgets - 5
|
||||
* @hooked generate_construct_footer - 10
|
||||
*/
|
||||
do_action( 'generate_footer' );
|
||||
|
||||
/**
|
||||
* generate_after_footer_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_footer_content' );
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_footer hook.
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
do_action( 'generate_after_footer' );
|
||||
|
||||
wp_footer();
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying the footer.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_before_footer hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_footer' );
|
||||
?>
|
||||
|
||||
<div <?php generate_do_attr( 'footer' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_footer_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_footer_content' );
|
||||
|
||||
/**
|
||||
* generate_footer hook.
|
||||
*
|
||||
* @since 1.3.42
|
||||
*
|
||||
* @hooked generate_construct_footer_widgets - 5
|
||||
* @hooked generate_construct_footer - 10
|
||||
*/
|
||||
do_action( 'generate_footer' );
|
||||
|
||||
/**
|
||||
* generate_after_footer_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_footer_content' );
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_footer hook.
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
do_action( 'generate_after_footer' );
|
||||
|
||||
wp_footer();
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,103 +1,113 @@
|
||||
<?php
|
||||
/**
|
||||
* GeneratePress.
|
||||
*
|
||||
* Please do not make any edits to this file. All edits should be done in a child theme.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
// Set our theme version.
|
||||
define( 'GENERATE_VERSION', '3.0.4' );
|
||||
|
||||
if ( ! function_exists( 'generate_setup' ) ) {
|
||||
add_action( 'after_setup_theme', 'generate_setup' );
|
||||
/**
|
||||
* Sets up theme defaults and registers support for various WordPress features.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_setup() {
|
||||
// Make theme available for translation.
|
||||
load_theme_textdomain( 'generatepress' );
|
||||
|
||||
// Add theme support for various features.
|
||||
add_theme_support( 'automatic-feed-links' );
|
||||
add_theme_support( 'post-thumbnails' );
|
||||
add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'status' ) );
|
||||
add_theme_support( 'woocommerce' );
|
||||
add_theme_support( 'title-tag' );
|
||||
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( 'align-wide' );
|
||||
add_theme_support( 'responsive-embeds' );
|
||||
|
||||
add_theme_support(
|
||||
'custom-logo',
|
||||
array(
|
||||
'height' => 70,
|
||||
'width' => 350,
|
||||
'flex-height' => true,
|
||||
'flex-width' => true,
|
||||
)
|
||||
);
|
||||
|
||||
// Register primary menu.
|
||||
register_nav_menus(
|
||||
array(
|
||||
'primary' => __( 'Primary Menu', 'generatepress' ),
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Set the content width to something large
|
||||
* We set a more accurate width in generate_smart_content_width()
|
||||
*/
|
||||
global $content_width;
|
||||
if ( ! isset( $content_width ) ) {
|
||||
$content_width = 1200; /* pixels */
|
||||
}
|
||||
|
||||
// This theme styles the visual editor to resemble the theme style.
|
||||
add_editor_style( 'assets/css/admin/editor-style.css' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all necessary theme files
|
||||
*/
|
||||
$theme_dir = get_template_directory();
|
||||
|
||||
require $theme_dir . '/inc/theme-functions.php';
|
||||
require $theme_dir . '/inc/defaults.php';
|
||||
require $theme_dir . '/inc/class-css.php';
|
||||
require $theme_dir . '/inc/css-output.php';
|
||||
require $theme_dir . '/inc/general.php';
|
||||
require $theme_dir . '/inc/customizer.php';
|
||||
require $theme_dir . '/inc/markup.php';
|
||||
require $theme_dir . '/inc/typography.php';
|
||||
require $theme_dir . '/inc/plugin-compat.php';
|
||||
require $theme_dir . '/inc/block-editor.php';
|
||||
require $theme_dir . '/inc/class-theme-update.php';
|
||||
require $theme_dir . '/inc/deprecated.php';
|
||||
|
||||
if ( is_admin() ) {
|
||||
require $theme_dir . '/inc/meta-box.php';
|
||||
require $theme_dir . '/inc/dashboard.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Load our theme structure
|
||||
*/
|
||||
require $theme_dir . '/inc/structure/archives.php';
|
||||
require $theme_dir . '/inc/structure/comments.php';
|
||||
require $theme_dir . '/inc/structure/featured-images.php';
|
||||
require $theme_dir . '/inc/structure/footer.php';
|
||||
require $theme_dir . '/inc/structure/header.php';
|
||||
require $theme_dir . '/inc/structure/navigation.php';
|
||||
require $theme_dir . '/inc/structure/post-meta.php';
|
||||
require $theme_dir . '/inc/structure/sidebars.php';
|
||||
<?php
|
||||
/**
|
||||
* GeneratePress.
|
||||
*
|
||||
* Please do not make any edits to this file. All edits should be done in a child theme.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
// Set our theme version.
|
||||
define( 'GENERATE_VERSION', '3.1.0' );
|
||||
|
||||
if ( ! function_exists( 'generate_setup' ) ) {
|
||||
add_action( 'after_setup_theme', 'generate_setup' );
|
||||
/**
|
||||
* Sets up theme defaults and registers support for various WordPress features.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_setup() {
|
||||
// Make theme available for translation.
|
||||
load_theme_textdomain( 'generatepress' );
|
||||
|
||||
// Add theme support for various features.
|
||||
add_theme_support( 'automatic-feed-links' );
|
||||
add_theme_support( 'post-thumbnails' );
|
||||
add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'status' ) );
|
||||
add_theme_support( 'woocommerce' );
|
||||
add_theme_support( 'title-tag' );
|
||||
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( 'align-wide' );
|
||||
add_theme_support( 'responsive-embeds' );
|
||||
|
||||
$color_palette = generate_get_editor_color_palette();
|
||||
|
||||
if ( ! empty( $color_palette ) ) {
|
||||
add_theme_support( 'editor-color-palette', $color_palette );
|
||||
}
|
||||
|
||||
add_theme_support(
|
||||
'custom-logo',
|
||||
array(
|
||||
'height' => 70,
|
||||
'width' => 350,
|
||||
'flex-height' => true,
|
||||
'flex-width' => true,
|
||||
)
|
||||
);
|
||||
|
||||
// Register primary menu.
|
||||
register_nav_menus(
|
||||
array(
|
||||
'primary' => __( 'Primary Menu', 'generatepress' ),
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Set the content width to something large
|
||||
* We set a more accurate width in generate_smart_content_width()
|
||||
*/
|
||||
global $content_width;
|
||||
if ( ! isset( $content_width ) ) {
|
||||
$content_width = 1200; /* pixels */
|
||||
}
|
||||
|
||||
// This theme styles the visual editor to resemble the theme style.
|
||||
add_editor_style( 'assets/css/admin/editor-style.css' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all necessary theme files
|
||||
*/
|
||||
$theme_dir = get_template_directory();
|
||||
|
||||
require $theme_dir . '/inc/theme-functions.php';
|
||||
require $theme_dir . '/inc/defaults.php';
|
||||
require $theme_dir . '/inc/class-css.php';
|
||||
require $theme_dir . '/inc/css-output.php';
|
||||
require $theme_dir . '/inc/general.php';
|
||||
require $theme_dir . '/inc/customizer.php';
|
||||
require $theme_dir . '/inc/markup.php';
|
||||
require $theme_dir . '/inc/typography.php';
|
||||
require $theme_dir . '/inc/plugin-compat.php';
|
||||
require $theme_dir . '/inc/block-editor.php';
|
||||
require $theme_dir . '/inc/class-typography.php';
|
||||
require $theme_dir . '/inc/class-typography-migration.php';
|
||||
require $theme_dir . '/inc/class-html-attributes.php';
|
||||
require $theme_dir . '/inc/class-theme-update.php';
|
||||
require $theme_dir . '/inc/class-rest.php';
|
||||
require $theme_dir . '/inc/deprecated.php';
|
||||
|
||||
if ( is_admin() ) {
|
||||
require $theme_dir . '/inc/meta-box.php';
|
||||
require $theme_dir . '/inc/class-dashboard.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Load our theme structure
|
||||
*/
|
||||
require $theme_dir . '/inc/structure/archives.php';
|
||||
require $theme_dir . '/inc/structure/comments.php';
|
||||
require $theme_dir . '/inc/structure/featured-images.php';
|
||||
require $theme_dir . '/inc/structure/footer.php';
|
||||
require $theme_dir . '/inc/structure/header.php';
|
||||
require $theme_dir . '/inc/structure/navigation.php';
|
||||
require $theme_dir . '/inc/structure/post-meta.php';
|
||||
require $theme_dir . '/inc/structure/sidebars.php';
|
||||
|
@ -1,75 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying the header.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
?><!DOCTYPE html>
|
||||
<html <?php language_attributes(); ?>>
|
||||
<head>
|
||||
<meta charset="<?php bloginfo( 'charset' ); ?>">
|
||||
<link rel="profile" href="https://gmpg.org/xfn/11">
|
||||
<?php wp_head(); ?>
|
||||
</head>
|
||||
|
||||
<body <?php body_class(); ?> <?php generate_do_microdata( 'body' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* wp_body_open hook.
|
||||
*
|
||||
* @since 2.3
|
||||
*/
|
||||
do_action( 'wp_body_open' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- core WP hook.
|
||||
|
||||
/**
|
||||
* generate_before_header hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_do_skip_to_content_link - 2
|
||||
* @hooked generate_top_bar - 5
|
||||
* @hooked generate_add_navigation_before_header - 5
|
||||
*/
|
||||
do_action( 'generate_before_header' );
|
||||
|
||||
/**
|
||||
* generate_header hook.
|
||||
*
|
||||
* @since 1.3.42
|
||||
*
|
||||
* @hooked generate_construct_header - 10
|
||||
*/
|
||||
do_action( 'generate_header' );
|
||||
|
||||
/**
|
||||
* generate_after_header hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_featured_page_header - 10
|
||||
*/
|
||||
do_action( 'generate_after_header' );
|
||||
?>
|
||||
|
||||
<div id="page" <?php generate_do_element_classes( 'page' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_inside_site_container hook.
|
||||
*
|
||||
* @since 2.4
|
||||
*/
|
||||
do_action( 'generate_inside_site_container' );
|
||||
?>
|
||||
<div id="content" class="site-content">
|
||||
<?php
|
||||
/**
|
||||
* generate_inside_container hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_inside_container' );
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying the header.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
?><!DOCTYPE html>
|
||||
<html <?php language_attributes(); ?>>
|
||||
<head>
|
||||
<meta charset="<?php bloginfo( 'charset' ); ?>">
|
||||
<link rel="profile" href="https://gmpg.org/xfn/11">
|
||||
<?php wp_head(); ?>
|
||||
</head>
|
||||
|
||||
<body <?php body_class(); ?> <?php generate_do_microdata( 'body' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* wp_body_open hook.
|
||||
*
|
||||
* @since 2.3
|
||||
*/
|
||||
do_action( 'wp_body_open' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- core WP hook.
|
||||
|
||||
/**
|
||||
* generate_before_header hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_do_skip_to_content_link - 2
|
||||
* @hooked generate_top_bar - 5
|
||||
* @hooked generate_add_navigation_before_header - 5
|
||||
*/
|
||||
do_action( 'generate_before_header' );
|
||||
|
||||
/**
|
||||
* generate_header hook.
|
||||
*
|
||||
* @since 1.3.42
|
||||
*
|
||||
* @hooked generate_construct_header - 10
|
||||
*/
|
||||
do_action( 'generate_header' );
|
||||
|
||||
/**
|
||||
* generate_after_header hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_featured_page_header - 10
|
||||
*/
|
||||
do_action( 'generate_after_header' );
|
||||
?>
|
||||
|
||||
<div <?php generate_do_attr( 'page' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_inside_site_container hook.
|
||||
*
|
||||
* @since 2.4
|
||||
*/
|
||||
do_action( 'generate_inside_site_container' );
|
||||
?>
|
||||
<div <?php generate_do_attr( 'site-content' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_inside_container hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_inside_container' );
|
||||
|
@ -1,424 +1,517 @@
|
||||
<?php
|
||||
/**
|
||||
* Integrate GeneratePress with the WordPress block editor.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Check what sidebar layout we're using.
|
||||
* We need this function as the post meta in generate_get_layout() only runs
|
||||
* on is_singular()
|
||||
*
|
||||
* @since 2.2
|
||||
*
|
||||
* @param bool $meta Check for post meta.
|
||||
* @return string The saved sidebar layout.
|
||||
*/
|
||||
function generate_get_block_editor_sidebar_layout( $meta = true ) {
|
||||
$layout = generate_get_option( 'layout_setting' );
|
||||
|
||||
if ( function_exists( 'get_current_screen' ) ) {
|
||||
$screen = get_current_screen();
|
||||
|
||||
if ( is_object( $screen ) && 'post' === $screen->post_type ) {
|
||||
$layout = generate_get_option( 'single_layout_setting' );
|
||||
}
|
||||
}
|
||||
|
||||
// Add in our default filter in case people have adjusted it.
|
||||
$layout = apply_filters( 'generate_sidebar_layout', $layout );
|
||||
|
||||
if ( $meta ) {
|
||||
$layout_meta = get_post_meta( get_the_ID(), '_generate-sidebar-layout-meta', true );
|
||||
|
||||
if ( $layout_meta ) {
|
||||
$layout = $layout_meta;
|
||||
}
|
||||
}
|
||||
|
||||
return apply_filters( 'generate_block_editor_sidebar_layout', $layout );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether we're disabling the content title or not.
|
||||
* We need this function as the post meta in generate_show_title() only runs
|
||||
* on is_singular()
|
||||
*
|
||||
* @since 2.2
|
||||
*/
|
||||
function generate_get_block_editor_show_content_title() {
|
||||
$title = generate_show_title();
|
||||
|
||||
$disable_title = get_post_meta( get_the_ID(), '_generate-disable-headline', true );
|
||||
|
||||
if ( $disable_title ) {
|
||||
$title = false;
|
||||
}
|
||||
|
||||
return apply_filters( 'generate_block_editor_show_content_title', $title );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the content width for this post.
|
||||
*
|
||||
* @since 2.2
|
||||
*/
|
||||
function generate_get_block_editor_content_width() {
|
||||
$container_width = generate_get_option( 'container_width' );
|
||||
|
||||
$content_width = $container_width;
|
||||
|
||||
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
|
||||
|
||||
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
|
||||
|
||||
$layout = generate_get_block_editor_sidebar_layout();
|
||||
|
||||
if ( 'left-sidebar' === $layout ) {
|
||||
$content_width = $container_width * ( ( 100 - $left_sidebar_width ) / 100 );
|
||||
} elseif ( 'right-sidebar' === $layout ) {
|
||||
$content_width = $container_width * ( ( 100 - $right_sidebar_width ) / 100 );
|
||||
} elseif ( 'no-sidebar' === $layout ) {
|
||||
$content_width = $container_width;
|
||||
} else {
|
||||
$content_width = $container_width * ( ( 100 - ( $left_sidebar_width + $right_sidebar_width ) ) / 100 );
|
||||
}
|
||||
|
||||
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_backend_block_editor_assets' );
|
||||
/**
|
||||
* Add CSS to the admin side of the block editor.
|
||||
*
|
||||
* @since 2.2
|
||||
*/
|
||||
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_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 );
|
||||
|
||||
$show_editor_styles = apply_filters( 'generate_show_block_editor_styles', true );
|
||||
|
||||
if ( $show_editor_styles ) {
|
||||
wp_add_inline_style( 'generate-block-editor-styles', wp_strip_all_tags( generate_do_inline_block_editor_css() ) );
|
||||
}
|
||||
|
||||
$color_settings = wp_parse_args(
|
||||
get_option( 'generate_settings', array() ),
|
||||
generate_get_color_defaults()
|
||||
);
|
||||
|
||||
$spacing_settings = wp_parse_args(
|
||||
get_option( 'generate_spacing_settings', array() ),
|
||||
generate_spacing_get_defaults()
|
||||
);
|
||||
|
||||
$text_color = generate_get_option( 'text_color' );
|
||||
|
||||
if ( $color_settings['content_text_color'] ) {
|
||||
$text_color = $color_settings['content_text_color'];
|
||||
}
|
||||
|
||||
wp_localize_script(
|
||||
'generate-block-editor-scripts',
|
||||
'generate_block_editor',
|
||||
array(
|
||||
'global_sidebar_layout' => generate_get_block_editor_sidebar_layout( false ),
|
||||
'container_width' => generate_get_option( 'container_width' ),
|
||||
'right_sidebar_width' => apply_filters( 'generate_right_sidebar_width', '25' ),
|
||||
'left_sidebar_width' => apply_filters( 'generate_left_sidebar_width', '25' ),
|
||||
'content_padding_right' => absint( $spacing_settings['content_right'] ) . 'px',
|
||||
'content_padding_left' => absint( $spacing_settings['content_left'] ) . 'px',
|
||||
'content_title' => generate_get_block_editor_show_content_title() ? 'true' : 'false',
|
||||
'disable_content_title' => esc_html__( 'Disable Content Title', 'generatepress' ),
|
||||
'show_content_title' => esc_html__( 'Show Content Title', 'generatepress' ),
|
||||
'text_color' => $text_color,
|
||||
'show_editor_styles' => $show_editor_styles,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write our CSS for the block editor.
|
||||
*
|
||||
* @since 2.2
|
||||
*/
|
||||
function generate_do_inline_block_editor_css() {
|
||||
$color_settings = wp_parse_args(
|
||||
get_option( 'generate_settings', array() ),
|
||||
generate_get_color_defaults()
|
||||
);
|
||||
|
||||
$font_settings = wp_parse_args(
|
||||
get_option( 'generate_settings', array() ),
|
||||
generate_get_default_fonts()
|
||||
);
|
||||
|
||||
$css = new GeneratePress_CSS();
|
||||
|
||||
$content_width = generate_get_block_editor_content_width();
|
||||
|
||||
$spacing_settings = wp_parse_args(
|
||||
get_option( 'generate_spacing_settings', array() ),
|
||||
generate_spacing_get_defaults()
|
||||
);
|
||||
|
||||
$content_width_calc = sprintf(
|
||||
'calc(%1$s - %2$s - %3$s)',
|
||||
absint( $content_width ) . 'px',
|
||||
absint( $spacing_settings['content_left'] ) . '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' );
|
||||
|
||||
if ( 'true' === get_post_meta( get_the_ID(), '_generate-full-width-content', true ) ) {
|
||||
$css->add_property( 'max-width', '100%' );
|
||||
} else {
|
||||
$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->add_property( 'max-width', 'none' );
|
||||
|
||||
$css->set_selector( '.wp-block[data-align="wide"]' );
|
||||
$css->add_property( 'max-width', absint( $content_width ), false, 'px' );
|
||||
|
||||
if ( apply_filters( 'generate_do_group_inner_container_style', true ) ) {
|
||||
$css->set_selector( '.wp-block-group__inner-container' );
|
||||
$css->add_property( 'max-width', absint( $content_width ), false, 'px' );
|
||||
$css->add_property( 'margin-left', '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->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( '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->add_property( 'color', $color_settings['form_button_text_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() );
|
||||
$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() );
|
||||
$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() );
|
||||
$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() );
|
||||
$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->add_property( 'font-family', $body_family );
|
||||
$css->add_property( 'font-size', absint( $font_settings['body_font_size'] ), false, 'px' );
|
||||
|
||||
if ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$css->add_property( 'color', generate_get_option( 'text_color' ) );
|
||||
}
|
||||
|
||||
$css->set_selector( '.content-title-visibility' );
|
||||
|
||||
if ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$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->add_property( 'line-height', floatval( $font_settings['body_line_height'] ) );
|
||||
|
||||
$css->set_selector( 'body .editor-styles-wrapper p' );
|
||||
$css->add_property( 'margin-top', '0px' );
|
||||
$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->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( 'text-transform', $font_settings['heading_1_transform'] );
|
||||
$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( 'margin-bottom', floatval( $font_settings['heading_1_margin_bottom'] ), false, 'px' );
|
||||
$css->add_property( 'margin-top', '0' );
|
||||
|
||||
if ( $color_settings['h1_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['h1_color'] );
|
||||
} elseif ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$css->add_property( 'color', generate_get_option( 'text_color' ) );
|
||||
}
|
||||
|
||||
if ( $color_settings['content_title_color'] ) {
|
||||
$css->set_selector( '.editor-post-title__block .editor-post-title__input' );
|
||||
$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->add_property( 'font-family', $h2_family );
|
||||
$css->add_property( 'font-weight', $font_settings['heading_2_weight'] );
|
||||
$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( '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-top', '0' );
|
||||
|
||||
if ( $color_settings['h2_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['h2_color'] );
|
||||
} elseif ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$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->add_property( 'font-family', $h3_family );
|
||||
$css->add_property( 'font-weight', $font_settings['heading_3_weight'] );
|
||||
$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( '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-top', '0' );
|
||||
|
||||
if ( $color_settings['h3_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['h3_color'] );
|
||||
} elseif ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$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->add_property( 'font-family', $h4_family );
|
||||
$css->add_property( 'font-weight', $font_settings['heading_4_weight'] );
|
||||
$css->add_property( 'text-transform', $font_settings['heading_4_transform'] );
|
||||
$css->add_property( 'margin-bottom', '20px' );
|
||||
$css->add_property( 'margin-top', '0' );
|
||||
|
||||
if ( '' !== $font_settings['heading_4_font_size'] ) {
|
||||
$css->add_property( 'font-size', absint( $font_settings['heading_4_font_size'] ), false, 'px' );
|
||||
} else {
|
||||
$css->add_property( 'font-size', 'inherit' );
|
||||
}
|
||||
|
||||
if ( '' !== $font_settings['heading_4_line_height'] ) {
|
||||
$css->add_property( 'line-height', floatval( $font_settings['heading_4_line_height'] ), false, 'em' );
|
||||
}
|
||||
|
||||
if ( $color_settings['h4_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['h4_color'] );
|
||||
} elseif ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$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->add_property( 'font-family', $h5_family );
|
||||
$css->add_property( 'font-weight', $font_settings['heading_5_weight'] );
|
||||
$css->add_property( 'text-transform', $font_settings['heading_5_transform'] );
|
||||
$css->add_property( 'margin-bottom', '20px' );
|
||||
$css->add_property( 'margin-top', '0' );
|
||||
|
||||
if ( '' !== $font_settings['heading_5_font_size'] ) {
|
||||
$css->add_property( 'font-size', absint( $font_settings['heading_5_font_size'] ), false, 'px' );
|
||||
} else {
|
||||
$css->add_property( 'font-size', 'inherit' );
|
||||
}
|
||||
|
||||
if ( '' !== $font_settings['heading_5_line_height'] ) {
|
||||
$css->add_property( 'line-height', floatval( $font_settings['heading_5_line_height'] ), false, 'em' );
|
||||
}
|
||||
|
||||
if ( $color_settings['h5_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['h5_color'] );
|
||||
} elseif ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$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->add_property( 'font-family', $h6_family );
|
||||
$css->add_property( 'font-weight', $font_settings['heading_6_weight'] );
|
||||
$css->add_property( 'text-transform', $font_settings['heading_6_transform'] );
|
||||
$css->add_property( 'margin-bottom', '20px' );
|
||||
$css->add_property( 'margin-top', '0' );
|
||||
|
||||
if ( '' !== $font_settings['heading_6_font_size'] ) {
|
||||
$css->add_property( 'font-size', absint( $font_settings['heading_6_font_size'] ), false, 'px' );
|
||||
} else {
|
||||
$css->add_property( 'font-size', 'inherit' );
|
||||
}
|
||||
|
||||
if ( '' !== $font_settings['heading_6_line_height'] ) {
|
||||
$css->add_property( 'line-height', floatval( $font_settings['heading_6_line_height'] ), false, 'em' );
|
||||
}
|
||||
|
||||
if ( $color_settings['h6_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['h6_color'] );
|
||||
} elseif ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$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->add_property( 'font-family', $buttons_family );
|
||||
$css->add_property( 'font-weight', $font_settings['buttons_font_weight'] );
|
||||
$css->add_property( 'text-transform', $font_settings['buttons_font_transform'] );
|
||||
|
||||
if ( '' !== $font_settings['buttons_font_size'] ) {
|
||||
$css->add_property( 'font-size', absint( $font_settings['buttons_font_size'] ), false, 'px' );
|
||||
}
|
||||
|
||||
if ( version_compare( $GLOBALS['wp_version'], '5.7-alpha.1', '>' ) ) {
|
||||
$css->set_selector( '.block-editor__container .edit-post-visual-editor' );
|
||||
$css->add_property( 'background-color', generate_get_option( 'background_color' ) );
|
||||
|
||||
$css->set_selector( '.block-editor__container .editor-styles-wrapper' );
|
||||
|
||||
if ( $color_settings['content_background_color'] ) {
|
||||
$css->add_property( 'background-color', $color_settings['content_background_color'] );
|
||||
} else {
|
||||
$css->add_property( 'background-color', generate_get_option( 'background_color' ) );
|
||||
}
|
||||
} else {
|
||||
$css->set_selector( 'body .editor-styles-wrapper' );
|
||||
$css->add_property( 'background-color', generate_get_option( 'background_color' ) );
|
||||
|
||||
if ( $color_settings['content_background_color'] ) {
|
||||
$body_background = generate_get_option( '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->set_selector( '.block-editor-block-list__block a, .block-editor-block-list__block a:visited' );
|
||||
|
||||
if ( $color_settings['content_link_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['content_link_color'] );
|
||||
} else {
|
||||
$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' );
|
||||
|
||||
if ( $color_settings['content_link_hover_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['content_link_hover_color'] );
|
||||
} else {
|
||||
$css->add_property( 'color', generate_get_option( 'link_color_hover' ) );
|
||||
}
|
||||
|
||||
return $css->css_output();
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* Integrate GeneratePress with the WordPress block editor.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Check what sidebar layout we're using.
|
||||
* We need this function as the post meta in generate_get_layout() only runs
|
||||
* on is_singular()
|
||||
*
|
||||
* @since 2.2
|
||||
*
|
||||
* @param bool $meta Check for post meta.
|
||||
* @return string The saved sidebar layout.
|
||||
*/
|
||||
function generate_get_block_editor_sidebar_layout( $meta = true ) {
|
||||
$layout = generate_get_option( 'layout_setting' );
|
||||
|
||||
if ( function_exists( 'get_current_screen' ) ) {
|
||||
$screen = get_current_screen();
|
||||
|
||||
if ( is_object( $screen ) && 'post' === $screen->post_type ) {
|
||||
$layout = generate_get_option( 'single_layout_setting' );
|
||||
}
|
||||
}
|
||||
|
||||
// Add in our default filter in case people have adjusted it.
|
||||
$layout = apply_filters( 'generate_sidebar_layout', $layout );
|
||||
|
||||
if ( $meta ) {
|
||||
$layout_meta = get_post_meta( get_the_ID(), '_generate-sidebar-layout-meta', true );
|
||||
|
||||
if ( $layout_meta ) {
|
||||
$layout = $layout_meta;
|
||||
}
|
||||
}
|
||||
|
||||
return apply_filters( 'generate_block_editor_sidebar_layout', $layout );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether we're disabling the content title or not.
|
||||
* We need this function as the post meta in generate_show_title() only runs
|
||||
* on is_singular()
|
||||
*
|
||||
* @since 2.2
|
||||
*/
|
||||
function generate_get_block_editor_show_content_title() {
|
||||
$title = generate_show_title();
|
||||
|
||||
$disable_title = get_post_meta( get_the_ID(), '_generate-disable-headline', true );
|
||||
|
||||
if ( $disable_title ) {
|
||||
$title = false;
|
||||
}
|
||||
|
||||
return apply_filters( 'generate_block_editor_show_content_title', $title );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the content width for this post.
|
||||
*
|
||||
* @since 2.2
|
||||
*/
|
||||
function generate_get_block_editor_content_width() {
|
||||
$container_width = generate_get_option( 'container_width' );
|
||||
|
||||
$content_width = $container_width;
|
||||
|
||||
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
|
||||
|
||||
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
|
||||
|
||||
$layout = generate_get_block_editor_sidebar_layout();
|
||||
|
||||
if ( 'left-sidebar' === $layout ) {
|
||||
$content_width = $container_width * ( ( 100 - $left_sidebar_width ) / 100 );
|
||||
} elseif ( 'right-sidebar' === $layout ) {
|
||||
$content_width = $container_width * ( ( 100 - $right_sidebar_width ) / 100 );
|
||||
} elseif ( 'no-sidebar' === $layout ) {
|
||||
$content_width = $container_width;
|
||||
} else {
|
||||
$content_width = $container_width * ( ( 100 - ( $left_sidebar_width + $right_sidebar_width ) ) / 100 );
|
||||
}
|
||||
|
||||
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_backend_block_editor_assets' );
|
||||
/**
|
||||
* Add CSS to the admin side of the block editor.
|
||||
*
|
||||
* @since 2.2
|
||||
*/
|
||||
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_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 );
|
||||
|
||||
$show_editor_styles = apply_filters( 'generate_show_block_editor_styles', true );
|
||||
|
||||
if ( $show_editor_styles ) {
|
||||
wp_add_inline_style( 'generate-block-editor-styles', wp_strip_all_tags( generate_do_inline_block_editor_css() ) );
|
||||
|
||||
if ( generate_is_using_dynamic_typography() ) {
|
||||
wp_enqueue_style( 'generate-editor-typography', get_template_directory_uri() . '/assets/css/admin/editor-typography.css', false, GENERATE_VERSION, 'all' );
|
||||
wp_add_inline_style( 'generate-editor-typography', wp_strip_all_tags( GeneratePress_Typography::get_css( 'core', 'editor' ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
wp_enqueue_script(
|
||||
'generate-block-editor',
|
||||
trailingslashit( get_template_directory_uri() ) . 'assets/dist/block-editor.js',
|
||||
array( 'wp-i18n', 'wp-components', 'wp-element' ),
|
||||
GENERATE_VERSION,
|
||||
true
|
||||
);
|
||||
|
||||
$color_settings = wp_parse_args(
|
||||
get_option( 'generate_settings', array() ),
|
||||
generate_get_color_defaults()
|
||||
);
|
||||
|
||||
$spacing_settings = wp_parse_args(
|
||||
get_option( 'generate_spacing_settings', array() ),
|
||||
generate_spacing_get_defaults()
|
||||
);
|
||||
|
||||
$text_color = generate_get_option( 'text_color' );
|
||||
|
||||
if ( $color_settings['content_text_color'] ) {
|
||||
$text_color = $color_settings['content_text_color'];
|
||||
}
|
||||
|
||||
wp_localize_script(
|
||||
'generate-block-editor-scripts',
|
||||
'generate_block_editor',
|
||||
array(
|
||||
'global_sidebar_layout' => generate_get_block_editor_sidebar_layout( false ),
|
||||
'container_width' => generate_get_option( 'container_width' ),
|
||||
'right_sidebar_width' => apply_filters( 'generate_right_sidebar_width', '25' ),
|
||||
'left_sidebar_width' => apply_filters( 'generate_left_sidebar_width', '25' ),
|
||||
'content_padding_right' => absint( $spacing_settings['content_right'] ) . 'px',
|
||||
'content_padding_left' => absint( $spacing_settings['content_left'] ) . 'px',
|
||||
'content_title' => generate_get_block_editor_show_content_title() ? 'true' : 'false',
|
||||
'disable_content_title' => esc_html__( 'Disable Content Title', 'generatepress' ),
|
||||
'show_content_title' => esc_html__( 'Show Content Title', 'generatepress' ),
|
||||
'text_color' => $text_color,
|
||||
'show_editor_styles' => $show_editor_styles,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write our CSS for the block editor.
|
||||
*
|
||||
* @since 2.2
|
||||
*/
|
||||
function generate_do_inline_block_editor_css() {
|
||||
$color_settings = wp_parse_args(
|
||||
get_option( 'generate_settings', array() ),
|
||||
generate_get_color_defaults()
|
||||
);
|
||||
|
||||
$font_settings = wp_parse_args(
|
||||
get_option( 'generate_settings', array() ),
|
||||
generate_get_default_fonts()
|
||||
);
|
||||
|
||||
$css = new GeneratePress_CSS();
|
||||
|
||||
$content_width = generate_get_block_editor_content_width();
|
||||
|
||||
$spacing_settings = wp_parse_args(
|
||||
get_option( 'generate_spacing_settings', array() ),
|
||||
generate_spacing_get_defaults()
|
||||
);
|
||||
|
||||
$content_width_calc = sprintf(
|
||||
'calc(%1$s - %2$s - %3$s)',
|
||||
absint( $content_width ) . 'px',
|
||||
absint( $spacing_settings['content_left'] ) . 'px',
|
||||
absint( $spacing_settings['content_right'] ) . 'px'
|
||||
);
|
||||
|
||||
$css->set_selector( ':root' );
|
||||
|
||||
$global_colors = generate_get_global_colors();
|
||||
|
||||
if ( ! empty( $global_colors ) ) {
|
||||
foreach ( (array) $global_colors as $key => $data ) {
|
||||
if ( ! empty( $data['slug'] ) && ! empty( $data['color'] ) ) {
|
||||
$css->add_property( '--' . $data['slug'], $data['color'] );
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( (array) $global_colors as $key => $data ) {
|
||||
if ( ! empty( $data['slug'] ) && ! empty( $data['color'] ) ) {
|
||||
$css->set_selector( '.has-' . $data['slug'] . '-color' );
|
||||
$css->add_property( 'color', $data['color'] );
|
||||
|
||||
$css->set_selector( '.has-' . $data['slug'] . '-background-color' );
|
||||
$css->add_property( 'background-color', $data['color'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$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 ) ) {
|
||||
$css->add_property( 'max-width', '100%' );
|
||||
} else {
|
||||
$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->add_property( 'max-width', 'none' );
|
||||
|
||||
$css->set_selector( '.wp-block[data-align="wide"]' );
|
||||
$css->add_property( 'max-width', absint( $content_width ), false, 'px' );
|
||||
|
||||
$underline_links = generate_get_option( 'underline_links' );
|
||||
|
||||
if ( 'never' !== $underline_links ) {
|
||||
if ( 'always' === $underline_links ) {
|
||||
$css->set_selector( '.wp-block a' );
|
||||
$css->add_property( 'text-decoration', 'underline' );
|
||||
}
|
||||
|
||||
if ( 'hover' === $underline_links ) {
|
||||
$css->set_selector( '.wp-block a:hover, .wp-block a:focus' );
|
||||
$css->add_property( 'text-decoration', 'underline' );
|
||||
}
|
||||
|
||||
if ( 'not-hover' === $underline_links ) {
|
||||
$css->set_selector( '.wp-block a' );
|
||||
$css->add_property( 'text-decoration', 'underline' );
|
||||
|
||||
$css->set_selector( '.wp-block a:hover, .wp-block a:focus' );
|
||||
$css->add_property( 'text-decoration', 'none' );
|
||||
}
|
||||
|
||||
$css->set_selector( 'a.button, .wp-block-button__link' );
|
||||
$css->add_property( 'text-decoration', 'none' );
|
||||
}
|
||||
|
||||
if ( apply_filters( 'generate_do_group_inner_container_style', true ) ) {
|
||||
$css->set_selector( '.wp-block-group__inner-container' );
|
||||
$css->add_property( 'max-width', absint( $content_width ), false, 'px' );
|
||||
$css->add_property( 'margin-left', '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->set_selector( '.editor-styles-wrapper a.button, .editor-styles-wrapper a.button:visited, .wp-block-button__link:not(.has-background)' );
|
||||
$css->add_property( 'color', $color_settings['form_button_text_color'] );
|
||||
$css->add_property( 'background-color', $color_settings['form_button_background_color'] );
|
||||
$css->add_property( 'padding', '10px 20px' );
|
||||
$css->add_property( 'border', '0' );
|
||||
$css->add_property( 'border-radius', '0' );
|
||||
|
||||
$css->set_selector( '.editor-styles-wrapper a.button:hover, .editor-styles-wrapper a.button:active, .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( 'background-color', $color_settings['form_button_background_color_hover'] );
|
||||
|
||||
if ( ! generate_is_using_dynamic_typography() ) {
|
||||
$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() );
|
||||
$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() );
|
||||
$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() );
|
||||
$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() );
|
||||
}
|
||||
|
||||
$css->set_selector( 'body.gutenberg-editor-page .block-editor-block-list__block, body .editor-styles-wrapper' );
|
||||
|
||||
if ( ! generate_is_using_dynamic_typography() ) {
|
||||
$css->add_property( 'font-family', $body_family );
|
||||
$css->add_property( 'font-size', absint( $font_settings['body_font_size'] ), false, 'px' );
|
||||
}
|
||||
|
||||
if ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$css->add_property( 'color', generate_get_option( 'text_color' ) );
|
||||
}
|
||||
|
||||
$css->set_selector( '.content-title-visibility' );
|
||||
|
||||
if ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$css->add_property( 'color', generate_get_option( 'text_color' ) );
|
||||
}
|
||||
|
||||
if ( ! generate_is_using_dynamic_typography() ) {
|
||||
$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->set_selector( 'body .editor-styles-wrapper p' );
|
||||
$css->add_property( 'margin-top', '0px' );
|
||||
$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-styles-wrapper .editor-post-title__input' );
|
||||
|
||||
if ( ! generate_is_using_dynamic_typography() ) {
|
||||
$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( 'text-transform', $font_settings['heading_1_transform'] );
|
||||
$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( 'margin-bottom', floatval( $font_settings['heading_1_margin_bottom'] ), false, 'px' );
|
||||
$css->add_property( 'margin-top', '0' );
|
||||
}
|
||||
|
||||
if ( $color_settings['h1_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['h1_color'] );
|
||||
} elseif ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$css->add_property( 'color', generate_get_option( 'text_color' ) );
|
||||
}
|
||||
|
||||
if ( $color_settings['content_title_color'] ) {
|
||||
$css->set_selector( '.editor-styles-wrapper .editor-post-title__input' );
|
||||
$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' );
|
||||
|
||||
if ( ! generate_is_using_dynamic_typography() ) {
|
||||
$css->add_property( 'font-family', $h2_family );
|
||||
$css->add_property( 'font-weight', $font_settings['heading_2_weight'] );
|
||||
$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( '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-top', '0' );
|
||||
}
|
||||
|
||||
if ( $color_settings['h2_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['h2_color'] );
|
||||
} elseif ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$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' );
|
||||
|
||||
if ( ! generate_is_using_dynamic_typography() ) {
|
||||
$css->add_property( 'font-family', $h3_family );
|
||||
$css->add_property( 'font-weight', $font_settings['heading_3_weight'] );
|
||||
$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( '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-top', '0' );
|
||||
}
|
||||
|
||||
if ( $color_settings['h3_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['h3_color'] );
|
||||
} elseif ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$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' );
|
||||
|
||||
if ( ! generate_is_using_dynamic_typography() ) {
|
||||
$css->add_property( 'font-family', $h4_family );
|
||||
$css->add_property( 'font-weight', $font_settings['heading_4_weight'] );
|
||||
$css->add_property( 'text-transform', $font_settings['heading_4_transform'] );
|
||||
$css->add_property( 'margin-bottom', '20px' );
|
||||
$css->add_property( 'margin-top', '0' );
|
||||
|
||||
if ( '' !== $font_settings['heading_4_font_size'] ) {
|
||||
$css->add_property( 'font-size', absint( $font_settings['heading_4_font_size'] ), false, 'px' );
|
||||
} else {
|
||||
$css->add_property( 'font-size', 'inherit' );
|
||||
}
|
||||
|
||||
if ( '' !== $font_settings['heading_4_line_height'] ) {
|
||||
$css->add_property( 'line-height', floatval( $font_settings['heading_4_line_height'] ), false, 'em' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $color_settings['h4_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['h4_color'] );
|
||||
} elseif ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$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' );
|
||||
|
||||
if ( ! generate_is_using_dynamic_typography() ) {
|
||||
$css->add_property( 'font-family', $h5_family );
|
||||
$css->add_property( 'font-weight', $font_settings['heading_5_weight'] );
|
||||
$css->add_property( 'text-transform', $font_settings['heading_5_transform'] );
|
||||
$css->add_property( 'margin-bottom', '20px' );
|
||||
$css->add_property( 'margin-top', '0' );
|
||||
|
||||
if ( '' !== $font_settings['heading_5_font_size'] ) {
|
||||
$css->add_property( 'font-size', absint( $font_settings['heading_5_font_size'] ), false, 'px' );
|
||||
} else {
|
||||
$css->add_property( 'font-size', 'inherit' );
|
||||
}
|
||||
|
||||
if ( '' !== $font_settings['heading_5_line_height'] ) {
|
||||
$css->add_property( 'line-height', floatval( $font_settings['heading_5_line_height'] ), false, 'em' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $color_settings['h5_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['h5_color'] );
|
||||
} elseif ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$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' );
|
||||
|
||||
if ( ! generate_is_using_dynamic_typography() ) {
|
||||
$css->add_property( 'font-family', $h6_family );
|
||||
$css->add_property( 'font-weight', $font_settings['heading_6_weight'] );
|
||||
$css->add_property( 'text-transform', $font_settings['heading_6_transform'] );
|
||||
$css->add_property( 'margin-bottom', '20px' );
|
||||
$css->add_property( 'margin-top', '0' );
|
||||
|
||||
if ( '' !== $font_settings['heading_6_font_size'] ) {
|
||||
$css->add_property( 'font-size', absint( $font_settings['heading_6_font_size'] ), false, 'px' );
|
||||
} else {
|
||||
$css->add_property( 'font-size', 'inherit' );
|
||||
}
|
||||
|
||||
if ( '' !== $font_settings['heading_6_line_height'] ) {
|
||||
$css->add_property( 'line-height', floatval( $font_settings['heading_6_line_height'] ), false, 'em' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $color_settings['h6_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['h6_color'] );
|
||||
} elseif ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$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' );
|
||||
|
||||
if ( ! generate_is_using_dynamic_typography() ) {
|
||||
$css->add_property( 'font-family', $buttons_family );
|
||||
$css->add_property( 'font-weight', $font_settings['buttons_font_weight'] );
|
||||
$css->add_property( 'text-transform', $font_settings['buttons_font_transform'] );
|
||||
|
||||
if ( '' !== $font_settings['buttons_font_size'] ) {
|
||||
$css->add_property( 'font-size', absint( $font_settings['buttons_font_size'] ), false, 'px' );
|
||||
} else {
|
||||
$css->add_property( 'font-size', 'inherit' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( version_compare( $GLOBALS['wp_version'], '5.7-alpha.1', '>' ) ) {
|
||||
$css->set_selector( '.block-editor__container .edit-post-visual-editor' );
|
||||
$css->add_property( 'background-color', generate_get_option( 'background_color' ) );
|
||||
|
||||
$css->set_selector( '.block-editor__container .editor-styles-wrapper' );
|
||||
|
||||
if ( $color_settings['content_background_color'] ) {
|
||||
$css->add_property( 'background-color', $color_settings['content_background_color'] );
|
||||
} else {
|
||||
$css->add_property( 'background-color', generate_get_option( 'background_color' ) );
|
||||
}
|
||||
} else {
|
||||
$css->set_selector( 'body .editor-styles-wrapper' );
|
||||
$css->add_property( 'background-color', generate_get_option( 'background_color' ) );
|
||||
|
||||
if ( $color_settings['content_background_color'] ) {
|
||||
$body_background = generate_get_option( '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->set_selector( '.block-editor-block-list__block a, .block-editor-block-list__block a:visited' );
|
||||
|
||||
if ( $color_settings['content_link_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['content_link_color'] );
|
||||
} else {
|
||||
$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' );
|
||||
|
||||
if ( $color_settings['content_link_hover_color'] ) {
|
||||
$css->add_property( 'color', $color_settings['content_link_hover_color'] );
|
||||
} else {
|
||||
$css->add_property( 'color', generate_get_option( 'link_color_hover' ) );
|
||||
}
|
||||
|
||||
return $css->css_output();
|
||||
}
|
||||
|
266
wp-content/themes/generatepress/inc/class-dashboard.php
Normal file
266
wp-content/themes/generatepress/inc/class-dashboard.php
Normal file
@ -0,0 +1,266 @@
|
||||
<?php
|
||||
/**
|
||||
* Build our admin dashboard.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* This class adds HTML attributes to various theme elements.
|
||||
*/
|
||||
class GeneratePress_Dashboard {
|
||||
/**
|
||||
* Class instance.
|
||||
*
|
||||
* @access private
|
||||
* @var $instance Class instance.
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Initiator
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! isset( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get started.
|
||||
*/
|
||||
public function __construct() {
|
||||
// Load our old dashboard if we're using an old version of GP Premium.
|
||||
if ( defined( 'GP_PREMIUM_VERSION' ) && version_compare( GP_PREMIUM_VERSION, '2.1.0-alpha.1', '<' ) ) {
|
||||
require_once get_template_directory() . '/inc/dashboard.php';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
add_action( 'admin_menu', array( $this, 'add_menu_item' ) );
|
||||
add_filter( 'admin_body_class', array( $this, 'set_admin_body_class' ) );
|
||||
add_action( 'in_admin_header', array( $this, 'add_header' ) );
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
||||
add_action( 'generate_admin_dashboard', array( $this, 'start_customizing' ) );
|
||||
add_action( 'generate_admin_dashboard', array( $this, 'go_pro' ), 15 );
|
||||
add_action( 'generate_admin_dashboard', array( $this, 'reset' ), 100 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add our dashboard menu item.
|
||||
*/
|
||||
public function add_menu_item() {
|
||||
add_theme_page(
|
||||
esc_html__( 'GeneratePress', 'generatepress' ),
|
||||
esc_html__( 'GeneratePress', 'generatepress' ),
|
||||
apply_filters( 'generate_dashboard_page_capability', 'edit_theme_options' ),
|
||||
'generate-options',
|
||||
array( $this, 'page' )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get our dashboard pages so we can style them.
|
||||
*/
|
||||
public static function get_pages() {
|
||||
return apply_filters(
|
||||
'generate_dashboard_screens',
|
||||
array(
|
||||
'appearance_page_generate-options',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a body class on GP dashboard pages.
|
||||
*
|
||||
* @param string $classes The existing classes.
|
||||
*/
|
||||
public function set_admin_body_class( $classes ) {
|
||||
$dashboard_pages = self::get_pages();
|
||||
$current_screen = get_current_screen();
|
||||
|
||||
if ( in_array( $current_screen->id, $dashboard_pages ) ) {
|
||||
$classes .= ' generate-dashboard-page';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build our Dashboard header.
|
||||
*/
|
||||
public static function header() {
|
||||
?>
|
||||
<div class="generatepress-dashboard-header">
|
||||
<div class="generatepress-dashboard-header__title">
|
||||
<h1>
|
||||
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 600"><path d="M485.2 427.8l-99.1-46.2 15.8-34c5.6-11.9 8.8-24.3 10-36.7 3.3-33.7-9-67.3-33.2-91.1-8.9-8.7-19.3-16.1-31.3-21.7-11.9-5.6-24.3-8.8-36.7-10-33.7-3.3-67.4 9-91.1 33.2-8.7 8.9-16.1 19.3-21.7 31.3l-15.8 34-30.4 65.2c-.7 1.5-.1 3.3 1.5 4l65.2 30.4 34 15.8 34 15.8 68 31.7 74.7 34.8c-65 45.4-152.1 55.2-228.7 17.4C90.2 447.4 44.1 313.3 97.3 202.6c53.3-110.8 186-158.5 297.8-106.3 88.1 41.1 137.1 131.9 129.1 223.4-.1 1.3.6 2.4 1.7 3l65.6 30.6c1.8.8 3.9-.3 4.2-2.2 22.6-130.7-44-265.4-170.5-323.5-150.3-69-327-4.1-396.9 145.8-70 150.1-5.1 328.5 145.1 398.5 114.1 53.2 244.5 28.4 331.3-52.3 17.9-16.6 33.9-35.6 47.5-56.8 1-1.5.4-3.6-1.3-4.3l-65.7-30.7zm-235-109.6l15.8-34c8.8-18.8 31.1-26.9 49.8-18.1s26.9 31 18.1 49.8l-15.8 34-34-15.8-33.9-15.9z" fill="currentColor" /></svg>
|
||||
<?php echo esc_html( get_admin_page_title() ); ?>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<?php self::navigation(); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Build our Dashboard menu.
|
||||
*/
|
||||
public static function navigation() {
|
||||
$screen = get_current_screen();
|
||||
|
||||
$tabs = apply_filters(
|
||||
'generate_dashboard_tabs',
|
||||
array(
|
||||
'dashboard' => array(
|
||||
'name' => __( 'Dashboard', 'generatepress' ),
|
||||
'url' => admin_url( 'themes.php?page=generate-options' ),
|
||||
'class' => 'appearance_page_generate-options' === $screen->id ? 'active' : '',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
if ( ! defined( 'GP_PREMIUM_VERSION' ) ) {
|
||||
$tabs['premium'] = array(
|
||||
'name' => __( 'Premium', 'generatepress' ),
|
||||
'url' => 'https://generatepress.com/premium',
|
||||
'class' => '',
|
||||
'external' => true,
|
||||
);
|
||||
}
|
||||
|
||||
$tabs['support'] = array(
|
||||
'name' => __( 'Support', 'generatepress' ),
|
||||
'url' => 'https://generatepress.com/support',
|
||||
'class' => '',
|
||||
'external' => true,
|
||||
);
|
||||
|
||||
$tabs['documentation'] = array(
|
||||
'name' => __( 'Documentation', 'generatepress' ),
|
||||
'url' => 'https://docs.generatepress.com',
|
||||
'class' => '',
|
||||
'external' => true,
|
||||
);
|
||||
?>
|
||||
<div class="generatepress-dashboard-header__navigation">
|
||||
<?php
|
||||
foreach ( $tabs as $tab ) {
|
||||
printf(
|
||||
'<a href="%1$s" class="%2$s"%4$s>%3$s</a>',
|
||||
esc_url( $tab['url'] ),
|
||||
esc_attr( $tab['class'] ),
|
||||
esc_html( $tab['name'] ),
|
||||
! empty( $tab['external'] ) ? 'target="_blank" rel="noreferrer noopener"' : ''
|
||||
);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Add our Dashboard headers.
|
||||
*/
|
||||
public function add_header() {
|
||||
$dashboard_pages = self::get_pages();
|
||||
$current_screen = get_current_screen();
|
||||
|
||||
if ( in_array( $current_screen->id, $dashboard_pages ) ) {
|
||||
self::header();
|
||||
|
||||
/**
|
||||
* generate_dashboard_after_header hook.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
do_action( 'generate_dashboard_after_header' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add our scripts to the page.
|
||||
*/
|
||||
public function enqueue_scripts() {
|
||||
$dashboard_pages = self::get_pages();
|
||||
$current_screen = get_current_screen();
|
||||
|
||||
if ( in_array( $current_screen->id, $dashboard_pages ) ) {
|
||||
wp_enqueue_style(
|
||||
'generate-dashboard',
|
||||
get_template_directory_uri() . '/assets/dist/style-dashboard.css',
|
||||
array( 'wp-components' ),
|
||||
GENERATE_VERSION
|
||||
);
|
||||
|
||||
if ( 'appearance_page_generate-options' === $current_screen->id ) {
|
||||
wp_enqueue_script(
|
||||
'generate-dashboard',
|
||||
get_template_directory_uri() . '/assets/dist/dashboard.js',
|
||||
array( 'wp-api', 'wp-i18n', 'wp-components', 'wp-element', 'wp-api-fetch' ),
|
||||
GENERATE_VERSION,
|
||||
true
|
||||
);
|
||||
|
||||
wp_set_script_translations( 'generate-dashboard', 'generatepress' );
|
||||
|
||||
wp_localize_script(
|
||||
'generate-dashboard',
|
||||
'generateDashboard',
|
||||
array(
|
||||
'hasPremium' => defined( 'GP_PREMIUM_VERSION' ),
|
||||
'customizeSectionUrls' => array(
|
||||
'siteIdentitySection' => admin_url( 'customize.php?autofocus[section]=title_tagline' ),
|
||||
'colorsSection' => admin_url( 'customize.php?autofocus[section]=generate_colors_section' ),
|
||||
'typographySection' => admin_url( 'customize.php?autofocus[section]=generate_typography_section' ),
|
||||
'layoutSection' => admin_url( 'customize.php?autofocus[section]=generate_layout_panel' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the HTML for our page.
|
||||
*/
|
||||
public function page() {
|
||||
?>
|
||||
<div class="wrap">
|
||||
<div class="generatepress-dashboard">
|
||||
<?php do_action( 'generate_admin_dashboard' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the container for our start customizing app.
|
||||
*/
|
||||
public function start_customizing() {
|
||||
echo '<div id="generatepress-dashboard-app"></div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the container for our start customizing app.
|
||||
*/
|
||||
public function go_pro() {
|
||||
echo '<div id="generatepress-dashboard-go-pro"></div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the container for our reset app.
|
||||
*/
|
||||
public function reset() {
|
||||
echo '<div id="generatepress-reset"></div>';
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePress_Dashboard::get_instance();
|
465
wp-content/themes/generatepress/inc/class-html-attributes.php
Normal file
465
wp-content/themes/generatepress/inc/class-html-attributes.php
Normal file
@ -0,0 +1,465 @@
|
||||
<?php
|
||||
/**
|
||||
* Add HTML attributes to our theme elements.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* This class adds HTML attributes to various theme elements.
|
||||
*/
|
||||
class GeneratePress_HTML_Attributes {
|
||||
/**
|
||||
* Class instance.
|
||||
*
|
||||
* @access private
|
||||
* @var $instance Class instance.
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Initiator
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! isset( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
add_filter( 'generate_parse_attr', array( $this, 'parse_attributes' ), 10, 3 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the attributes.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The current attributes.
|
||||
* @param string $context The context in which attributes are applied.
|
||||
* @param array $settings Custom settings passed to the filter.
|
||||
*/
|
||||
public function parse_attributes( $attributes, $context, $settings ) {
|
||||
switch ( $context ) {
|
||||
case 'top-bar':
|
||||
return $this->top_bar( $attributes );
|
||||
|
||||
case 'inside-top-bar':
|
||||
return $this->inside_top_bar( $attributes );
|
||||
|
||||
case 'header':
|
||||
return $this->site_header( $attributes );
|
||||
|
||||
case 'inside-header':
|
||||
return $this->inside_site_header( $attributes );
|
||||
|
||||
case 'menu-toggle':
|
||||
return $this->menu_toggle( $attributes );
|
||||
|
||||
case 'navigation':
|
||||
return $this->primary_navigation( $attributes );
|
||||
|
||||
case 'inside-navigation':
|
||||
return $this->primary_inner_navigation( $attributes );
|
||||
|
||||
case 'mobile-menu-control-wrapper':
|
||||
return $this->mobile_menu_control_wrapper( $attributes );
|
||||
|
||||
case 'site-info':
|
||||
return $this->site_info( $attributes );
|
||||
|
||||
case 'inside-site-info':
|
||||
return $this->inside_site_info( $attributes );
|
||||
|
||||
case 'entry-header':
|
||||
return $this->entry_header( $attributes );
|
||||
|
||||
case 'page-header':
|
||||
return $this->page_header( $attributes );
|
||||
|
||||
case 'site-content':
|
||||
return $this->site_content( $attributes );
|
||||
|
||||
case 'page':
|
||||
return $this->page( $attributes );
|
||||
|
||||
case 'content':
|
||||
return $this->content( $attributes );
|
||||
|
||||
case 'main':
|
||||
return $this->main( $attributes );
|
||||
|
||||
case 'post-navigation':
|
||||
return $this->post_navigation( $attributes );
|
||||
|
||||
case 'left-sidebar':
|
||||
return $this->left_sidebar( $attributes );
|
||||
|
||||
case 'right-sidebar':
|
||||
return $this->right_sidebar( $attributes );
|
||||
|
||||
case 'footer-widgets-container':
|
||||
return $this->footer_widgets_container( $attributes );
|
||||
|
||||
case 'comment-body':
|
||||
return $this->comment_body( $attributes, $settings );
|
||||
|
||||
case 'comment-meta':
|
||||
return $this->comment_meta( $attributes );
|
||||
|
||||
case 'footer-entry-meta':
|
||||
return $this->footer_entry_meta( $attributes );
|
||||
}
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our top bar.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function top_bar( $attributes ) {
|
||||
$classes = generate_get_element_classes( 'top_bar' );
|
||||
|
||||
if ( $classes ) {
|
||||
$attributes['class'] .= ' ' . join( ' ', $classes );
|
||||
}
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our inside top bar container.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function inside_top_bar( $attributes ) {
|
||||
$attributes['class'] .= ' inside-top-bar';
|
||||
|
||||
if ( 'contained' === generate_get_option( 'top_bar_inner_width' ) ) {
|
||||
$attributes['class'] .= ' grid-container';
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$attributes['class'] .= ' grid-parent';
|
||||
}
|
||||
}
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our site header.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function site_header( $attributes ) {
|
||||
$attributes['id'] = 'masthead';
|
||||
$attributes['aria-label'] = esc_attr__( 'Site', 'generatepress' );
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our inside site header container.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function inside_site_header( $attributes ) {
|
||||
$classes = generate_get_element_classes( 'inside_header' );
|
||||
|
||||
if ( $classes ) {
|
||||
$attributes['class'] .= ' ' . join( ' ', $classes );
|
||||
}
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our menu toggle.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function menu_toggle( $attributes ) {
|
||||
$attributes['class'] .= ' menu-toggle';
|
||||
$attributes['aria-controls'] = 'primary-menu';
|
||||
$attributes['aria-expanded'] = 'false';
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our main navigation.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function primary_navigation( $attributes ) {
|
||||
$attributes['id'] = 'site-navigation';
|
||||
$attributes['aria-label'] = esc_attr__( 'Primary', 'generatepress' );
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our main navigation.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function primary_inner_navigation( $attributes ) {
|
||||
$classes = generate_get_element_classes( 'inside_navigation' );
|
||||
|
||||
if ( $classes ) {
|
||||
$attributes['class'] .= ' ' . join( ' ', $classes );
|
||||
}
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our main navigation.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function mobile_menu_control_wrapper( $attributes ) {
|
||||
$attributes['id'] = 'mobile-menu-control-wrapper';
|
||||
$attributes['class'] .= ' main-navigation mobile-menu-control-wrapper';
|
||||
$attributes['aria-label'] = esc_attr__( 'Mobile Toggle', 'generatepress' );
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our footer element.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function site_info( $attributes ) {
|
||||
$attributes['class'] .= ' site-info';
|
||||
$attributes['aria-label'] = esc_attr__( 'Site', 'generatepress' );
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our inside site info container.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function inside_site_info( $attributes ) {
|
||||
$attributes['class'] .= ' inside-site-info';
|
||||
|
||||
if ( 'full-width' !== generate_get_option( 'footer_inner_width' ) ) {
|
||||
$attributes['class'] .= ' grid-container';
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$attributes['class'] .= ' grid-parent';
|
||||
}
|
||||
}
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our entry headers.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function entry_header( $attributes ) {
|
||||
$attributes['class'] .= ' entry-header';
|
||||
$attributes['aria-label'] = esc_attr__( 'Content', 'generatepress' );
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our page headers.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function page_header( $attributes ) {
|
||||
$attributes['class'] .= ' page-header';
|
||||
$attributes['aria-label'] = esc_attr__( 'Page', 'generatepress' );
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our entry headers.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function post_navigation( $attributes ) {
|
||||
if ( is_single() ) {
|
||||
$attributes['class'] .= ' post-navigation';
|
||||
$attributes['aria-label'] = esc_attr__( 'Single Post', 'generatepress' );
|
||||
} else {
|
||||
$attributes['class'] .= ' paging-navigation';
|
||||
$attributes['aria-label'] = esc_attr__( 'Archive Page', 'generatepress' );
|
||||
}
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our page container.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function page( $attributes ) {
|
||||
$attributes['id'] = 'page';
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our site content container.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function site_content( $attributes ) {
|
||||
$attributes['id'] = 'content';
|
||||
$attributes['class'] .= ' site-content';
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our primary content container.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function content( $attributes ) {
|
||||
$attributes['id'] = 'primary';
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our primary content container.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function main( $attributes ) {
|
||||
$attributes['id'] = 'main';
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our left sidebar.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function left_sidebar( $attributes ) {
|
||||
$classes = generate_get_element_classes( 'left_sidebar' );
|
||||
|
||||
if ( $classes ) {
|
||||
$attributes['class'] .= ' ' . join( ' ', $classes );
|
||||
}
|
||||
|
||||
$attributes['id'] = 'left-sidebar';
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our right sidebar.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function right_sidebar( $attributes ) {
|
||||
$classes = generate_get_element_classes( 'right_sidebar' );
|
||||
|
||||
if ( $classes ) {
|
||||
$attributes['class'] .= ' ' . join( ' ', $classes );
|
||||
}
|
||||
|
||||
$attributes['id'] = 'right-sidebar';
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our footer widget inner container.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function footer_widgets_container( $attributes ) {
|
||||
$classes = generate_get_element_classes( 'inside_footer' );
|
||||
|
||||
if ( $classes ) {
|
||||
$attributes['class'] .= ' ' . join( ' ', $classes );
|
||||
}
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our footer widget inner container.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
* @param array $settings Settings passed through the function.
|
||||
*/
|
||||
public function comment_body( $attributes, $settings ) {
|
||||
$attributes['class'] .= ' comment-body';
|
||||
$attributes['id'] = 'div-comment-' . $settings['comment-id'];
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our comment meta.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function comment_meta( $attributes ) {
|
||||
$attributes['class'] .= ' comment-meta';
|
||||
$attributes['aria-label'] = esc_attr__( 'Comment meta', 'generatepress' );
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to our footer entry meta.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param array $attributes The existing attributes.
|
||||
*/
|
||||
public function footer_entry_meta( $attributes ) {
|
||||
$attributes['class'] .= ' entry-meta';
|
||||
$attributes['aria-label'] = esc_attr__( 'Entry meta', 'generatepress' );
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePress_HTML_Attributes::get_instance();
|
151
wp-content/themes/generatepress/inc/class-rest.php
Normal file
151
wp-content/themes/generatepress/inc/class-rest.php
Normal file
@ -0,0 +1,151 @@
|
||||
<?php
|
||||
/**
|
||||
* Rest API functions
|
||||
*
|
||||
* @package GenerateBlocks
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class GenerateBlocks_Rest
|
||||
*/
|
||||
class GeneratePress_Rest extends WP_REST_Controller {
|
||||
/**
|
||||
* Instance.
|
||||
*
|
||||
* @access private
|
||||
* @var object Instance
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Namespace.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $namespace = 'generatepress/v';
|
||||
|
||||
/**
|
||||
* Version.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $version = '1';
|
||||
|
||||
/**
|
||||
* Initiator.
|
||||
*
|
||||
* @return object initialized object of class.
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! isset( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* GeneratePress_Rest constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'rest_api_init', array( $this, 'register_routes' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register rest routes.
|
||||
*/
|
||||
public function register_routes() {
|
||||
$namespace = $this->namespace . $this->version;
|
||||
|
||||
register_rest_route(
|
||||
$namespace,
|
||||
'/reset/',
|
||||
array(
|
||||
'methods' => WP_REST_Server::EDITABLE,
|
||||
'callback' => array( $this, 'reset' ),
|
||||
'permission_callback' => array( $this, 'update_settings_permission' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get edit options permissions.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function update_settings_permission() {
|
||||
return current_user_can( 'manage_options' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset settings.
|
||||
*
|
||||
* @param WP_REST_Request $request request object.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function reset( WP_REST_Request $request ) {
|
||||
delete_option( 'generate_settings' );
|
||||
delete_option( 'generate_dynamic_css_output' );
|
||||
delete_option( 'generate_dynamic_css_cached_version' );
|
||||
|
||||
return $this->success( __( 'Settings reset.', 'generatepress' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Success rest.
|
||||
*
|
||||
* @param mixed $response response data.
|
||||
* @return mixed
|
||||
*/
|
||||
public function success( $response ) {
|
||||
return new WP_REST_Response(
|
||||
array(
|
||||
'success' => true,
|
||||
'response' => $response,
|
||||
),
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Failed rest.
|
||||
*
|
||||
* @param mixed $response response data.
|
||||
* @return mixed
|
||||
*/
|
||||
public function failed( $response ) {
|
||||
return new WP_REST_Response(
|
||||
array(
|
||||
'success' => false,
|
||||
'response' => $response,
|
||||
),
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Error rest.
|
||||
*
|
||||
* @param mixed $code error code.
|
||||
* @param mixed $response response data.
|
||||
* @return mixed
|
||||
*/
|
||||
public function error( $code, $response ) {
|
||||
return new WP_REST_Response(
|
||||
array(
|
||||
'error' => true,
|
||||
'success' => false,
|
||||
'error_code' => $code,
|
||||
'response' => $response,
|
||||
),
|
||||
401
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePress_Rest::get_instance();
|
@ -1,327 +1,408 @@
|
||||
<?php
|
||||
/**
|
||||
* Migrates old options on update.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Process option updates if necessary.
|
||||
*/
|
||||
class GeneratePress_Theme_Update {
|
||||
/**
|
||||
* Class instance.
|
||||
*
|
||||
* @access private
|
||||
* @var $instance Class instance.
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Initiator
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! isset( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
if ( is_admin() ) {
|
||||
add_action( 'admin_init', __CLASS__ . '::init', 5 );
|
||||
} else {
|
||||
add_action( 'wp', __CLASS__ . '::init', 5 );
|
||||
}
|
||||
|
||||
add_action( 'admin_init', __CLASS__ . '::admin_updates', 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement theme update logic. Only run updates on existing sites.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function init() {
|
||||
if ( is_customize_preview() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$saved_version = get_option( 'generate_db_version', false );
|
||||
|
||||
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.
|
||||
|
||||
$existing_settings = get_option( 'generate_settings', array() );
|
||||
|
||||
// Can't count this as a user-set option since a previous migration script set it.
|
||||
if ( isset( $existing_settings['combine_css'] ) ) {
|
||||
unset( $existing_settings['combine_css'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $existing_settings ) ) {
|
||||
// We have settings, which means this is an old install with no version number.
|
||||
$saved_version = '2.0';
|
||||
} else {
|
||||
// No settings and no saved version, must be a new install.
|
||||
|
||||
if ( 'admin_init' === current_action() ) {
|
||||
// If we're in the admin, add our version to the database.
|
||||
update_option( 'generate_db_version', GENERATE_VERSION );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( version_compare( $saved_version, GENERATE_VERSION, '=' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( version_compare( $saved_version, '2.3.0', '<' ) ) {
|
||||
self::v_2_3_0();
|
||||
}
|
||||
|
||||
if ( version_compare( $saved_version, '3.0.0-alpha.1', '<' ) ) {
|
||||
self::v_3_0_0();
|
||||
}
|
||||
|
||||
// Last thing to do is update our version.
|
||||
update_option( 'generate_db_version', GENERATE_VERSION );
|
||||
}
|
||||
|
||||
/**
|
||||
* Less important updates that should only happen in the Dashboard.
|
||||
* These use a database flag instead of our version number for legacy reasons.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function admin_updates() {
|
||||
self::v_1_3_0();
|
||||
self::v_1_3_29();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove variants from font family values.
|
||||
*
|
||||
* @since 1.3.0
|
||||
*/
|
||||
public static function v_1_3_0() {
|
||||
// Don't run this if Typography add-on is activated.
|
||||
if ( function_exists( 'generate_fonts_customize_register' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$settings = get_option( 'generate_settings', array() );
|
||||
|
||||
if ( ! isset( $settings['font_body'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$value = $settings['font_body'];
|
||||
$needs_update = false;
|
||||
|
||||
// If our value has : in it.
|
||||
if ( ! empty( $value ) && strpos( $value, ':' ) !== false ) {
|
||||
// Remove the : and anything past it.
|
||||
$value = current( explode( ':', $value ) );
|
||||
|
||||
$settings['font_body'] = $value;
|
||||
$needs_update = true;
|
||||
}
|
||||
|
||||
if ( $needs_update ) {
|
||||
update_option( 'generate_settings', $settings );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move logo to custom_logo option as required by WP.org.
|
||||
*
|
||||
* @since 1.3.29
|
||||
*/
|
||||
public static function v_1_3_29() {
|
||||
if ( ! function_exists( 'the_custom_logo' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( get_theme_mod( 'custom_logo' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$settings = get_option( 'generate_settings', array() );
|
||||
|
||||
if ( ! isset( $settings['logo'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$old_value = $settings['logo'];
|
||||
|
||||
if ( empty( $old_value ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$logo = attachment_url_to_postid( $old_value );
|
||||
|
||||
if ( is_int( $logo ) ) {
|
||||
set_theme_mod( 'custom_logo', $logo );
|
||||
}
|
||||
|
||||
if ( get_theme_mod( 'custom_logo' ) ) {
|
||||
$settings['logo'] = '';
|
||||
update_option( 'generate_settings', $settings );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn off the combine CSS option for existing sites.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
public static function v_2_3_0() {
|
||||
$settings = get_option( 'generate_settings', array() );
|
||||
$update_options = false;
|
||||
|
||||
if ( ! isset( $settings['combine_css'] ) ) {
|
||||
$settings['combine_css'] = false;
|
||||
$update_options = true;
|
||||
}
|
||||
|
||||
if ( $update_options ) {
|
||||
update_option( 'generate_settings', $settings );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update sites using old defaults.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function v_3_0_0() {
|
||||
$settings = get_option( 'generate_settings', array() );
|
||||
$update_options = false;
|
||||
|
||||
$old_defaults = array(
|
||||
'icons' => 'font',
|
||||
'structure' => 'floats',
|
||||
'hide_tagline' => '',
|
||||
'container_width' => '1100',
|
||||
'nav_position_setting' => 'nav-below-header',
|
||||
'container_alignment' => 'boxes',
|
||||
'background_color' => '#efefef',
|
||||
'text_color' => '#3a3a3a',
|
||||
'header_text_color' => '#3a3a3a',
|
||||
'header_link_color' => '#3a3a3a',
|
||||
'navigation_background_color' => '#222222',
|
||||
'navigation_text_color' => '#ffffff',
|
||||
'navigation_background_hover_color' => '#3f3f3f',
|
||||
'navigation_text_hover_color' => '#ffffff',
|
||||
'navigation_background_current_color' => '#3f3f3f',
|
||||
'navigation_text_current_color' => '#ffffff',
|
||||
'subnavigation_background_color' => '#3f3f3f',
|
||||
'subnavigation_text_color' => '#ffffff',
|
||||
'subnavigation_background_hover_color' => '#4f4f4f',
|
||||
'subnavigation_text_hover_color' => '#ffffff',
|
||||
'subnavigation_background_current_color' => '#4f4f4f',
|
||||
'subnavigation_text_current_color' => '#ffffff',
|
||||
'sidebar_widget_title_color' => '#000000',
|
||||
'site_title_font_size' => '45',
|
||||
'mobile_site_title_font_size' => '30',
|
||||
'form_button_background_color' => '#666666',
|
||||
'form_button_background_color_hover' => '#3f3f3f',
|
||||
'footer_background_color' => '#222222',
|
||||
'footer_link_hover_color' => '#606060',
|
||||
'entry_meta_link_color' => '#595959',
|
||||
'entry_meta_link_color_hover' => '#1e73be',
|
||||
'blog_post_title_color' => '',
|
||||
'blog_post_title_hover_color' => '',
|
||||
'heading_1_font_size' => '40',
|
||||
'mobile_heading_1_font_size' => '30',
|
||||
'heading_1_weight' => '300',
|
||||
'heading_2_font_size' => '30',
|
||||
'mobile_heading_2_font_size' => '25',
|
||||
'heading_2_weight' => '300',
|
||||
'heading_3_font_size' => '20',
|
||||
'mobile_heading_3_font_size' => '',
|
||||
'heading_4_font_size' => '',
|
||||
'mobile_heading_4_font_size' => '',
|
||||
'heading_5_font_size' => '',
|
||||
'mobile_heading_5_font_size' => '',
|
||||
);
|
||||
|
||||
foreach ( $old_defaults as $key => $value ) {
|
||||
if ( ! isset( $settings[ $key ] ) ) {
|
||||
$settings[ $key ] = $value;
|
||||
$update_options = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $update_options ) {
|
||||
update_option( 'generate_settings', $settings );
|
||||
}
|
||||
|
||||
$spacing_settings = get_option( 'generate_spacing_settings', array() );
|
||||
$update_spacing_options = false;
|
||||
|
||||
$old_spacing_defaults = array(
|
||||
'left_sidebar_width' => '25',
|
||||
'right_sidebar_width' => '25',
|
||||
'top_bar_right' => '10',
|
||||
'top_bar_left' => '10',
|
||||
'mobile_top_bar_right' => '',
|
||||
'mobile_top_bar_left' => '',
|
||||
'header_top' => '40',
|
||||
'header_bottom' => '40',
|
||||
'mobile_header_right' => '',
|
||||
'mobile_header_left' => '',
|
||||
'mobile_widget_top' => '',
|
||||
'mobile_widget_right' => '',
|
||||
'mobile_widget_bottom' => '',
|
||||
'mobile_widget_left' => '',
|
||||
'mobile_footer_widget_container_top' => '',
|
||||
'mobile_footer_widget_container_right' => '',
|
||||
'mobile_footer_widget_container_bottom' => '',
|
||||
'mobile_footer_widget_container_left' => '',
|
||||
'footer_right' => '20',
|
||||
'footer_left' => '20',
|
||||
'mobile_footer_right' => '10',
|
||||
'mobile_footer_left' => '10',
|
||||
);
|
||||
|
||||
foreach ( $old_spacing_defaults as $key => $value ) {
|
||||
if ( ! isset( $spacing_settings[ $key ] ) ) {
|
||||
$spacing_settings[ $key ] = $value;
|
||||
$update_spacing_options = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $update_spacing_options ) {
|
||||
update_option( 'generate_spacing_settings', $spacing_settings );
|
||||
}
|
||||
|
||||
if ( $update_options || $update_spacing_options ) {
|
||||
delete_option( 'generate_dynamic_css_output' );
|
||||
delete_option( 'generate_dynamic_css_cached_version' );
|
||||
|
||||
// Reset our dynamic CSS file updated time so it regenerates.
|
||||
$dynamic_css_data = get_option( 'generatepress_dynamic_css_data', array() );
|
||||
|
||||
if ( ! empty( $dynamic_css_data ) ) {
|
||||
if ( isset( $dynamic_css_data['updated_time'] ) ) {
|
||||
unset( $dynamic_css_data['updated_time'] );
|
||||
}
|
||||
|
||||
update_option( 'generatepress_dynamic_css_data', $dynamic_css_data );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePress_Theme_Update::get_instance();
|
||||
<?php
|
||||
/**
|
||||
* Migrates old options on update.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Process option updates if necessary.
|
||||
*/
|
||||
class GeneratePress_Theme_Update {
|
||||
/**
|
||||
* Class instance.
|
||||
*
|
||||
* @access private
|
||||
* @var $instance Class instance.
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Initiator
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! isset( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
if ( is_admin() ) {
|
||||
add_action( 'admin_init', __CLASS__ . '::init', 5 );
|
||||
} else {
|
||||
add_action( 'wp', __CLASS__ . '::init', 5 );
|
||||
}
|
||||
|
||||
add_action( 'admin_init', __CLASS__ . '::admin_updates', 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement theme update logic. Only run updates on existing sites.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function init() {
|
||||
if ( is_customize_preview() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$saved_version = get_option( 'generate_db_version', false );
|
||||
|
||||
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.
|
||||
|
||||
$existing_settings = get_option( 'generate_settings', array() );
|
||||
|
||||
// Can't count this as a user-set option since a previous migration script set it.
|
||||
if ( isset( $existing_settings['combine_css'] ) ) {
|
||||
unset( $existing_settings['combine_css'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $existing_settings ) ) {
|
||||
// We have settings, which means this is an old install with no version number.
|
||||
$saved_version = '2.0';
|
||||
} else {
|
||||
// No settings and no saved version, must be a new install.
|
||||
|
||||
if ( 'admin_init' === current_action() ) {
|
||||
// If we're in the admin, add our version to the database.
|
||||
update_option( 'generate_db_version', GENERATE_VERSION );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( version_compare( $saved_version, GENERATE_VERSION, '=' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( version_compare( $saved_version, '2.3.0', '<' ) ) {
|
||||
self::v_2_3_0();
|
||||
}
|
||||
|
||||
if ( version_compare( $saved_version, '3.0.0-alpha.1', '<' ) ) {
|
||||
self::v_3_0_0();
|
||||
}
|
||||
|
||||
if ( version_compare( $saved_version, '3.1.0-alpha.1', '<' ) ) {
|
||||
self::v_3_1_0();
|
||||
}
|
||||
|
||||
// Delete our CSS cache.
|
||||
delete_option( 'generate_dynamic_css_output' );
|
||||
delete_option( 'generate_dynamic_css_cached_version' );
|
||||
|
||||
// Reset our dynamic CSS file updated time so it regenerates.
|
||||
$dynamic_css_data = get_option( 'generatepress_dynamic_css_data', array() );
|
||||
|
||||
if ( ! empty( $dynamic_css_data ) ) {
|
||||
if ( isset( $dynamic_css_data['updated_time'] ) ) {
|
||||
unset( $dynamic_css_data['updated_time'] );
|
||||
}
|
||||
|
||||
update_option( 'generatepress_dynamic_css_data', $dynamic_css_data );
|
||||
}
|
||||
|
||||
// Last thing to do is update our version.
|
||||
update_option( 'generate_db_version', GENERATE_VERSION );
|
||||
}
|
||||
|
||||
/**
|
||||
* Less important updates that should only happen in the Dashboard.
|
||||
* These use a database flag instead of our version number for legacy reasons.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function admin_updates() {
|
||||
self::v_1_3_0();
|
||||
self::v_1_3_29();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove variants from font family values.
|
||||
*
|
||||
* @since 1.3.0
|
||||
*/
|
||||
public static function v_1_3_0() {
|
||||
// Don't run this if Typography add-on is activated.
|
||||
if ( function_exists( 'generate_fonts_customize_register' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$settings = get_option( 'generate_settings', array() );
|
||||
|
||||
if ( ! isset( $settings['font_body'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$value = $settings['font_body'];
|
||||
$needs_update = false;
|
||||
|
||||
// If our value has : in it.
|
||||
if ( ! empty( $value ) && strpos( $value, ':' ) !== false ) {
|
||||
// Remove the : and anything past it.
|
||||
$value = current( explode( ':', $value ) );
|
||||
|
||||
$settings['font_body'] = $value;
|
||||
$needs_update = true;
|
||||
}
|
||||
|
||||
if ( $needs_update ) {
|
||||
update_option( 'generate_settings', $settings );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move logo to custom_logo option as required by WP.org.
|
||||
*
|
||||
* @since 1.3.29
|
||||
*/
|
||||
public static function v_1_3_29() {
|
||||
if ( ! function_exists( 'the_custom_logo' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( get_theme_mod( 'custom_logo' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$settings = get_option( 'generate_settings', array() );
|
||||
|
||||
if ( ! isset( $settings['logo'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$old_value = $settings['logo'];
|
||||
|
||||
if ( empty( $old_value ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$logo = attachment_url_to_postid( $old_value );
|
||||
|
||||
if ( is_int( $logo ) ) {
|
||||
set_theme_mod( 'custom_logo', $logo );
|
||||
}
|
||||
|
||||
if ( get_theme_mod( 'custom_logo' ) ) {
|
||||
$settings['logo'] = '';
|
||||
update_option( 'generate_settings', $settings );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn off the combine CSS option for existing sites.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
public static function v_2_3_0() {
|
||||
$settings = get_option( 'generate_settings', array() );
|
||||
$update_options = false;
|
||||
|
||||
if ( ! isset( $settings['combine_css'] ) ) {
|
||||
$settings['combine_css'] = false;
|
||||
$update_options = true;
|
||||
}
|
||||
|
||||
if ( $update_options ) {
|
||||
update_option( 'generate_settings', $settings );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update sites using old defaults.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function v_3_0_0() {
|
||||
$settings = get_option( 'generate_settings', array() );
|
||||
$update_options = false;
|
||||
|
||||
$old_defaults = array(
|
||||
'icons' => 'font',
|
||||
'structure' => 'floats',
|
||||
'hide_tagline' => '',
|
||||
'container_width' => '1100',
|
||||
'nav_position_setting' => 'nav-below-header',
|
||||
'container_alignment' => 'boxes',
|
||||
'background_color' => '#efefef',
|
||||
'text_color' => '#3a3a3a',
|
||||
'header_text_color' => '#3a3a3a',
|
||||
'header_link_color' => '#3a3a3a',
|
||||
'navigation_background_color' => '#222222',
|
||||
'navigation_text_color' => '#ffffff',
|
||||
'navigation_background_hover_color' => '#3f3f3f',
|
||||
'navigation_text_hover_color' => '#ffffff',
|
||||
'navigation_background_current_color' => '#3f3f3f',
|
||||
'navigation_text_current_color' => '#ffffff',
|
||||
'subnavigation_background_color' => '#3f3f3f',
|
||||
'subnavigation_text_color' => '#ffffff',
|
||||
'subnavigation_background_hover_color' => '#4f4f4f',
|
||||
'subnavigation_text_hover_color' => '#ffffff',
|
||||
'subnavigation_background_current_color' => '#4f4f4f',
|
||||
'subnavigation_text_current_color' => '#ffffff',
|
||||
'sidebar_widget_title_color' => '#000000',
|
||||
'site_title_font_size' => '45',
|
||||
'mobile_site_title_font_size' => '30',
|
||||
'form_button_background_color' => '#666666',
|
||||
'form_button_background_color_hover' => '#3f3f3f',
|
||||
'footer_background_color' => '#222222',
|
||||
'footer_link_hover_color' => '#606060',
|
||||
'entry_meta_link_color' => '#595959',
|
||||
'entry_meta_link_color_hover' => '#1e73be',
|
||||
'blog_post_title_color' => '',
|
||||
'blog_post_title_hover_color' => '',
|
||||
'heading_1_font_size' => '40',
|
||||
'mobile_heading_1_font_size' => '30',
|
||||
'heading_1_weight' => '300',
|
||||
'heading_2_font_size' => '30',
|
||||
'mobile_heading_2_font_size' => '25',
|
||||
'heading_2_weight' => '300',
|
||||
'heading_3_font_size' => '20',
|
||||
'mobile_heading_3_font_size' => '',
|
||||
'heading_4_font_size' => '',
|
||||
'mobile_heading_4_font_size' => '',
|
||||
'heading_5_font_size' => '',
|
||||
'mobile_heading_5_font_size' => '',
|
||||
);
|
||||
|
||||
foreach ( $old_defaults as $key => $value ) {
|
||||
if ( ! isset( $settings[ $key ] ) ) {
|
||||
$settings[ $key ] = $value;
|
||||
$update_options = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $update_options ) {
|
||||
update_option( 'generate_settings', $settings );
|
||||
}
|
||||
|
||||
$spacing_settings = get_option( 'generate_spacing_settings', array() );
|
||||
$update_spacing_options = false;
|
||||
|
||||
$old_spacing_defaults = array(
|
||||
'left_sidebar_width' => '25',
|
||||
'right_sidebar_width' => '25',
|
||||
'top_bar_right' => '10',
|
||||
'top_bar_left' => '10',
|
||||
'mobile_top_bar_right' => '',
|
||||
'mobile_top_bar_left' => '',
|
||||
'header_top' => '40',
|
||||
'header_bottom' => '40',
|
||||
'mobile_header_right' => '',
|
||||
'mobile_header_left' => '',
|
||||
'mobile_widget_top' => '',
|
||||
'mobile_widget_right' => '',
|
||||
'mobile_widget_bottom' => '',
|
||||
'mobile_widget_left' => '',
|
||||
'mobile_footer_widget_container_top' => '',
|
||||
'mobile_footer_widget_container_right' => '',
|
||||
'mobile_footer_widget_container_bottom' => '',
|
||||
'mobile_footer_widget_container_left' => '',
|
||||
'footer_right' => '20',
|
||||
'footer_left' => '20',
|
||||
'mobile_footer_right' => '10',
|
||||
'mobile_footer_left' => '10',
|
||||
);
|
||||
|
||||
foreach ( $old_spacing_defaults as $key => $value ) {
|
||||
if ( ! isset( $spacing_settings[ $key ] ) ) {
|
||||
$spacing_settings[ $key ] = $value;
|
||||
$update_spacing_options = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $update_spacing_options ) {
|
||||
update_option( 'generate_spacing_settings', $spacing_settings );
|
||||
}
|
||||
|
||||
if ( $update_options || $update_spacing_options ) {
|
||||
delete_option( 'generate_dynamic_css_output' );
|
||||
delete_option( 'generate_dynamic_css_cached_version' );
|
||||
|
||||
// Reset our dynamic CSS file updated time so it regenerates.
|
||||
$dynamic_css_data = get_option( 'generatepress_dynamic_css_data', array() );
|
||||
|
||||
if ( ! empty( $dynamic_css_data ) ) {
|
||||
if ( isset( $dynamic_css_data['updated_time'] ) ) {
|
||||
unset( $dynamic_css_data['updated_time'] );
|
||||
}
|
||||
|
||||
update_option( 'generatepress_dynamic_css_data', $dynamic_css_data );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update sites using old defaults.
|
||||
*
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public static function v_3_1_0() {
|
||||
$settings = get_option( 'generate_settings', array() );
|
||||
$update_options = false;
|
||||
|
||||
$old_defaults = array(
|
||||
'underline_links' => 'never',
|
||||
'use_dynamic_typography' => false,
|
||||
'background_color' => '#f7f8f9',
|
||||
'text_color' => '#222222',
|
||||
'link_color' => '#1e73be',
|
||||
'link_color_hover' => '#000000',
|
||||
'header_background_color' => '#ffffff',
|
||||
'site_title_color' => '#222222',
|
||||
'site_tagline_color' => '#757575',
|
||||
'navigation_background_color' => '#ffffff',
|
||||
'navigation_background_hover_color' => '#ffffff',
|
||||
'navigation_background_current_color' => '#ffffff',
|
||||
'navigation_text_color' => '#515151',
|
||||
'navigation_text_hover_color' => '#7a8896',
|
||||
'navigation_text_current_color' => '#7a8896',
|
||||
'subnavigation_background_color' => '#eaeaea',
|
||||
'subnavigation_background_hover_color' => '#eaeaea',
|
||||
'subnavigation_background_current_color' => '#eaeaea',
|
||||
'subnavigation_text_color' => '#515151',
|
||||
'subnavigation_text_hover_color' => '#7a8896',
|
||||
'subnavigation_text_current_color' => '#7a8896',
|
||||
'content_background_color' => '#ffffff',
|
||||
'blog_post_title_color' => '#222222',
|
||||
'blog_post_title_hover_color' => '#55555e',
|
||||
'entry_meta_text_color' => '#595959',
|
||||
'sidebar_widget_background_color' => '#ffffff',
|
||||
'footer_widget_background_color' => '#ffffff',
|
||||
'footer_widget_title_color' => '#000000',
|
||||
'footer_background_color' => '#55555e',
|
||||
'footer_text_color' => '#ffffff',
|
||||
'footer_link_color' => '#ffffff',
|
||||
'footer_link_hover_color' => '#d3d3d3',
|
||||
'form_background_color' => '#fafafa',
|
||||
'form_text_color' => '#666666',
|
||||
'form_background_color_focus' => '#ffffff',
|
||||
'form_text_color_focus' => '#666666',
|
||||
'form_border_color' => '#cccccc',
|
||||
'form_border_color_focus' => '#bfbfbf',
|
||||
);
|
||||
|
||||
foreach ( $old_defaults as $key => $value ) {
|
||||
if ( ! isset( $settings[ $key ] ) ) {
|
||||
$settings[ $key ] = $value;
|
||||
$update_options = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $update_options ) {
|
||||
update_option( 'generate_settings', $settings );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePress_Theme_Update::get_instance();
|
||||
|
@ -0,0 +1,306 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles typography migration.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles all of our typography migration.
|
||||
*/
|
||||
class GeneratePress_Typography_Migration {
|
||||
/**
|
||||
* Class instance.
|
||||
*
|
||||
* @access private
|
||||
* @var $instance Class instance.
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Initiator
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! isset( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map our new typography keys to the old prefixes.
|
||||
*/
|
||||
public static function get_option_prefixes() {
|
||||
$data = array(
|
||||
array(
|
||||
'selector' => 'body',
|
||||
'legacy_prefix' => 'body',
|
||||
'group' => 'base',
|
||||
'module' => 'core',
|
||||
),
|
||||
array(
|
||||
'selector' => 'top-bar',
|
||||
'legacy_prefix' => 'top_bar',
|
||||
'group' => 'widgets',
|
||||
'module' => 'core',
|
||||
),
|
||||
array(
|
||||
'selector' => 'main-title',
|
||||
'legacy_prefix' => 'site_title',
|
||||
'group' => 'header',
|
||||
'module' => 'core',
|
||||
),
|
||||
array(
|
||||
'selector' => 'site-description',
|
||||
'legacy_prefix' => 'site_tagline',
|
||||
'group' => 'header',
|
||||
'module' => 'core',
|
||||
),
|
||||
array(
|
||||
'selector' => 'primary-menu-items',
|
||||
'legacy_prefix' => 'navigation',
|
||||
'group' => 'primaryNavigation',
|
||||
'module' => 'core',
|
||||
),
|
||||
array(
|
||||
'selector' => 'widget-titles',
|
||||
'legacy_prefix' => 'widget_title',
|
||||
'group' => 'widgets',
|
||||
'module' => 'core',
|
||||
),
|
||||
array(
|
||||
'selector' => 'buttons',
|
||||
'legacy_prefix' => 'buttons',
|
||||
'group' => 'content',
|
||||
'module' => 'core',
|
||||
),
|
||||
array(
|
||||
'selector' => 'single-content-title',
|
||||
'legacy_prefix' => 'single_post_title',
|
||||
'group' => 'content',
|
||||
'module' => 'core',
|
||||
),
|
||||
array(
|
||||
'selector' => 'archive-content-title',
|
||||
'legacy_prefix' => 'archive_post_title',
|
||||
'group' => 'content',
|
||||
'module' => 'core',
|
||||
),
|
||||
array(
|
||||
'selector' => 'footer',
|
||||
'legacy_prefix' => 'footer',
|
||||
'group' => 'footer',
|
||||
'module' => 'core',
|
||||
),
|
||||
);
|
||||
|
||||
$headings = array(
|
||||
'h1' => 'heading_1',
|
||||
'h2' => 'heading_2',
|
||||
'h3' => 'heading_3',
|
||||
'h4' => 'heading_4',
|
||||
'h5' => 'heading_5',
|
||||
'h6' => 'heading_6',
|
||||
);
|
||||
|
||||
foreach ( $headings as $selector => $legacy_prefix ) {
|
||||
$data[] = array(
|
||||
'selector' => $selector,
|
||||
'legacy_prefix' => $legacy_prefix,
|
||||
'group' => 'content',
|
||||
'module' => 'core',
|
||||
);
|
||||
}
|
||||
|
||||
if ( function_exists( 'generate_secondary_nav_typography_selectors' ) ) {
|
||||
$data[] = array(
|
||||
'selector' => 'secondary-nav-menu-items',
|
||||
'legacy_prefix' => 'secondary_navigation',
|
||||
'group' => 'secondaryNavigation',
|
||||
'module' => 'secondary-nav',
|
||||
);
|
||||
}
|
||||
|
||||
if ( function_exists( 'generate_menu_plus_typography_selectors' ) ) {
|
||||
$data[] = array(
|
||||
'selector' => 'off-canvas-panel-menu-items',
|
||||
'legacy_prefix' => 'slideout',
|
||||
'group' => 'offCanvasPanel',
|
||||
'module' => 'off-canvas-panel',
|
||||
);
|
||||
}
|
||||
|
||||
if ( function_exists( 'generate_woocommerce_typography_selectors' ) ) {
|
||||
$data[] = array(
|
||||
'selector' => 'woocommerce-catalog-product-titles',
|
||||
'legacy_prefix' => 'wc_product_title',
|
||||
'group' => 'wooCommerce',
|
||||
'module' => 'woocommerce',
|
||||
);
|
||||
|
||||
$data[] = array(
|
||||
'selector' => 'woocommerce-related-product-titles',
|
||||
'legacy_prefix' => 'wc_related_product_title',
|
||||
'group' => 'wooCommerce',
|
||||
'module' => 'woocommerce',
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we have a saved value.
|
||||
*
|
||||
* @param string $id The option ID.
|
||||
* @param array $settings The saved settings.
|
||||
* @param array $defaults The defaults.
|
||||
*/
|
||||
public static function has_saved_value( $id, $settings, $defaults ) {
|
||||
return isset( $settings[ $id ] )
|
||||
&& isset( $defaults[ $id ] )
|
||||
&& $defaults[ $id ] !== $settings[ $id ] // Need this because the Customizer treats defaults as saved values.
|
||||
&& (
|
||||
! empty( $settings[ $id ] )
|
||||
|| 0 === $settings[ $id ]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of our mapped typography data.
|
||||
*/
|
||||
public static function get_mapped_typography_data() {
|
||||
$settings = get_option( 'generate_settings', array() );
|
||||
$defaults = generate_get_default_fonts();
|
||||
$typography_mapping = array();
|
||||
|
||||
// These options don't have "font" in their IDs.
|
||||
$no_font_in_ids = array(
|
||||
'single_post_title',
|
||||
'archive_post_title',
|
||||
);
|
||||
|
||||
for ( $headings = 1; $headings < 7; $headings++ ) {
|
||||
$no_font_in_ids[] = 'heading_' . $headings;
|
||||
}
|
||||
|
||||
foreach ( self::get_option_prefixes() as $key => $data ) {
|
||||
$legacy_setting_ids = array(
|
||||
'fontFamily' => 'font_' . $data['legacy_prefix'],
|
||||
'fontWeight' => $data['legacy_prefix'] . '_font_weight',
|
||||
'textTransform' => $data['legacy_prefix'] . '_font_transform',
|
||||
'fontSize' => $data['legacy_prefix'] . '_font_size',
|
||||
'fontSizeMobile' => 'mobile_' . $data['legacy_prefix'] . 'font_size',
|
||||
'lineHeight' => $data['legacy_prefix'] . '_line_height',
|
||||
);
|
||||
|
||||
if ( 'slideout' === $data['legacy_prefix'] ) {
|
||||
$legacy_setting_ids['fontSizeMobile'] = $data['legacy_prefix'] . '_mobile_font_size';
|
||||
}
|
||||
|
||||
if ( in_array( $data['legacy_prefix'], $no_font_in_ids ) ) {
|
||||
$legacy_setting_ids['fontWeight'] = $data['legacy_prefix'] . '_weight';
|
||||
$legacy_setting_ids['textTransform'] = $data['legacy_prefix'] . '_transform';
|
||||
}
|
||||
|
||||
foreach ( $legacy_setting_ids as $name => $id ) {
|
||||
if ( self::has_saved_value( $id, $settings, $defaults ) ) {
|
||||
$typography_mapping[ $key ][ $name ] = $settings[ $id ];
|
||||
}
|
||||
|
||||
if ( 'secondary_navigation' === $data['legacy_prefix'] && function_exists( 'generate_secondary_nav_get_defaults' ) ) {
|
||||
$secondary_nav_settings = get_option( 'generate_secondary_nav_settings', array() );
|
||||
$secondary_nav_defaults = generate_secondary_nav_get_defaults();
|
||||
|
||||
if ( self::has_saved_value( $id, $secondary_nav_settings, $secondary_nav_defaults ) ) {
|
||||
$typography_mapping[ $key ][ $name ] = $secondary_nav_settings[ $id ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'body' === $key ) {
|
||||
if ( self::has_saved_value( 'body_line_height', $settings, $defaults ) ) {
|
||||
$typography_mapping[ $key ]['lineHeightUnit'] = '';
|
||||
}
|
||||
|
||||
if ( self::has_saved_value( 'paragraph_margin', $settings, $defaults ) ) {
|
||||
$typography_mapping[ $key ]['marginBottom'] = $settings['paragraph_margin'];
|
||||
$typography_mapping[ $key ]['marginBottomUnit'] = 'em';
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'widget-titles' === $key && self::has_saved_value( 'widget_title_separator', $settings, $defaults ) ) {
|
||||
$typography_mapping[ $key ]['marginBottom'] = $settings['widget_title_separator'];
|
||||
$typography_mapping[ $key ]['marginBottomUnit'] = 'px';
|
||||
}
|
||||
|
||||
if ( 'h1' === $key || 'h2' === $key || 'h3' === $key ) {
|
||||
if ( self::has_saved_value( $data['legacy_prefix'] . '_margin_bottom', $settings, $defaults ) ) {
|
||||
$typography_mapping[ $key ]['marginBottom'] = $settings[ $data['legacy_prefix'] . '_margin_bottom' ];
|
||||
$typography_mapping[ $key ]['marginBottomUnit'] = 'px';
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $typography_mapping[ $key ]['fontSize'] ) ) {
|
||||
$typography_mapping[ $key ]['fontSizeUnit'] = 'px';
|
||||
}
|
||||
|
||||
if ( isset( $typography_mapping[ $key ] ) ) {
|
||||
$typography_mapping[ $key ]['selector'] = $data['selector'];
|
||||
$typography_mapping[ $key ]['module'] = $data['module'];
|
||||
$typography_mapping[ $key ]['group'] = $data['group'];
|
||||
}
|
||||
}
|
||||
|
||||
// Reset array keys starting at 0.
|
||||
$typography_mapping = array_values( $typography_mapping );
|
||||
|
||||
return $typography_mapping;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of our mapped font data.
|
||||
*/
|
||||
public static function get_mapped_font_data() {
|
||||
$font_mapping = array();
|
||||
|
||||
foreach ( self::get_option_prefixes() as $key => $data ) {
|
||||
$settings = get_option( 'generate_settings', array() );
|
||||
$defaults = generate_get_default_fonts();
|
||||
|
||||
if ( 'secondary_navigation' === $data['legacy_prefix'] && function_exists( 'generate_secondary_nav_get_defaults' ) ) {
|
||||
$settings = get_option( 'generate_secondary_nav_settings', array() );
|
||||
$defaults = generate_secondary_nav_get_defaults();
|
||||
}
|
||||
|
||||
if ( self::has_saved_value( 'font_' . $data['legacy_prefix'], $settings, $defaults ) ) {
|
||||
$has_font = array_search( $settings[ 'font_' . $data['legacy_prefix'] ], array_column( $font_mapping, 'fontFamily' ) );
|
||||
|
||||
if ( false !== $has_font ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$font_mapping[ $key ]['fontFamily'] = $settings[ 'font_' . $data['legacy_prefix'] ];
|
||||
|
||||
$local_fonts = generate_typography_default_fonts();
|
||||
|
||||
if ( ! in_array( $settings[ 'font_' . $data['legacy_prefix'] ], $local_fonts ) ) {
|
||||
$font_mapping[ $key ]['googleFont'] = true;
|
||||
$font_mapping[ $key ]['googleFontCategory'] = get_theme_mod( 'font_' . $data['legacy_prefix'] . '_category' );
|
||||
$font_mapping[ $key ]['googleFontVariants'] = get_theme_mod( 'font_' . $data['legacy_prefix'] . '_variants' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reset array keys starting at 0.
|
||||
$font_mapping = array_values( $font_mapping );
|
||||
|
||||
return $font_mapping;
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePress_Typography_Migration::get_instance();
|
383
wp-content/themes/generatepress/inc/class-typography.php
Normal file
383
wp-content/themes/generatepress/inc/class-typography.php
Normal file
@ -0,0 +1,383 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles typography on the front-end.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles all of our typography option output.
|
||||
*/
|
||||
class GeneratePress_Typography {
|
||||
/**
|
||||
* Class instance.
|
||||
*
|
||||
* @access private
|
||||
* @var $instance Class instance.
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Initiator
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! isset( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_google_fonts' ) );
|
||||
add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_google_fonts' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue Google Fonts if they're set.
|
||||
*/
|
||||
public function enqueue_google_fonts() {
|
||||
if ( ! generate_is_using_dynamic_typography() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$fonts = generate_get_option( 'font_manager' );
|
||||
|
||||
if ( empty( $fonts ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = array();
|
||||
|
||||
foreach ( $fonts as $font ) {
|
||||
if ( empty( $font['googleFont'] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$variants = array();
|
||||
|
||||
if ( ! empty( $font['googleFontVariants'] ) ) {
|
||||
// Remove spaces from string.
|
||||
$variants = str_replace( ' ', '', $font['googleFontVariants'] );
|
||||
|
||||
// Turn string into array.
|
||||
$variants = explode( ',', $variants );
|
||||
}
|
||||
|
||||
$variants = apply_filters( 'generate_google_font_variants', $variants, $font['fontFamily'] );
|
||||
|
||||
$name = str_replace( ' ', '+', $font['fontFamily'] );
|
||||
|
||||
if ( $variants ) {
|
||||
$data[] = $name . ':' . implode( ',', $variants );
|
||||
} else {
|
||||
$data[] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $data ) ) {
|
||||
$font_args = apply_filters(
|
||||
'generate_google_font_args',
|
||||
array(
|
||||
'family' => implode( '|', $data ),
|
||||
'subset' => null,
|
||||
'display' => generate_get_option( 'google_font_display' ),
|
||||
)
|
||||
);
|
||||
|
||||
$google_fonts_uri = add_query_arg( $font_args, 'https://fonts.googleapis.com/css' );
|
||||
wp_enqueue_style( 'generate-google-fonts', $google_fonts_uri, array(), GENERATE_VERSION );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build our typography CSS.
|
||||
*
|
||||
* @param string $module The name of the module we're generating CSS for.
|
||||
* @param string $type Either frontend or editor.
|
||||
*/
|
||||
public static function get_css( $module = 'core', $type = 'frontend' ) {
|
||||
$typography = generate_get_option( 'typography' );
|
||||
|
||||
// Get data for a specific module so CSS can be compiled separately.
|
||||
$typography = array_filter(
|
||||
(array) $typography,
|
||||
function( $data ) use ( $module ) {
|
||||
return ( isset( $data['module'] ) && $data['module'] === $module );
|
||||
}
|
||||
);
|
||||
|
||||
if ( ! empty( $typography ) ) {
|
||||
$css = new GeneratePress_CSS();
|
||||
|
||||
$body_selector = 'body';
|
||||
$paragraph_selector = 'p';
|
||||
$tablet_prefix = '';
|
||||
$mobile_prefix = '';
|
||||
|
||||
if ( 'editor' === $type ) {
|
||||
$body_selector = '.editor-styles-wrapper';
|
||||
$paragraph_selector = '.editor-styles-wrapper p';
|
||||
$tablet_prefix = '.gp-is-device-tablet ';
|
||||
$mobile_prefix = '.gp-is-device-mobile ';
|
||||
}
|
||||
|
||||
foreach ( $typography as $key => $data ) {
|
||||
$options = wp_parse_args(
|
||||
$data,
|
||||
self::get_defaults()
|
||||
);
|
||||
|
||||
$selector = self::get_css_selector( $options['selector'], $type );
|
||||
|
||||
if ( 'custom' === $selector ) {
|
||||
$selector = $options['customSelector'];
|
||||
}
|
||||
|
||||
$font_family = self::get_font_family( $options['fontFamily'] );
|
||||
|
||||
$css->set_selector( $selector );
|
||||
$css->add_property( 'font-family', $font_family );
|
||||
$css->add_property( 'font-weight', $options['fontWeight'] );
|
||||
$css->add_property( 'text-transform', $options['textTransform'] );
|
||||
$css->add_property( 'font-size', $options['fontSize'], false, $options['fontSizeUnit'] );
|
||||
$css->add_property( 'letter-spacing', $options['letterSpacing'], false, $options['letterSpacingUnit'] );
|
||||
|
||||
if ( 'body' !== $options['selector'] ) {
|
||||
$css->add_property( 'line-height', $options['lineHeight'], false, $options['lineHeightUnit'] );
|
||||
$css->add_property( 'margin-bottom', $options['marginBottom'], false, $options['marginBottomUnit'] );
|
||||
} else {
|
||||
$css->set_selector( $body_selector );
|
||||
$css->add_property( 'line-height', $options['lineHeight'], false, $options['lineHeightUnit'] );
|
||||
|
||||
$css->set_selector( $paragraph_selector );
|
||||
$css->add_property( 'margin-bottom', $options['marginBottom'], false, $options['marginBottomUnit'] );
|
||||
}
|
||||
|
||||
if ( 'frontend' === $type ) {
|
||||
$css->start_media_query( generate_get_media_query( 'tablet' ) );
|
||||
}
|
||||
|
||||
if ( 'editor' === $type ) {
|
||||
// Add the tablet prefix to each class.
|
||||
$selector = explode( ', ', $selector );
|
||||
$selector = preg_filter( '/^/', $tablet_prefix, $selector );
|
||||
$selector = implode( ', ', $selector );
|
||||
}
|
||||
|
||||
$css->set_selector( $selector );
|
||||
$css->add_property( 'font-size', $options['fontSizeTablet'], false, $options['fontSizeUnit'] );
|
||||
$css->add_property( 'letter-spacing', $options['letterSpacingTablet'], false, $options['letterSpacingUnit'] );
|
||||
|
||||
if ( 'body' !== $options['selector'] ) {
|
||||
$css->add_property( 'line-height', $options['lineHeightTablet'], false, $options['lineHeightUnit'] );
|
||||
$css->add_property( 'margin-bottom', $options['marginBottomTablet'], false, $options['marginBottomUnit'] );
|
||||
} else {
|
||||
$css->set_selector( $tablet_prefix . $body_selector );
|
||||
$css->add_property( 'line-height', $options['lineHeightTablet'], false, $options['lineHeightUnit'] );
|
||||
|
||||
$css->set_selector( $tablet_prefix . $paragraph_selector );
|
||||
$css->add_property( 'margin-bottom', $options['marginBottomTablet'], false, $options['marginBottomUnit'] );
|
||||
}
|
||||
|
||||
if ( 'frontend' === $type ) {
|
||||
$css->stop_media_query();
|
||||
}
|
||||
|
||||
if ( 'frontend' === $type ) {
|
||||
$css->start_media_query( generate_get_media_query( 'mobile' ) );
|
||||
}
|
||||
|
||||
if ( 'editor' === $type ) {
|
||||
$selector = str_replace( '.gp-is-device-tablet', '.gp-is-device-mobile', $selector );
|
||||
}
|
||||
|
||||
$css->set_selector( $selector );
|
||||
$css->add_property( 'font-size', $options['fontSizeMobile'], false, $options['fontSizeUnit'] );
|
||||
$css->add_property( 'letter-spacing', $options['letterSpacingMobile'], false, $options['letterSpacingUnit'] );
|
||||
|
||||
if ( 'body' !== $options['selector'] ) {
|
||||
$css->add_property( 'line-height', $options['lineHeightMobile'], false, $options['lineHeightUnit'] );
|
||||
$css->add_property( 'margin-bottom', $options['marginBottomMobile'], false, $options['marginBottomUnit'] );
|
||||
} else {
|
||||
$css->set_selector( $mobile_prefix . $body_selector );
|
||||
$css->add_property( 'line-height', $options['lineHeightMobile'], false, $options['lineHeightUnit'] );
|
||||
|
||||
$css->set_selector( $mobile_prefix . $paragraph_selector );
|
||||
$css->add_property( 'margin-bottom', $options['marginBottomMobile'], false, $options['marginBottomUnit'] );
|
||||
}
|
||||
|
||||
if ( 'frontend' === $type ) {
|
||||
$css->stop_media_query();
|
||||
}
|
||||
}
|
||||
|
||||
return $css->css_output();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the CSS selector.
|
||||
*
|
||||
* @param string $selector The saved selector to look up.
|
||||
* @param string $type Whether we're getting the selectors for the frontend or editor.
|
||||
*/
|
||||
public static function get_css_selector( $selector, $type ) {
|
||||
if ( 'frontend' === $type ) {
|
||||
switch ( $selector ) {
|
||||
case 'body':
|
||||
$selector = 'body, button, input, select, textarea';
|
||||
break;
|
||||
|
||||
case 'main-title':
|
||||
$selector = '.main-title';
|
||||
break;
|
||||
|
||||
case 'site-description':
|
||||
$selector = '.site-description';
|
||||
break;
|
||||
|
||||
case 'primary-menu-items':
|
||||
$selector = '.main-navigation a, .main-navigation .menu-toggle, .main-navigation .menu-bar-items';
|
||||
break;
|
||||
|
||||
case 'primary-sub-menu-items':
|
||||
$selector = '.main-navigation .main-nav ul ul li a';
|
||||
break;
|
||||
|
||||
case 'primary-menu-toggle':
|
||||
$selector = '.main-navigation .menu-toggle';
|
||||
break;
|
||||
|
||||
case 'buttons':
|
||||
$selector = 'button:not(.menu-toggle),html input[type="button"],input[type="reset"],input[type="submit"],.button,.wp-block-button .wp-block-button__link';
|
||||
break;
|
||||
|
||||
case 'all-headings':
|
||||
$selector = 'h1, h2, h3, h4, h5, h6';
|
||||
break;
|
||||
|
||||
case 'single-content-title':
|
||||
$selector = 'h1.entry-title';
|
||||
break;
|
||||
|
||||
case 'archive-content-title':
|
||||
$selector = 'h2.entry-title';
|
||||
break;
|
||||
|
||||
case 'top-bar':
|
||||
$selector = '.top-bar';
|
||||
break;
|
||||
|
||||
case 'widget-titles':
|
||||
$selector = '.widget-title';
|
||||
break;
|
||||
|
||||
case 'footer':
|
||||
$selector = '.site-info';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'editor' === $type ) {
|
||||
switch ( $selector ) {
|
||||
case 'body':
|
||||
$selector = 'body .editor-styles-wrapper';
|
||||
break;
|
||||
|
||||
case 'buttons':
|
||||
$selector = '.editor-styles-wrapper a.button, .block-editor-block-list__layout .wp-block-button .wp-block-button__link';
|
||||
break;
|
||||
|
||||
case 'all-headings':
|
||||
$selector = '.editor-styles-wrapper h1, .editor-styles-wrapper h2, .editor-styles-wrapper h3, .editor-styles-wrapper h4, .editor-styles-wrapper h5, .editor-styles-wrapper h6';
|
||||
break;
|
||||
|
||||
case 'h1':
|
||||
$selector = '.editor-styles-wrapper h1, .editor-styles-wrapper .editor-post-title__input';
|
||||
break;
|
||||
|
||||
case 'single-content-title':
|
||||
$selector = '.editor-styles-wrapper .editor-post-title__input';
|
||||
break;
|
||||
|
||||
case 'h2':
|
||||
case 'h3':
|
||||
case 'h4':
|
||||
case 'h5':
|
||||
case 'h6':
|
||||
$selector = '.editor-styles-wrapper ' . $selector;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return apply_filters( 'generate_typography_css_selector', $selector, $type );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get our full font family value.
|
||||
*
|
||||
* @param string $font_family The font family name.
|
||||
*/
|
||||
public static function get_font_family( $font_family ) {
|
||||
if ( ! $font_family ) {
|
||||
return $font_family;
|
||||
}
|
||||
|
||||
$font_manager = generate_get_option( 'font_manager' );
|
||||
|
||||
$font_families = array();
|
||||
foreach ( (array) $font_manager as $key => $data ) {
|
||||
$font_families[ $data['fontFamily'] ] = $data;
|
||||
}
|
||||
|
||||
$font_family_args = array();
|
||||
if ( ! empty( $font_families[ $font_family ] ) ) {
|
||||
$font_family_args = $font_families[ $font_family ];
|
||||
}
|
||||
|
||||
if ( ! empty( $font_family_args['googleFont'] ) && ! empty( $font_family_args['googleFontCategory'] ) ) {
|
||||
$font_family = $font_family . ', ' . $font_family_args['googleFontCategory'];
|
||||
} elseif ( 'System Default' === $font_family ) {
|
||||
$font_family = generate_get_system_default_font();
|
||||
}
|
||||
|
||||
return $font_family;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the defaults for our CSS options.
|
||||
*/
|
||||
public static function get_defaults() {
|
||||
return array(
|
||||
'selector' => '',
|
||||
'fontFamily' => '',
|
||||
'fontWeight' => '',
|
||||
'textTransform' => '',
|
||||
'fontSize' => '',
|
||||
'fontSizeTablet' => '',
|
||||
'fontSizeMobile' => '',
|
||||
'fontSizeUnit' => 'px',
|
||||
'lineHeight' => '',
|
||||
'lineHeightTablet' => '',
|
||||
'lineHeightMobile' => '',
|
||||
'lineHeightUnit' => '',
|
||||
'letterSpacing' => '',
|
||||
'letterSpacingTablet' => '',
|
||||
'letterSpacingMobile' => '',
|
||||
'letterSpacingUnit' => 'px',
|
||||
'marginBottom' => '',
|
||||
'marginBottomTablet' => '',
|
||||
'marginBottomMobile' => '',
|
||||
'marginBottomUnit' => 'px',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePress_Typography::get_instance();
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,217 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles adding Customizer controls.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper functions to add Customizer fields.
|
||||
*/
|
||||
class GeneratePress_Customize_Field {
|
||||
/**
|
||||
* Instance.
|
||||
*
|
||||
* @access private
|
||||
* @var object Instance
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Initiator.
|
||||
*
|
||||
* @since 1.2.0
|
||||
* @return object initialized object of class.
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! isset( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a wrapper for defined controls.
|
||||
*
|
||||
* @param string $id The settings ID for this field.
|
||||
* @param array $control_args The args for add_control().
|
||||
*/
|
||||
public static function add_wrapper( $id, $control_args = array() ) {
|
||||
global $wp_customize;
|
||||
|
||||
if ( ! $id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$control_args['settings'] = isset( $wp_customize->selective_refresh ) ? array() : 'blogname';
|
||||
$control_args['choices']['id'] = str_replace( '_', '-', $id );
|
||||
$control_args['type'] = 'generate-wrapper-control';
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Customize_React_Control(
|
||||
$wp_customize,
|
||||
$id,
|
||||
$control_args
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a title.
|
||||
*
|
||||
* @param string $id The settings ID for this field.
|
||||
* @param array $control_args The args for add_control().
|
||||
*/
|
||||
public static function add_title( $id, $control_args = array() ) {
|
||||
global $wp_customize;
|
||||
|
||||
if ( ! $id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$control_args['settings'] = isset( $wp_customize->selective_refresh ) ? array() : 'blogname';
|
||||
$control_args['type'] = 'generate-title-control';
|
||||
$control_args['choices']['title'] = $control_args['title'];
|
||||
unset( $control_args['title'] );
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Customize_React_Control(
|
||||
$wp_customize,
|
||||
$id,
|
||||
$control_args
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Customizer field.
|
||||
*
|
||||
* @param string $id The settings ID for this field.
|
||||
* @param object $control_class A custom control classes if we want one.
|
||||
* @param array $setting_args The args for add_setting().
|
||||
* @param array $control_args The args for add_control().
|
||||
*/
|
||||
public static function add_field( $id, $control_class, $setting_args = array(), $control_args = array() ) {
|
||||
global $wp_customize;
|
||||
|
||||
if ( ! $id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$settings = wp_parse_args(
|
||||
$setting_args,
|
||||
array(
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'default' => '',
|
||||
'transport' => 'refresh',
|
||||
'validate_callback' => '',
|
||||
'sanitize_callback' => '',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
$id,
|
||||
array(
|
||||
'type' => $settings['type'],
|
||||
'capability' => $settings['capability'],
|
||||
'default' => $settings['default'],
|
||||
'transport' => $settings['transport'],
|
||||
'validate_callback' => $settings['validate_callback'],
|
||||
'sanitize_callback' => $settings['sanitize_callback'],
|
||||
)
|
||||
);
|
||||
|
||||
$control_args['settings'] = $id;
|
||||
|
||||
if ( ! isset( $control_args['type'] ) ) {
|
||||
unset( $control_args['type'] );
|
||||
}
|
||||
|
||||
if ( ! isset( $control_args['defaultValue'] ) && isset( $setting_args['default'] ) ) {
|
||||
$control_args['defaultValue'] = $setting_args['default'];
|
||||
}
|
||||
|
||||
if ( isset( $control_args['output'] ) ) {
|
||||
global $generate_customize_fields;
|
||||
|
||||
$generate_customize_fields[] = array(
|
||||
'js_vars' => $control_args['output'],
|
||||
'settings' => $id,
|
||||
);
|
||||
}
|
||||
|
||||
if ( $control_class ) {
|
||||
$wp_customize->add_control(
|
||||
new $control_class(
|
||||
$wp_customize,
|
||||
$id,
|
||||
$control_args
|
||||
)
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$wp_customize->add_control(
|
||||
$id,
|
||||
$control_args
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add color field group.
|
||||
*
|
||||
* @param string $id The ID for the group wrapper.
|
||||
* @param string $section_id The section ID.
|
||||
* @param string $toggle_id The Toggle ID.
|
||||
* @param array $fields The color fields.
|
||||
*/
|
||||
public static function add_color_field_group( $id, $section_id, $toggle_id, $fields ) {
|
||||
self::add_wrapper(
|
||||
"generate_{$id}_wrapper",
|
||||
array(
|
||||
'section' => $section_id,
|
||||
'choices' => array(
|
||||
'type' => 'color',
|
||||
'toggleId' => $toggle_id,
|
||||
'items' => array_keys( $fields ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
foreach ( $fields as $key => $field ) {
|
||||
self::add_field(
|
||||
$key,
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $field['default_value'],
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
),
|
||||
array(
|
||||
'label' => $field['label'],
|
||||
'section' => $section_id,
|
||||
'choices' => array(
|
||||
'alpha' => isset( $field['alpha'] ) ? $field['alpha'] : true,
|
||||
'toggleId' => $toggle_id,
|
||||
'wrapper' => $key,
|
||||
'tooltip' => $field['tooltip'],
|
||||
'hideLabel' => isset( $field['hide_label'] ) ? $field['hide_label'] : false,
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => $field['element'],
|
||||
'property' => $field['property'],
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Customize API: ColorAlpha class
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
/**
|
||||
* Customize Color Control class.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @see WP_Customize_Control
|
||||
*/
|
||||
class GeneratePress_Customize_Color_Control extends WP_Customize_Color_Control {
|
||||
/**
|
||||
* Type.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'generate-color-control';
|
||||
|
||||
/**
|
||||
* Refresh the parameters passed to the JavaScript via JSON.
|
||||
*
|
||||
* @since 3.4.0
|
||||
* @uses WP_Customize_Control::to_json()
|
||||
*/
|
||||
public function to_json() {
|
||||
parent::to_json();
|
||||
$this->json['choices'] = $this->choices;
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty JS template.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function content_template() {}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Customize API: ColorAlpha class
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
/**
|
||||
* Customize Color Control class.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @see WP_Customize_Control
|
||||
*/
|
||||
class GeneratePress_Customize_React_Control extends WP_Customize_Control {
|
||||
/**
|
||||
* Type.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'generate-react-control';
|
||||
|
||||
/**
|
||||
* Refresh the parameters passed to the JavaScript via JSON.
|
||||
*
|
||||
* @since 3.4.0
|
||||
* @uses WP_Customize_Control::to_json()
|
||||
*/
|
||||
public function to_json() {
|
||||
parent::to_json();
|
||||
$this->json['choices'] = $this->choices;
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty JS template.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function content_template() {}
|
||||
|
||||
/**
|
||||
* Empty PHP template.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_content() {}
|
||||
}
|
@ -1,501 +1,297 @@
|
||||
( function( api ) {
|
||||
'use strict';
|
||||
|
||||
// Add callback for when the header_textcolor setting exists.
|
||||
api( 'generate_settings[nav_position_setting]', function( setting ) {
|
||||
var isNavFloated, isNavAlignable, setNavDropPointActiveState, setNavAlignmentsActiveState;
|
||||
|
||||
/**
|
||||
* Determine whether the navigation is floating.
|
||||
*
|
||||
* @returns {boolean} Is floating?
|
||||
*/
|
||||
isNavFloated = function() {
|
||||
if ( 'nav-float-right' === setting.get() || 'nav-float-left' === setting.get() ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine whether the navigation is align-able.
|
||||
*
|
||||
* @returns {boolean} Is floating?
|
||||
*/
|
||||
isNavAlignable = function() {
|
||||
if ( 'nav-float-right' === setting.get() || 'nav-float-left' === setting.get() ) {
|
||||
var navAsHeader = api.instance( 'generate_menu_plus_settings[navigation_as_header]' );
|
||||
|
||||
if ( navAsHeader && navAsHeader.get() ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Update a control's active state according to the navigation location setting's value.
|
||||
*
|
||||
* @param {wp.customize.Control} control
|
||||
*/
|
||||
setNavDropPointActiveState = function( control ) {
|
||||
var setActiveState = function() {
|
||||
control.active.set( isNavFloated() );
|
||||
};
|
||||
|
||||
// FYI: With the following we can eliminate all of our PHP active_callback code.
|
||||
control.active.validate = isNavFloated;
|
||||
|
||||
// Set initial active state.
|
||||
setActiveState();
|
||||
|
||||
/*
|
||||
* Update activate state whenever the setting is changed.
|
||||
* Even when the setting does have a refresh transport where the
|
||||
* server-side active callback will manage the active state upon
|
||||
* refresh, having this JS management of the active state will
|
||||
* ensure that controls will have their visibility toggled
|
||||
* immediately instead of waiting for the preview to load.
|
||||
* This is especially important if the setting has a postMessage
|
||||
* transport where changing the setting wouldn't normally cause
|
||||
* the preview to refresh and thus the server-side active_callbacks
|
||||
* would not get invoked.
|
||||
*/
|
||||
setting.bind( setActiveState );
|
||||
};
|
||||
|
||||
/**
|
||||
* Update a control's active state according to the navigation location setting's value.
|
||||
*
|
||||
* @param {wp.customize.Control} control
|
||||
*/
|
||||
setNavAlignmentsActiveState = function( control ) {
|
||||
var setActiveState = function() {
|
||||
control.active.set( isNavAlignable() );
|
||||
};
|
||||
|
||||
// FYI: With the following we can eliminate all of our PHP active_callback code.
|
||||
control.active.validate = isNavAlignable;
|
||||
|
||||
// Set initial active state.
|
||||
setActiveState();
|
||||
|
||||
/*
|
||||
* Update activate state whenever the setting is changed.
|
||||
* Even when the setting does have a refresh transport where the
|
||||
* server-side active callback will manage the active state upon
|
||||
* refresh, having this JS management of the active state will
|
||||
* ensure that controls will have their visibility toggled
|
||||
* immediately instead of waiting for the preview to load.
|
||||
* This is especially important if the setting has a postMessage
|
||||
* transport where changing the setting wouldn't normally cause
|
||||
* the preview to refresh and thus the server-side active_callbacks
|
||||
* would not get invoked.
|
||||
*/
|
||||
setting.bind( setActiveState );
|
||||
};
|
||||
|
||||
api.control( 'generate_settings[nav_drop_point]', setNavDropPointActiveState );
|
||||
api.control( 'generate_settings[nav_layout_setting]', setNavAlignmentsActiveState );
|
||||
api.control( 'generate_settings[nav_inner_width]', setNavAlignmentsActiveState );
|
||||
api.control( 'generate_settings[nav_alignment_setting]', setNavAlignmentsActiveState );
|
||||
} );
|
||||
|
||||
var setOption = function( options ) {
|
||||
if ( options.headerAlignment ) {
|
||||
api.instance( 'generate_settings[header_alignment_setting]' ).set( options.headerAlignment );
|
||||
}
|
||||
|
||||
if ( options.navLocation ) {
|
||||
api.instance( 'generate_settings[nav_position_setting]' ).set( options.navLocation );
|
||||
}
|
||||
|
||||
if ( options.navAlignment ) {
|
||||
api.instance( 'generate_settings[nav_alignment_setting]' ).set( options.navAlignment );
|
||||
}
|
||||
|
||||
if ( options.boxAlignment ) {
|
||||
api.instance( 'generate_settings[container_alignment]' ).set( options.boxAlignment );
|
||||
}
|
||||
|
||||
if ( options.siteTitleFontSize ) {
|
||||
api.instance( 'generate_settings[site_title_font_size]' ).set( options.siteTitleFontSize );
|
||||
}
|
||||
|
||||
if ( 'undefined' !== typeof options.hideSiteTagline ) {
|
||||
api.instance( 'generate_settings[hide_tagline]' ).set( options.hideSiteTagline );
|
||||
}
|
||||
|
||||
if ( options.headerPaddingTop ) {
|
||||
api.instance( 'generate_spacing_settings[header_top]' ).set( options.headerPaddingTop );
|
||||
}
|
||||
|
||||
if ( options.headerPaddingBottom ) {
|
||||
api.instance( 'generate_spacing_settings[header_bottom]' ).set( options.headerPaddingBottom );
|
||||
}
|
||||
};
|
||||
|
||||
api( 'generate_header_helper', function( value ) {
|
||||
var headerAlignment = false,
|
||||
navLocation = false,
|
||||
navAlignment = false,
|
||||
boxAlignment = false,
|
||||
siteTitleFontSize = false,
|
||||
hideSiteTagline = false,
|
||||
headerPaddingTop = false,
|
||||
headerPaddingBottom = false;
|
||||
|
||||
value.bind( function( newval ) {
|
||||
var headerAlignmentSetting = api.instance( 'generate_settings[header_alignment_setting]' );
|
||||
var navLocationSetting = api.instance( 'generate_settings[nav_position_setting]' );
|
||||
var navAlignmentSetting = api.instance( 'generate_settings[nav_alignment_setting]' );
|
||||
var boxAlignmentSetting = api.instance( 'generate_settings[container_alignment]' );
|
||||
var siteTitleFontSizeSetting = api.instance( 'generate_settings[site_title_font_size]' );
|
||||
var hideSiteTaglineSetting = api.instance( 'generate_settings[hide_tagline]' );
|
||||
var headerPaddingTopSetting = api.instance( 'generate_spacing_settings[header_top]' );
|
||||
var headerPaddingBottomSetting = api.instance( 'generate_spacing_settings[header_bottom]' );
|
||||
|
||||
if ( ! headerAlignmentSetting._dirty ) {
|
||||
headerAlignment = headerAlignmentSetting.get();
|
||||
}
|
||||
|
||||
if ( ! navLocationSetting._dirty ) {
|
||||
navLocation = navLocationSetting.get();
|
||||
}
|
||||
|
||||
if ( ! navAlignmentSetting._dirty ) {
|
||||
navAlignment = navAlignmentSetting.get();
|
||||
}
|
||||
|
||||
if ( ! boxAlignmentSetting._dirty ) {
|
||||
boxAlignment = boxAlignmentSetting.get();
|
||||
}
|
||||
|
||||
if ( ! siteTitleFontSizeSetting._dirty ) {
|
||||
siteTitleFontSize = siteTitleFontSizeSetting.get();
|
||||
}
|
||||
|
||||
if ( ! hideSiteTaglineSetting._dirty ) {
|
||||
hideSiteTagline = hideSiteTaglineSetting.get();
|
||||
}
|
||||
|
||||
if ( ! headerPaddingTopSetting._dirty ) {
|
||||
headerPaddingTop = headerPaddingTopSetting.get();
|
||||
}
|
||||
|
||||
if ( ! headerPaddingBottomSetting._dirty ) {
|
||||
headerPaddingBottom = headerPaddingBottomSetting.get();
|
||||
}
|
||||
|
||||
var options = {
|
||||
headerAlignment: generatepress_defaults.header_alignment_setting,
|
||||
navLocation: generatepress_defaults.nav_position_setting,
|
||||
navAlignment: generatepress_defaults.nav_alignment_setting,
|
||||
boxAlignment: generatepress_defaults.container_alignment,
|
||||
siteTitleFontSize: generatepress_typography_defaults.site_title_font_size,
|
||||
hideSiteTagline: generatepress_defaults.hide_tagline,
|
||||
headerPaddingTop: generatepress_spacing_defaults.header_top,
|
||||
headerPaddingBottom: generatepress_spacing_defaults.header_bottom,
|
||||
};
|
||||
|
||||
if ( 'current' === newval ) {
|
||||
options = {
|
||||
headerAlignment: headerAlignment,
|
||||
navLocation: navLocation,
|
||||
navAlignment: navAlignment,
|
||||
boxAlignment: boxAlignment,
|
||||
siteTitleFontSize: siteTitleFontSize,
|
||||
hideSiteTagline: hideSiteTagline,
|
||||
headerPaddingTop: headerPaddingTop,
|
||||
headerPaddingBottom: headerPaddingBottom,
|
||||
};
|
||||
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'default' === newval ) {
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'classic' === newval ) {
|
||||
var options = {
|
||||
headerAlignment: 'left',
|
||||
navLocation: 'nav-below-header',
|
||||
navAlignment: 'left',
|
||||
boxAlignment: 'boxes',
|
||||
siteTitleFontSize: '45',
|
||||
hideSiteTagline: '',
|
||||
headerPaddingTop: '40',
|
||||
headerPaddingBottom: '40',
|
||||
};
|
||||
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'nav-before' === newval ) {
|
||||
options['headerAlignment'] = 'left';
|
||||
options['navLocation'] = 'nav-above-header';
|
||||
options['navAlignment'] = 'left';
|
||||
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'nav-after' === newval ) {
|
||||
options['headerAlignment'] = 'left';
|
||||
options['navLocation'] = 'nav-below-header';
|
||||
options['navAlignment'] = 'left';
|
||||
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'nav-before-centered' === newval ) {
|
||||
options['headerAlignment'] = 'center';
|
||||
options['navLocation'] = 'nav-above-header';
|
||||
options['navAlignment'] = 'center';
|
||||
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'nav-after-centered' === newval ) {
|
||||
options['headerAlignment'] = 'center';
|
||||
options['navLocation'] = 'nav-below-header';
|
||||
options['navAlignment'] = 'center';
|
||||
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'nav-left' === newval ) {
|
||||
options['headerAlignment'] = 'left';
|
||||
options['navLocation'] = 'nav-float-left';
|
||||
options['navAlignment'] = 'right';
|
||||
|
||||
setOption( options );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
api( 'nav_color_presets', function( value ) {
|
||||
var backgroundColor = false,
|
||||
textColor = false,
|
||||
backgroundColorHover = false,
|
||||
textColorHover = false,
|
||||
currentBackgroundColor = false,
|
||||
currentTextColor = false,
|
||||
subMenuBackgroundColor = false,
|
||||
subMenuTextColor = false,
|
||||
subMenuBackgroundColorHover = false,
|
||||
subMenuTextColorHover = false,
|
||||
subMenuCurrentBackgroundColor = false,
|
||||
subMenuCurrentTextColor = false;
|
||||
|
||||
value.bind( function( newval ) {
|
||||
var backgroundColorSetting = api.instance( 'generate_settings[navigation_background_color]' ),
|
||||
textColorSetting = api.instance( 'generate_settings[navigation_text_color]' ),
|
||||
backgroundColorHoverSetting = api.instance( 'generate_settings[navigation_background_hover_color]' ),
|
||||
textColorHoverSetting = api.instance( 'generate_settings[navigation_text_hover_color]' ),
|
||||
currentBackgroundColorSetting = api.instance( 'generate_settings[navigation_background_current_color]' ),
|
||||
currentTextColorSetting = api.instance( 'generate_settings[navigation_text_current_color]' ),
|
||||
subMenuBackgroundColorSetting = api.instance( 'generate_settings[subnavigation_background_color]' ),
|
||||
subMenuTextColorSetting = api.instance( 'generate_settings[subnavigation_text_color]' ),
|
||||
subMenuBackgroundColorHoverSetting = api.instance( 'generate_settings[subnavigation_background_hover_color]' ),
|
||||
subMenuTextColorHoverSetting = api.instance( 'generate_settings[subnavigation_text_hover_color]' ),
|
||||
subMenuCurrentBackgroundColorSetting = api.instance( 'generate_settings[subnavigation_background_current_color]' ),
|
||||
subMenuCurrentTextColorSetting = api.instance( 'generate_settings[subnavigation_text_current_color]' );
|
||||
|
||||
if ( ! backgroundColorSetting._dirty ) {
|
||||
backgroundColor = backgroundColorSetting.get();
|
||||
}
|
||||
|
||||
if ( ! textColorSetting._dirty ) {
|
||||
textColor = textColorSetting.get();
|
||||
}
|
||||
|
||||
if ( ! backgroundColorHoverSetting._dirty ) {
|
||||
backgroundColorHover = backgroundColorHoverSetting.get();
|
||||
}
|
||||
|
||||
if ( ! textColorHoverSetting._dirty ) {
|
||||
textColorHover = textColorHoverSetting.get();
|
||||
}
|
||||
|
||||
if ( ! currentBackgroundColorSetting._dirty ) {
|
||||
currentBackgroundColor = currentBackgroundColorSetting.get();
|
||||
}
|
||||
|
||||
if ( ! currentTextColorSetting._dirty ) {
|
||||
currentTextColor = currentTextColorSetting.get();
|
||||
}
|
||||
|
||||
if ( ! subMenuBackgroundColorSetting._dirty ) {
|
||||
subMenuBackgroundColor = subMenuBackgroundColorSetting.get();
|
||||
}
|
||||
|
||||
if ( ! subMenuTextColorSetting._dirty ) {
|
||||
subMenuTextColor = subMenuTextColorSetting.get();
|
||||
}
|
||||
|
||||
if ( ! subMenuBackgroundColorHoverSetting._dirty ) {
|
||||
subMenuBackgroundColorHover = subMenuBackgroundColorHoverSetting.get();
|
||||
}
|
||||
|
||||
if ( ! subMenuTextColorHoverSetting._dirty ) {
|
||||
subMenuTextColorHover = subMenuTextColorHoverSetting.get();
|
||||
}
|
||||
|
||||
if ( ! subMenuCurrentBackgroundColorSetting._dirty ) {
|
||||
subMenuCurrentBackgroundColor = subMenuCurrentBackgroundColorSetting.get();
|
||||
}
|
||||
|
||||
if ( ! subMenuCurrentTextColorSetting._dirty ) {
|
||||
subMenuCurrentTextColor = subMenuCurrentTextColorSetting.get();
|
||||
}
|
||||
|
||||
if ( 'current' === newval ) {
|
||||
backgroundColorSetting.set( backgroundColor );
|
||||
textColorSetting.set( textColor );
|
||||
|
||||
backgroundColorHoverSetting.set( backgroundColorHover );
|
||||
textColorHoverSetting.set( textColorHover );
|
||||
|
||||
currentBackgroundColorSetting.set( currentBackgroundColor );
|
||||
currentTextColorSetting.set( currentTextColorSetting );
|
||||
|
||||
subMenuBackgroundColorSetting.set( subMenuBackgroundColor );
|
||||
subMenuTextColorSetting.set( subMenuTextColor );
|
||||
|
||||
subMenuBackgroundColorHoverSetting.set( subMenuBackgroundColorHover );
|
||||
subMenuTextColorHoverSetting.set( subMenuTextColorHover );
|
||||
|
||||
subMenuCurrentBackgroundColorSetting.set( subMenuCurrentBackgroundColor );
|
||||
subMenuCurrentTextColorSetting.set( subMenuCurrentTextColorSetting );
|
||||
}
|
||||
|
||||
if ( 'default' === newval ) {
|
||||
backgroundColorSetting.set( generatepress_color_defaults.navigation_background_color );
|
||||
textColorSetting.set( generatepress_color_defaults.navigation_text_color );
|
||||
|
||||
backgroundColorHoverSetting.set( generatepress_color_defaults.navigation_background_hover_color );
|
||||
textColorHoverSetting.set( generatepress_color_defaults.navigation_text_hover_color );
|
||||
|
||||
currentBackgroundColorSetting.set( generatepress_color_defaults.navigation_background_current_color );
|
||||
currentTextColorSetting.set( generatepress_color_defaults.navigation_text_current_color );
|
||||
|
||||
subMenuBackgroundColorSetting.set( generatepress_color_defaults.subnavigation_background_color );
|
||||
subMenuTextColorSetting.set( generatepress_color_defaults.subnavigation_text_color );
|
||||
|
||||
subMenuBackgroundColorHoverSetting.set( generatepress_color_defaults.subnavigation_background_hover_color );
|
||||
subMenuTextColorHoverSetting.set( generatepress_color_defaults.subnavigation_text_hover_color );
|
||||
|
||||
subMenuCurrentBackgroundColorSetting.set( generatepress_color_defaults.subnavigation_background_current_color );
|
||||
subMenuCurrentTextColorSetting.set( generatepress_color_defaults.subnavigation_text_current_color );
|
||||
}
|
||||
|
||||
if ( 'classic' === newval ) {
|
||||
backgroundColorSetting.set( '#222222' );
|
||||
textColorSetting.set( '#ffffff' );
|
||||
|
||||
backgroundColorHoverSetting.set( '#3f3f3f' );
|
||||
textColorHoverSetting.set( '#ffffff' );
|
||||
|
||||
currentBackgroundColorSetting.set( '#3f3f3f' );
|
||||
currentTextColorSetting.set( '#ffffff' );
|
||||
|
||||
subMenuBackgroundColorSetting.set( '#3f3f3f' );
|
||||
subMenuTextColorSetting.set( '#ffffff' );
|
||||
|
||||
subMenuBackgroundColorHoverSetting.set( '#4f4f4f' );
|
||||
subMenuTextColorHoverSetting.set( '#ffffff' );
|
||||
|
||||
subMenuCurrentBackgroundColorSetting.set( '#4f4f4f' );
|
||||
subMenuCurrentTextColorSetting.set( '#ffffff' );
|
||||
}
|
||||
|
||||
if ( 'grey' === newval ) {
|
||||
backgroundColorSetting.set( '#595959' );
|
||||
textColorSetting.set( '#ffffff' );
|
||||
|
||||
backgroundColorHoverSetting.set( '#424242' );
|
||||
textColorHoverSetting.set( '#ffffff' );
|
||||
|
||||
currentBackgroundColorSetting.set( '#424242' );
|
||||
currentTextColorSetting.set( '#ffffff' );
|
||||
|
||||
subMenuBackgroundColorSetting.set( '#424242' );
|
||||
subMenuTextColorSetting.set( '#ffffff' );
|
||||
|
||||
subMenuBackgroundColorHoverSetting.set( '#424242' );
|
||||
subMenuTextColorHoverSetting.set( '#dbdbdb' );
|
||||
|
||||
subMenuCurrentBackgroundColorSetting.set( '#424242' );
|
||||
subMenuCurrentTextColorSetting.set( '#dbdbdb' );
|
||||
}
|
||||
|
||||
if ( 'blue' === newval ) {
|
||||
backgroundColorSetting.set( '#1e73be' );
|
||||
textColorSetting.set( '#ffffff' );
|
||||
|
||||
backgroundColorHoverSetting.set( '#035a9e' );
|
||||
textColorHoverSetting.set( '#ffffff' );
|
||||
|
||||
currentBackgroundColorSetting.set( '#035a9e' );
|
||||
currentTextColorSetting.set( '#ffffff' );
|
||||
|
||||
subMenuBackgroundColorSetting.set( '#035a9e' );
|
||||
subMenuTextColorSetting.set( '#ffffff' );
|
||||
|
||||
subMenuBackgroundColorHoverSetting.set( '#035a9e' );
|
||||
subMenuTextColorHoverSetting.set( '#bbd2e8' );
|
||||
|
||||
subMenuCurrentBackgroundColorSetting.set( '#035a9e' );
|
||||
subMenuCurrentTextColorSetting.set( '#bbd2e8' );
|
||||
}
|
||||
|
||||
if ( 'red' === newval ) {
|
||||
backgroundColorSetting.set( '#ed4250' );
|
||||
textColorSetting.set( '#ffffff' );
|
||||
|
||||
backgroundColorHoverSetting.set( '#c42f2f' );
|
||||
textColorHoverSetting.set( '#ffffff' );
|
||||
|
||||
currentBackgroundColorSetting.set( '#c42f2f' );
|
||||
currentTextColorSetting.set( '#ffffff' );
|
||||
|
||||
subMenuBackgroundColorSetting.set( '#c42f2f' );
|
||||
subMenuTextColorSetting.set( '#ffffff' );
|
||||
|
||||
subMenuBackgroundColorHoverSetting.set( '#c42f2f' );
|
||||
subMenuTextColorHoverSetting.set( '#fcd9d6' );
|
||||
|
||||
subMenuCurrentBackgroundColorSetting.set( '#c42f2f' );
|
||||
subMenuCurrentTextColorSetting.set( '#fcd9d6' );
|
||||
}
|
||||
|
||||
if ( 'green' === newval ) {
|
||||
backgroundColorSetting.set( '#16aa74' );
|
||||
textColorSetting.set( '#ffffff' );
|
||||
|
||||
backgroundColorHoverSetting.set( '#119b6d' );
|
||||
textColorHoverSetting.set( '#ffffff' );
|
||||
|
||||
currentBackgroundColorSetting.set( '#119b6d' );
|
||||
currentTextColorSetting.set( '#ffffff' );
|
||||
|
||||
subMenuBackgroundColorSetting.set( '#119b6d' );
|
||||
subMenuTextColorSetting.set( '#ffffff' );
|
||||
|
||||
subMenuBackgroundColorHoverSetting.set( '#119b6d' );
|
||||
subMenuTextColorHoverSetting.set( '#c2e8de' );
|
||||
|
||||
subMenuCurrentBackgroundColorSetting.set( '#119b6d' );
|
||||
subMenuCurrentTextColorSetting.set( '#c2e8de' );
|
||||
}
|
||||
|
||||
jQuery('.wp-color-picker').wpColorPicker().change();
|
||||
} );
|
||||
} );
|
||||
|
||||
}( wp.customize ) );
|
||||
( function( api ) {
|
||||
'use strict';
|
||||
|
||||
// Add callback for when the header_textcolor setting exists.
|
||||
api( 'generate_settings[nav_position_setting]', function( setting ) {
|
||||
var isNavFloated, isNavAlignable, setNavDropPointActiveState, setNavAlignmentsActiveState;
|
||||
|
||||
/**
|
||||
* Determine whether the navigation is floating.
|
||||
*
|
||||
* @returns {boolean} Is floating?
|
||||
*/
|
||||
isNavFloated = function() {
|
||||
if ( 'nav-float-right' === setting.get() || 'nav-float-left' === setting.get() ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine whether the navigation is align-able.
|
||||
*
|
||||
* @returns {boolean} Is floating?
|
||||
*/
|
||||
isNavAlignable = function() {
|
||||
if ( 'nav-float-right' === setting.get() || 'nav-float-left' === setting.get() ) {
|
||||
var navAsHeader = api.instance( 'generate_menu_plus_settings[navigation_as_header]' );
|
||||
|
||||
if ( navAsHeader && navAsHeader.get() ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Update a control's active state according to the navigation location setting's value.
|
||||
*
|
||||
* @param {wp.customize.Control} control
|
||||
*/
|
||||
setNavDropPointActiveState = function( control ) {
|
||||
var setActiveState = function() {
|
||||
control.active.set( isNavFloated() );
|
||||
};
|
||||
|
||||
// FYI: With the following we can eliminate all of our PHP active_callback code.
|
||||
control.active.validate = isNavFloated;
|
||||
|
||||
// Set initial active state.
|
||||
setActiveState();
|
||||
|
||||
/*
|
||||
* Update activate state whenever the setting is changed.
|
||||
* Even when the setting does have a refresh transport where the
|
||||
* server-side active callback will manage the active state upon
|
||||
* refresh, having this JS management of the active state will
|
||||
* ensure that controls will have their visibility toggled
|
||||
* immediately instead of waiting for the preview to load.
|
||||
* This is especially important if the setting has a postMessage
|
||||
* transport where changing the setting wouldn't normally cause
|
||||
* the preview to refresh and thus the server-side active_callbacks
|
||||
* would not get invoked.
|
||||
*/
|
||||
setting.bind( setActiveState );
|
||||
};
|
||||
|
||||
/**
|
||||
* Update a control's active state according to the navigation location setting's value.
|
||||
*
|
||||
* @param {wp.customize.Control} control
|
||||
*/
|
||||
setNavAlignmentsActiveState = function( control ) {
|
||||
var setActiveState = function() {
|
||||
control.active.set( isNavAlignable() );
|
||||
};
|
||||
|
||||
// FYI: With the following we can eliminate all of our PHP active_callback code.
|
||||
control.active.validate = isNavAlignable;
|
||||
|
||||
// Set initial active state.
|
||||
setActiveState();
|
||||
|
||||
/*
|
||||
* Update activate state whenever the setting is changed.
|
||||
* Even when the setting does have a refresh transport where the
|
||||
* server-side active callback will manage the active state upon
|
||||
* refresh, having this JS management of the active state will
|
||||
* ensure that controls will have their visibility toggled
|
||||
* immediately instead of waiting for the preview to load.
|
||||
* This is especially important if the setting has a postMessage
|
||||
* transport where changing the setting wouldn't normally cause
|
||||
* the preview to refresh and thus the server-side active_callbacks
|
||||
* would not get invoked.
|
||||
*/
|
||||
setting.bind( setActiveState );
|
||||
};
|
||||
|
||||
api.control( 'generate_settings[nav_drop_point]', setNavDropPointActiveState );
|
||||
api.control( 'generate_settings[nav_layout_setting]', setNavAlignmentsActiveState );
|
||||
api.control( 'generate_settings[nav_inner_width]', setNavAlignmentsActiveState );
|
||||
api.control( 'generate_settings[nav_alignment_setting]', setNavAlignmentsActiveState );
|
||||
} );
|
||||
|
||||
var setOption = function( options ) {
|
||||
if ( options.headerAlignment ) {
|
||||
api.instance( 'generate_settings[header_alignment_setting]' ).set( options.headerAlignment );
|
||||
}
|
||||
|
||||
if ( options.navLocation ) {
|
||||
api.instance( 'generate_settings[nav_position_setting]' ).set( options.navLocation );
|
||||
}
|
||||
|
||||
if ( options.navAlignment ) {
|
||||
api.instance( 'generate_settings[nav_alignment_setting]' ).set( options.navAlignment );
|
||||
}
|
||||
|
||||
if ( options.boxAlignment ) {
|
||||
api.instance( 'generate_settings[container_alignment]' ).set( options.boxAlignment );
|
||||
}
|
||||
|
||||
if ( options.siteTitleFontSize ) {
|
||||
api.instance( 'generate_settings[site_title_font_size]' ).set( options.siteTitleFontSize );
|
||||
}
|
||||
|
||||
if ( 'undefined' !== typeof options.hideSiteTagline ) {
|
||||
api.instance( 'generate_settings[hide_tagline]' ).set( options.hideSiteTagline );
|
||||
}
|
||||
|
||||
if ( options.headerPaddingTop ) {
|
||||
api.instance( 'generate_spacing_settings[header_top]' ).set( options.headerPaddingTop );
|
||||
}
|
||||
|
||||
if ( options.headerPaddingBottom ) {
|
||||
api.instance( 'generate_spacing_settings[header_bottom]' ).set( options.headerPaddingBottom );
|
||||
}
|
||||
};
|
||||
|
||||
api( 'generate_header_helper', function( value ) {
|
||||
var headerAlignment = false,
|
||||
navLocation = false,
|
||||
navAlignment = false,
|
||||
boxAlignment = false,
|
||||
siteTitleFontSize = false,
|
||||
hideSiteTagline = false,
|
||||
headerPaddingTop = false,
|
||||
headerPaddingBottom = false;
|
||||
|
||||
value.bind( function( newval ) {
|
||||
var headerAlignmentSetting = api.instance( 'generate_settings[header_alignment_setting]' );
|
||||
var navLocationSetting = api.instance( 'generate_settings[nav_position_setting]' );
|
||||
var navAlignmentSetting = api.instance( 'generate_settings[nav_alignment_setting]' );
|
||||
var boxAlignmentSetting = api.instance( 'generate_settings[container_alignment]' );
|
||||
var siteTitleFontSizeSetting = api.instance( 'generate_settings[site_title_font_size]' );
|
||||
var hideSiteTaglineSetting = api.instance( 'generate_settings[hide_tagline]' );
|
||||
var headerPaddingTopSetting = api.instance( 'generate_spacing_settings[header_top]' );
|
||||
var headerPaddingBottomSetting = api.instance( 'generate_spacing_settings[header_bottom]' );
|
||||
|
||||
if ( ! headerAlignmentSetting._dirty ) {
|
||||
headerAlignment = headerAlignmentSetting.get();
|
||||
}
|
||||
|
||||
if ( ! navLocationSetting._dirty ) {
|
||||
navLocation = navLocationSetting.get();
|
||||
}
|
||||
|
||||
if ( ! navAlignmentSetting._dirty ) {
|
||||
navAlignment = navAlignmentSetting.get();
|
||||
}
|
||||
|
||||
if ( ! boxAlignmentSetting._dirty ) {
|
||||
boxAlignment = boxAlignmentSetting.get();
|
||||
}
|
||||
|
||||
if ( ! siteTitleFontSizeSetting._dirty ) {
|
||||
siteTitleFontSize = siteTitleFontSizeSetting.get();
|
||||
}
|
||||
|
||||
if ( ! hideSiteTaglineSetting._dirty ) {
|
||||
hideSiteTagline = hideSiteTaglineSetting.get();
|
||||
}
|
||||
|
||||
if ( ! headerPaddingTopSetting._dirty ) {
|
||||
headerPaddingTop = headerPaddingTopSetting.get();
|
||||
}
|
||||
|
||||
if ( ! headerPaddingBottomSetting._dirty ) {
|
||||
headerPaddingBottom = headerPaddingBottomSetting.get();
|
||||
}
|
||||
|
||||
var options = {
|
||||
headerAlignment: generatepress_defaults.header_alignment_setting,
|
||||
navLocation: generatepress_defaults.nav_position_setting,
|
||||
navAlignment: generatepress_defaults.nav_alignment_setting,
|
||||
boxAlignment: generatepress_defaults.container_alignment,
|
||||
siteTitleFontSize: generatepress_typography_defaults.site_title_font_size,
|
||||
hideSiteTagline: generatepress_defaults.hide_tagline,
|
||||
headerPaddingTop: generatepress_spacing_defaults.header_top,
|
||||
headerPaddingBottom: generatepress_spacing_defaults.header_bottom,
|
||||
};
|
||||
|
||||
if ( 'current' === newval ) {
|
||||
options = {
|
||||
headerAlignment: headerAlignment,
|
||||
navLocation: navLocation,
|
||||
navAlignment: navAlignment,
|
||||
boxAlignment: boxAlignment,
|
||||
siteTitleFontSize: siteTitleFontSize,
|
||||
hideSiteTagline: hideSiteTagline,
|
||||
headerPaddingTop: headerPaddingTop,
|
||||
headerPaddingBottom: headerPaddingBottom,
|
||||
};
|
||||
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'default' === newval ) {
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'classic' === newval ) {
|
||||
var options = {
|
||||
headerAlignment: 'left',
|
||||
navLocation: 'nav-below-header',
|
||||
navAlignment: 'left',
|
||||
boxAlignment: 'boxes',
|
||||
siteTitleFontSize: '45',
|
||||
hideSiteTagline: '',
|
||||
headerPaddingTop: '40',
|
||||
headerPaddingBottom: '40',
|
||||
};
|
||||
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'nav-before' === newval ) {
|
||||
options['headerAlignment'] = 'left';
|
||||
options['navLocation'] = 'nav-above-header';
|
||||
options['navAlignment'] = 'left';
|
||||
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'nav-after' === newval ) {
|
||||
options['headerAlignment'] = 'left';
|
||||
options['navLocation'] = 'nav-below-header';
|
||||
options['navAlignment'] = 'left';
|
||||
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'nav-before-centered' === newval ) {
|
||||
options['headerAlignment'] = 'center';
|
||||
options['navLocation'] = 'nav-above-header';
|
||||
options['navAlignment'] = 'center';
|
||||
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'nav-after-centered' === newval ) {
|
||||
options['headerAlignment'] = 'center';
|
||||
options['navLocation'] = 'nav-below-header';
|
||||
options['navAlignment'] = 'center';
|
||||
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'nav-left' === newval ) {
|
||||
options['headerAlignment'] = 'left';
|
||||
options['navLocation'] = 'nav-float-left';
|
||||
options['navAlignment'] = 'right';
|
||||
|
||||
setOption( options );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
api( 'generate_settings[use_dynamic_typography]', function( value ) {
|
||||
var fontManager = api.control( 'generate_settings[font_manager]' );
|
||||
var typographyManager = api.control( 'generate_settings[typography]' );
|
||||
|
||||
value.bind( function( newval ) {
|
||||
if ( newval ) {
|
||||
if ( fontManager.setting.get().length === 0 ) {
|
||||
fontManager.setting.set( generatepressCustomizeControls.mappedTypographyData.fonts );
|
||||
}
|
||||
|
||||
if ( typographyManager.setting.get().length === 0 ) {
|
||||
typographyManager.setting.set( generatepressCustomizeControls.mappedTypographyData.typography );
|
||||
}
|
||||
}
|
||||
} );
|
||||
} );
|
||||
}( wp.customize ) );
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,341 @@
|
||||
/* global gpPostMessageFields */
|
||||
/* eslint max-depth: off */
|
||||
var gpPostMessage = {
|
||||
|
||||
/**
|
||||
* The fields.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
fields: {},
|
||||
|
||||
/**
|
||||
* A collection of methods for the <style> tags.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
styleTag: {
|
||||
|
||||
/**
|
||||
* Add a <style> tag in <head> if it doesn't already exist.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param {string} id - The field-ID.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
add( id ) {
|
||||
id = id.replace( /[^\w\s]/gi, '-' );
|
||||
if ( null === document.getElementById( 'gp-postmessage-' + id ) || 'undefined' === typeof document.getElementById( 'gp-postmessage-' + id ) ) {
|
||||
jQuery( 'head' ).append( '<style id="gp-postmessage-' + id + '"></style>' );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Add a <style> tag in <head> if it doesn't already exist,
|
||||
* by calling the this.add method, and then add styles inside it.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param {string} id - The field-ID.
|
||||
* @param {string} styles - The styles to add.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
addData( id, styles ) {
|
||||
id = id.replace( '[', '-' ).replace( ']', '' );
|
||||
gpPostMessage.styleTag.add( id );
|
||||
jQuery( '#gp-postmessage-' + id ).text( styles );
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Common utilities.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
util: {
|
||||
|
||||
/**
|
||||
* Processes the value and applies any replacements and/or additions.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param {Object} output - The output (js_vars) argument.
|
||||
* @param {mixed} value - The value.
|
||||
* @param {string} controlType - The control-type.
|
||||
*
|
||||
* @return {string|false} - Returns false if value is excluded, otherwise a string.
|
||||
*/
|
||||
processValue( output, value ) {
|
||||
var self = this,
|
||||
settings = window.parent.wp.customize.get(),
|
||||
excluded = false;
|
||||
|
||||
if ( 'object' === typeof value ) {
|
||||
_.each( value, function( subValue, key ) {
|
||||
value[ key ] = self.processValue( output, subValue );
|
||||
} );
|
||||
return value;
|
||||
}
|
||||
output = _.defaults( output, {
|
||||
prefix: '',
|
||||
units: '',
|
||||
suffix: '',
|
||||
value_pattern: '$',
|
||||
pattern_replace: {},
|
||||
exclude: [],
|
||||
} );
|
||||
|
||||
if ( 1 <= output.exclude.length ) {
|
||||
_.each( output.exclude, function( exclusion ) {
|
||||
if ( value == exclusion ) {
|
||||
excluded = true;
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
if ( excluded ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
value = output.value_pattern.replace( new RegExp( '\\$', 'g' ), value );
|
||||
_.each( output.pattern_replace, function( id, placeholder ) {
|
||||
if ( ! _.isUndefined( settings[ id ] ) ) {
|
||||
value = value.replace( placeholder, settings[ id ] );
|
||||
}
|
||||
} );
|
||||
return output.prefix + value + output.units + output.suffix;
|
||||
},
|
||||
|
||||
/**
|
||||
* Make sure urls are properly formatted for background-image properties.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param {string} url - The URL.
|
||||
*
|
||||
* @return {string} - Returns the URL.
|
||||
*/
|
||||
backgroundImageValue( url ) {
|
||||
return ( -1 === url.indexOf( 'url(' ) ) ? 'url(' + url + ')' : url;
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* A collection of utilities for CSS generation.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
css: {
|
||||
|
||||
/**
|
||||
* Generates the CSS from the output (js_vars) parameter.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param {Object} output - The output (js_vars) argument.
|
||||
* @param {mixed} value - The value.
|
||||
* @param {string} controlType - The control-type.
|
||||
*
|
||||
* @return {string} - Returns CSS as a string.
|
||||
*/
|
||||
fromOutput( output, value, controlType ) {
|
||||
var styles = '',
|
||||
mediaQuery = false,
|
||||
processedValue;
|
||||
|
||||
try {
|
||||
value = JSON.parse( value );
|
||||
} catch ( e ) {} // eslint-disable-line no-empty
|
||||
|
||||
if ( output.js_callback && 'function' === typeof window[ output.js_callback ] ) {
|
||||
value = window[ output.js_callback[ 0 ] ]( value, output.js_callback[ 1 ] );
|
||||
}
|
||||
|
||||
// Apply the gpPostMessageStylesOutput filter.
|
||||
styles = wp.hooks.applyFilters( 'gpPostMessageStylesOutput', styles, value, output, controlType );
|
||||
|
||||
if ( '' === styles ) {
|
||||
switch ( controlType ) {
|
||||
case 'kirki-multicolor':
|
||||
case 'kirki-sortable':
|
||||
styles += output.element + '{';
|
||||
_.each( value, function( val, key ) {
|
||||
if ( output.choice && key !== output.choice ) {
|
||||
return;
|
||||
}
|
||||
processedValue = gpPostMessage.util.processValue( output, val );
|
||||
|
||||
if ( '' === processedValue ) {
|
||||
if ( 'background-color' === output.property ) {
|
||||
processedValue = 'unset';
|
||||
} else if ( 'background-image' === output.property ) {
|
||||
processedValue = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
if ( false !== processedValue ) {
|
||||
styles += output.property ? output.property + '-' + key + ':' + processedValue + ';' : key + ':' + processedValue + ';';
|
||||
}
|
||||
} );
|
||||
styles += '}';
|
||||
break;
|
||||
default:
|
||||
if ( 'kirki-image' === controlType ) {
|
||||
value = ( ! _.isUndefined( value.url ) ) ? gpPostMessage.util.backgroundImageValue( value.url ) : gpPostMessage.util.backgroundImageValue( value );
|
||||
}
|
||||
if ( _.isObject( value ) ) {
|
||||
styles += output.element + '{';
|
||||
_.each( value, function( val, key ) {
|
||||
var property;
|
||||
if ( output.choice && key !== output.choice ) {
|
||||
return;
|
||||
}
|
||||
processedValue = gpPostMessage.util.processValue( output, val );
|
||||
property = output.property ? output.property : key;
|
||||
|
||||
if ( '' === processedValue ) {
|
||||
if ( 'background-color' === property ) {
|
||||
processedValue = 'unset';
|
||||
} else if ( 'background-image' === property ) {
|
||||
processedValue = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
if ( false !== processedValue ) {
|
||||
styles += property + ':' + processedValue + ';';
|
||||
}
|
||||
} );
|
||||
styles += '}';
|
||||
} else {
|
||||
processedValue = gpPostMessage.util.processValue( output, value );
|
||||
if ( '' === processedValue ) {
|
||||
if ( 'background-color' === output.property ) {
|
||||
processedValue = 'unset';
|
||||
} else if ( 'background-image' === output.property ) {
|
||||
processedValue = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
if ( false !== processedValue ) {
|
||||
styles += output.element + '{' + output.property + ':' + processedValue + ';}';
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the media-query.
|
||||
if ( output.media_query && 'string' === typeof output.media_query && ! _.isEmpty( output.media_query ) ) {
|
||||
mediaQuery = output.media_query;
|
||||
if ( -1 === mediaQuery.indexOf( '@media' ) ) {
|
||||
mediaQuery = '@media ' + mediaQuery;
|
||||
}
|
||||
}
|
||||
|
||||
// If we have a media-query, add it and return.
|
||||
if ( mediaQuery ) {
|
||||
return mediaQuery + '{' + styles + '}';
|
||||
}
|
||||
|
||||
// Return the styles.
|
||||
return styles;
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* A collection of utilities to change the HTML in the document.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
html: {
|
||||
|
||||
/**
|
||||
* Modifies the HTML from the output (js_vars) parameter.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param {Object} output - The output (js_vars) argument.
|
||||
* @param {mixed} value - The value.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
fromOutput( output, value ) {
|
||||
if ( output.js_callback && 'function' === typeof window[ output.js_callback ] ) {
|
||||
value = window[ output.js_callback[ 0 ] ]( value, output.js_callback[ 1 ] );
|
||||
}
|
||||
|
||||
if ( _.isObject( value ) || _.isArray( value ) ) {
|
||||
if ( ! output.choice ) {
|
||||
return;
|
||||
}
|
||||
_.each( value, function( val, key ) {
|
||||
if ( output.choice && key !== output.choice ) {
|
||||
return;
|
||||
}
|
||||
value = val;
|
||||
} );
|
||||
}
|
||||
value = gpPostMessage.util.processValue( output, value );
|
||||
|
||||
if ( output.attr ) {
|
||||
jQuery( output.element ).attr( output.attr, value );
|
||||
} else {
|
||||
jQuery( output.element ).html( value );
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* A collection of utilities to allow toggling a CSS class.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
toggleClass: {
|
||||
|
||||
/**
|
||||
* Toggles a CSS class from the output (js_vars) parameter.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param {Object} output - The output (js_vars) argument.
|
||||
* @param {mixed} value - The value.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
fromOutput( output, value ) {
|
||||
if ( 'undefined' === typeof output.class || 'undefined' === typeof output.value ) {
|
||||
return;
|
||||
}
|
||||
if ( value === output.value && ! jQuery( output.element ).hasClass( output.class ) ) {
|
||||
jQuery( output.element ).addClass( output.class );
|
||||
} else {
|
||||
jQuery( output.element ).removeClass( output.class );
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
jQuery( document ).ready( function() {
|
||||
var styles;
|
||||
_.each( gpPostMessageFields, function( field ) {
|
||||
wp.customize( field.settings, function( value ) {
|
||||
value.bind( function( newVal ) {
|
||||
styles = '';
|
||||
_.each( field.js_vars, function( output ) {
|
||||
output.function = ( ! output.function || 'undefined' === typeof gpPostMessage[ output.function ] ) ? 'css' : output.function;
|
||||
field.type = ( field.choices && field.choices.parent_type ) ? field.choices.parent_type : field.type;
|
||||
|
||||
if ( 'css' === output.function ) {
|
||||
styles += gpPostMessage.css.fromOutput( output, newVal, field.type );
|
||||
} else {
|
||||
gpPostMessage[ output.function ].fromOutput( output, newVal, field.type );
|
||||
}
|
||||
} );
|
||||
gpPostMessage.styleTag.addData( field.settings, styles );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
} );
|
@ -1,23 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Load necessary Customizer controls and functions.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
// Controls.
|
||||
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-upsell-section.php';
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-upsell-control.php';
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-deprecated.php';
|
||||
|
||||
// Helper functions.
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'helpers.php';
|
||||
|
||||
// Deprecated.
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'deprecated.php';
|
||||
<?php
|
||||
/**
|
||||
* Load necessary Customizer controls and functions.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
// Add fields.
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'class-customize-field.php';
|
||||
|
||||
// Controls.
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-react-control.php';
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-color-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-upsell-section.php';
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-upsell-control.php';
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-deprecated.php';
|
||||
|
||||
// Helper functions.
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'helpers.php';
|
||||
|
||||
// Deprecated.
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'deprecated.php';
|
||||
|
@ -0,0 +1,162 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the customizer fields for the back to top button.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
GeneratePress_Customize_Field::add_title(
|
||||
'generate_back_to_top_colors_title',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'title' => __( 'Back to Top', 'generatepress' ),
|
||||
'choices' => array(
|
||||
'toggleId' => 'back-to-top-colors',
|
||||
),
|
||||
'active_callback' => function() {
|
||||
if ( generate_get_option( 'back_to_top' ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_wrapper(
|
||||
'generate_back_to_top_background_wrapper',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'type' => 'color',
|
||||
'toggleId' => 'back-to-top-colors',
|
||||
'items' => array(
|
||||
'back_to_top_background_color',
|
||||
'back_to_top_background_color_hover',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[back_to_top_background_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['back_to_top_background_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Background', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'alpha' => true,
|
||||
'toggleId' => 'back-to-top-colors',
|
||||
'wrapper' => 'back_to_top_background_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => 'a.generate-back-to-top',
|
||||
'property' => 'background-color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[back_to_top_background_color_hover]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['back_to_top_background_color_hover'],
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Background Hover', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'alpha' => true,
|
||||
'toggleId' => 'back-to-top-colors',
|
||||
'wrapper' => 'back_to_top_background_color_hover',
|
||||
'tooltip' => __( 'Choose Hover Color', 'generatepress' ),
|
||||
'hideLabel' => true,
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => 'a.generate-back-to-top:hover, a.generate-back-to-top:focus',
|
||||
'property' => 'background-color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_wrapper(
|
||||
'generate_back_to_top_text_wrapper',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'type' => 'color',
|
||||
'toggleId' => 'back-to-top-colors',
|
||||
'items' => array(
|
||||
'back_to_top_text_color',
|
||||
'back_to_top_text_color_hover',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[back_to_top_text_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['back_to_top_text_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Text', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'button-colors',
|
||||
'wrapper' => 'back_to_top_text_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => 'a.generate-back-to-top',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[back_to_top_text_color_hover]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['back_to_top_text_color_hover'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Text Hover', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'back-to-top-colors',
|
||||
'wrapper' => 'back_to_top_text_color_hover',
|
||||
'tooltip' => __( 'Choose Hover Color', 'generatepress' ),
|
||||
'hideLabel' => true,
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => 'a.generate-back-to-top:hover, a.generate-back-to-top:focus',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
156
wp-content/themes/generatepress/inc/customizer/fields/body.php
Normal file
156
wp-content/themes/generatepress/inc/customizer/fields/body.php
Normal file
@ -0,0 +1,156 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the customizer fields for the Body.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
GeneratePress_Customize_Field::add_title(
|
||||
'generate_body_colors_title',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'title' => __( 'Body', 'generatepress' ),
|
||||
'choices' => array(
|
||||
'toggleId' => 'base-colors',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[background_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $defaults['background_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Background', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'base-colors',
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => 'body',
|
||||
'property' => 'background-color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[text_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $defaults['text_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Text', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'base-colors',
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => 'body',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_wrapper(
|
||||
'generate_body_link_wrapper',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'type' => 'color',
|
||||
'toggleId' => 'base-colors',
|
||||
'items' => array(
|
||||
'link_color',
|
||||
'link_color_hover',
|
||||
'link_color_visited',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[link_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $defaults['link_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Link', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'wrapper' => 'link_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
'toggleId' => 'base-colors',
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => 'a, a:visited',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[link_color_hover]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $defaults['link_color_hover'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Link Hover', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'wrapper' => 'link_color_hover',
|
||||
'tooltip' => __( 'Choose Hover Color', 'generatepress' ),
|
||||
'toggleId' => 'base-colors',
|
||||
'hideLabel' => true,
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => 'a:hover',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
if ( '' !== generate_get_option( 'link_color_visited' ) ) {
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[link_color_visited]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $defaults['link_color_visited'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'refresh',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Link Color Visited', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'wrapper' => 'link_color_visited',
|
||||
'tooltip' => __( 'Choose Visited Color', 'generatepress' ),
|
||||
'toggleId' => 'base-colors',
|
||||
'hideLabel' => true,
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
@ -0,0 +1,158 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the customizer fields for the Body.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
GeneratePress_Customize_Field::add_title(
|
||||
'generate_buttons_colors_title',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'title' => __( 'Buttons', 'generatepress' ),
|
||||
'choices' => array(
|
||||
'toggleId' => 'button-colors',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_wrapper(
|
||||
'generate_buttons_background_wrapper',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'type' => 'color',
|
||||
'toggleId' => 'button-colors',
|
||||
'items' => array(
|
||||
'form_button_background_color',
|
||||
'form_button_background_color_hover',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$buttons_selector = 'button, html input[type="button"], input[type="reset"], input[type="submit"], a.button, a.button:visited, a.wp-block-button__link:not(.has-background)';
|
||||
$buttons_hover_selector = 'button:hover, html input[type="button"]:hover, input[type="reset"]:hover, input[type="submit"]:hover, a.button:hover, button:focus, html input[type="button"]:focus, input[type="reset"]:focus, input[type="submit"]:focus, a.button:focus, a.wp-block-button__link:not(.has-background):active, a.wp-block-button__link:not(.has-background):focus, a.wp-block-button__link:not(.has-background):hover';
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[form_button_background_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['form_button_background_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Background', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'alpha' => true,
|
||||
'toggleId' => 'button-colors',
|
||||
'wrapper' => 'form_button_background_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => $buttons_selector,
|
||||
'property' => 'background-color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[form_button_background_color_hover]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['form_button_background_color_hover'],
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Background Hover', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'alpha' => true,
|
||||
'toggleId' => 'button-colors',
|
||||
'wrapper' => 'form_button_background_color_hover',
|
||||
'tooltip' => __( 'Choose Hover Color', 'generatepress' ),
|
||||
'hideLabel' => true,
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => $buttons_hover_selector,
|
||||
'property' => 'background-color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_wrapper(
|
||||
'generate_buttons_text_wrapper',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'type' => 'color',
|
||||
'toggleId' => 'button-colors',
|
||||
'items' => array(
|
||||
'form_button_text_color',
|
||||
'form_button_text_color_hover',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[form_button_text_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['form_button_text_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Text', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'button-colors',
|
||||
'wrapper' => 'form_button_text_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => $buttons_selector,
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[form_button_text_color_hover]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['form_button_text_color_hover'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Text Hover', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'button-colors',
|
||||
'wrapper' => 'form_button_text_color_hover',
|
||||
'tooltip' => __( 'Choose Hover Color', 'generatepress' ),
|
||||
'hideLabel' => true,
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => $buttons_hover_selector,
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
@ -0,0 +1,372 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the customizer fields for the content.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
GeneratePress_Customize_Field::add_title(
|
||||
'generate_content_colors_title',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'title' => __( 'Content', 'generatepress' ),
|
||||
'choices' => array(
|
||||
'toggleId' => 'content-colors',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$content_colors = '.separate-containers .inside-article, .separate-containers .comments-area, .separate-containers .page-header, .one-container .container, .separate-containers .paging-navigation, .inside-page-header';
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[content_background_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['content_background_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Background', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'alpha' => true,
|
||||
'toggleId' => 'content-colors',
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => $content_colors,
|
||||
'property' => 'background-color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[content_text_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['content_text_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Text', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'content-colors',
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => $content_colors,
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_wrapper(
|
||||
'generate_content_link_wrapper',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'type' => 'color',
|
||||
'toggleId' => 'content-colors',
|
||||
'items' => array(
|
||||
'content_link_color',
|
||||
'content_link_hover_color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[content_link_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['content_link_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Link', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'wrapper' => 'content_link_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
'toggleId' => 'content-colors',
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.inside-article a:not(.button):not(.wp-block-button__link), .inside-article a:not(.button):not(.wp-block-button__link):visited, .paging-navigation a, .paging-navigation a:visited, .comments-area a, .comments-area a:visited, .page-header a, .page-header a:visited',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[content_link_hover_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['content_link_hover_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Link Hover', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'wrapper' => 'content_link_hover_color',
|
||||
'tooltip' => __( 'Choose Hover Color', 'generatepress' ),
|
||||
'toggleId' => 'content-colors',
|
||||
'hideLabel' => true,
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.inside-article a:not(.button):not(.wp-block-button__link):hover, .paging-navigation a:hover, .comments-area a:hover, .page-header a:hover',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[content_title_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['content_title_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Content Title', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'content-colors',
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.entry-header h1,.page-header h1',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_wrapper(
|
||||
'generate_archive_content_title_link_wrapper',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'type' => 'color',
|
||||
'toggleId' => 'content-colors',
|
||||
'items' => array(
|
||||
'blog_post_title_color',
|
||||
'blog_post_title_hover_color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[blog_post_title_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['blog_post_title_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Archive Content Title', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'wrapper' => 'blog_post_title_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
'toggleId' => 'content-colors',
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.entry-title a,.entry-title a:visited',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[blog_post_title_hover_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['blog_post_title_hover_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Archive Content Title Hover', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'wrapper' => 'blog_post_title_hover_color',
|
||||
'tooltip' => __( 'Choose Hover Color', 'generatepress' ),
|
||||
'toggleId' => 'content-colors',
|
||||
'hideLabel' => true,
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.entry-title a:hover',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[entry_meta_text_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['entry_meta_text_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Entry Meta Text', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'content-colors',
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.entry-meta',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_wrapper(
|
||||
'generate_entry_meta_link_wrapper',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'type' => 'color',
|
||||
'toggleId' => 'content-colors',
|
||||
'items' => array(
|
||||
'entry_meta_link_color',
|
||||
'entry_meta_link_color_hover',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[entry_meta_link_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['entry_meta_link_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Entry Meta Links', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'wrapper' => 'entry_meta_link_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
'toggleId' => 'content-colors',
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.entry-meta a',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[entry_meta_link_color_hover]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['entry_meta_link_color_hover'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Entry Meta Links Hover', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'wrapper' => 'entry_meta_link_color_hover',
|
||||
'tooltip' => __( 'Choose Hover Color', 'generatepress' ),
|
||||
'toggleId' => 'content-colors',
|
||||
'hideLabel' => true,
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.entry-meta a:hover',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$headings = array(
|
||||
array(
|
||||
'slug' => 'h1_color',
|
||||
'label' => __( 'Heading 1 (H1) Color', 'generatepress' ),
|
||||
'selector' => 'h1',
|
||||
),
|
||||
array(
|
||||
'slug' => 'h2_color',
|
||||
'label' => __( 'Heading 2 (H2) Color', 'generatepress' ),
|
||||
'selector' => 'h2',
|
||||
),
|
||||
array(
|
||||
'slug' => 'h3_color',
|
||||
'label' => __( 'Heading 3 (H3) Color', 'generatepress' ),
|
||||
'selector' => 'h3',
|
||||
),
|
||||
array(
|
||||
'slug' => 'h4_color',
|
||||
'label' => __( 'Heading 4 (H4) Color', 'generatepress' ),
|
||||
'selector' => 'h4',
|
||||
),
|
||||
array(
|
||||
'slug' => 'h5_color',
|
||||
'label' => __( 'Heading 5 (H5) Color', 'generatepress' ),
|
||||
'selector' => 'h5',
|
||||
),
|
||||
array(
|
||||
'slug' => 'h6_color',
|
||||
'label' => __( 'Heading 6 (H6) Color', 'generatepress' ),
|
||||
'selector' => 'h6',
|
||||
),
|
||||
);
|
||||
|
||||
foreach ( $headings as $heading ) {
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[' . $heading['slug'] . ']',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults[ $heading['slug'] ],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => $heading['label'],
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'content-colors',
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => $heading['selector'],
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the customizer fields for the footer bar.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
GeneratePress_Customize_Field::add_title(
|
||||
'generate_footer_bar_colors_title',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'title' => __( 'Footer Bar', 'generatepress' ),
|
||||
'choices' => array(
|
||||
'toggleId' => 'footer-bar-colors',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[footer_background_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['footer_background_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Background', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'alpha' => true,
|
||||
'toggleId' => 'footer-bar-colors',
|
||||
'wrapper' => 'footer_background_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.site-info',
|
||||
'property' => 'background-color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[footer_text_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['footer_text_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Text', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'footer-bar-colors',
|
||||
'wrapper' => 'footer_text_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.site-info',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_wrapper(
|
||||
'generate_footer_bar_colors_wrapper',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'type' => 'color',
|
||||
'toggleId' => 'footer-bar-colors',
|
||||
'items' => array(
|
||||
'footer_link_color',
|
||||
'footer_link_hover_color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[footer_link_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['footer_link_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Link', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'footer-bar-colors',
|
||||
'wrapper' => 'footer_link_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.site-info a',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[footer_link_hover_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['footer_link_hover_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Link Hover', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'footer-bar-colors',
|
||||
'wrapper' => 'footer_link_hover_color',
|
||||
'tooltip' => __( 'Choose Hover Color', 'generatepress' ),
|
||||
'hideLabel' => true,
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.site-info a:hover',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
@ -0,0 +1,161 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the customizer fields for the footer widgets.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
GeneratePress_Customize_Field::add_title(
|
||||
'generate_footer_widgets_colors_title',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'title' => __( 'Footer Widgets', 'generatepress' ),
|
||||
'choices' => array(
|
||||
'toggleId' => 'footer-widget-colors',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[footer_widget_background_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['footer_widget_background_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Background', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'alpha' => true,
|
||||
'toggleId' => 'footer-widget-colors',
|
||||
'wrapper' => 'footer_widget_background_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.footer-widgets',
|
||||
'property' => 'background-color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[footer_widget_text_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['footer_widget_text_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Text', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'footer-widget-colors',
|
||||
'wrapper' => 'footer_widget_text_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.footer-widgets',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_wrapper(
|
||||
'generate_footer_widget_colors_wrapper',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'type' => 'color',
|
||||
'toggleId' => 'footer-widget-colors',
|
||||
'items' => array(
|
||||
'footer_widget_link_color',
|
||||
'footer_widget_link_hover_color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[footer_widget_link_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['footer_widget_link_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Link', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'footer-widget-colors',
|
||||
'wrapper' => 'footer_widget_link_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.footer-widgets a',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[footer_widget_link_hover_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['footer_widget_link_hover_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Link Hover', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'footer-widget-colors',
|
||||
'wrapper' => 'footer_widget_link_hover_color',
|
||||
'tooltip' => __( 'Choose Hover Color', 'generatepress' ),
|
||||
'hideLabel' => true,
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.footer-widgets a:hover',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[footer_widget_title_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['footer_widget_title_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Widget Title', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'footer-widget-colors',
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.footer-widgets .widget-title',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
226
wp-content/themes/generatepress/inc/customizer/fields/forms.php
Normal file
226
wp-content/themes/generatepress/inc/customizer/fields/forms.php
Normal file
@ -0,0 +1,226 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the customizer fields for the Body.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
GeneratePress_Customize_Field::add_title(
|
||||
'generate_forms_colors_title',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'title' => __( 'Forms', 'generatepress' ),
|
||||
'choices' => array(
|
||||
'toggleId' => 'form-colors',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_wrapper(
|
||||
'generate_forms_background_wrapper',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'type' => 'color',
|
||||
'toggleId' => 'form-colors',
|
||||
'items' => array(
|
||||
'form_background_color',
|
||||
'form_background_color_focus',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$forms_selector = 'input[type="text"], input[type="email"], input[type="url"], input[type="password"], input[type="search"], input[type="number"], input[type="tel"], textarea, select';
|
||||
$forms_focus_selector = 'input[type="text"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type="number"]:focus, input[type="tel"]:focus, textarea:focus, select:focus';
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[form_background_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['form_background_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Background', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'alpha' => true,
|
||||
'toggleId' => 'form-colors',
|
||||
'wrapper' => 'form_background_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => $forms_selector,
|
||||
'property' => 'background-color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[form_background_color_focus]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['form_background_color_focus'],
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Background Focus', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'alpha' => true,
|
||||
'toggleId' => 'form-colors',
|
||||
'wrapper' => 'form_background_color_focus',
|
||||
'tooltip' => __( 'Choose Focus Color', 'generatepress' ),
|
||||
'hideLabel' => true,
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => $forms_focus_selector,
|
||||
'property' => 'background-color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_wrapper(
|
||||
'generate_forms_text_wrapper',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'type' => 'color',
|
||||
'toggleId' => 'form-colors',
|
||||
'items' => array(
|
||||
'form_text_color',
|
||||
'form_text_color_focus',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[form_text_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['form_text_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Text', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'form-colors',
|
||||
'wrapper' => 'form_text_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => $forms_selector,
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[form_text_color_focus]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['form_text_color_focus'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Text Focus', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'form-colors',
|
||||
'wrapper' => 'form_text_color_focus',
|
||||
'tooltip' => __( 'Choose Focus Color', 'generatepress' ),
|
||||
'hideLabel' => true,
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => $forms_focus_selector,
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_wrapper(
|
||||
'generate_forms_border_wrapper',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'type' => 'color',
|
||||
'toggleId' => 'form-colors',
|
||||
'items' => array(
|
||||
'form_border_color',
|
||||
'form_border_color_focus',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[form_border_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['form_border_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Border', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'alpha' => true,
|
||||
'toggleId' => 'form-colors',
|
||||
'wrapper' => 'form_border_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => $forms_selector,
|
||||
'property' => 'border-color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[form_border_color_focus]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['form_border_color_focus'],
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Border Focus', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'alpha' => true,
|
||||
'toggleId' => 'form-colors',
|
||||
'wrapper' => 'form_border_color_focus',
|
||||
'tooltip' => __( 'Choose Focus Color', 'generatepress' ),
|
||||
'hideLabel' => true,
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => $forms_focus_selector,
|
||||
'property' => 'border-color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
180
wp-content/themes/generatepress/inc/customizer/fields/header.php
Normal file
180
wp-content/themes/generatepress/inc/customizer/fields/header.php
Normal file
@ -0,0 +1,180 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the customizer fields for the header.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
GeneratePress_Customize_Field::add_title(
|
||||
'generate_header_colors_title',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'title' => __( 'Header', 'generatepress' ),
|
||||
'choices' => array(
|
||||
'toggleId' => 'header-colors',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[header_background_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['header_background_color'],
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Background', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'alpha' => true,
|
||||
'toggleId' => 'header-colors',
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.site-header',
|
||||
'property' => 'background-color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[header_text_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['header_text_color'],
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Text', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'header-colors',
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.site-header',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_wrapper(
|
||||
'generate_header_link_wrapper',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'type' => 'color',
|
||||
'toggleId' => 'header-colors',
|
||||
'items' => array(
|
||||
'header_link_color',
|
||||
'header_link_hover_color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[header_link_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['header_link_color'],
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Link', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'header-colors',
|
||||
'wrapper' => 'header_link_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.site-header a:not([rel="home"])',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[header_link_hover_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['header_link_hover_color'],
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Link Hover', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'header-colors',
|
||||
'wrapper' => 'header_link_hover_color',
|
||||
'tooltip' => __( 'Choose Hover Color', 'generatepress' ),
|
||||
'hideLabel' => true,
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.site-header a:not([rel="home"]):hover',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[site_title_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['site_title_color'],
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Site Title', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'header-colors',
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.main-title a, .main-title a:hover',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[site_tagline_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['site_tagline_color'],
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Tagline', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'header-colors',
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.site-description',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
@ -0,0 +1,214 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the customizer fields for the primary navigation.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*
|
||||
* @var array $color_defaults
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
$menu_hover_selectors = '.navigation-search input[type="search"], .navigation-search input[type="search"]:active, .navigation-search input[type="search"]:focus, .main-navigation .main-nav ul li:not([class*="current-menu-"]):hover > a, .main-navigation .main-nav ul li:not([class*="current-menu-"]):focus > a, .main-navigation .main-nav ul li.sfHover:not([class*="current-menu-"]) > a, .main-navigation .menu-bar-item:hover > a, .main-navigation .menu-bar-item.sfHover > a';
|
||||
$menu_current_selectors = '.main-navigation .main-nav ul li[class*="current-menu-"] > a';
|
||||
$submenu_hover_selectors = '.main-navigation .main-nav ul ul li:not([class*="current-menu-"]):hover > a,.main-navigation .main-nav ul ul li:not([class*="current-menu-"]):focus > a,.main-navigation .main-nav ul ul li.sfHover:not([class*="current-menu-"]) > a';
|
||||
$submenu_current_selectors = '.main-navigation .main-nav ul ul li[class*="current-menu-"] > a';
|
||||
|
||||
GeneratePress_Customize_Field::add_title(
|
||||
'generate_primary_navigation_colors_title',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'title' => __( 'Primary Navigation', 'generatepress' ),
|
||||
'choices' => array(
|
||||
'toggleId' => 'primary-navigation-colors',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
// Navigation background group.
|
||||
GeneratePress_Customize_Field::add_color_field_group(
|
||||
'primary_navigation_background',
|
||||
'generate_colors_section',
|
||||
'primary-navigation-colors',
|
||||
array(
|
||||
'generate_settings[navigation_background_color]' => array(
|
||||
'default_value' => $color_defaults['navigation_background_color'],
|
||||
'label' => __( 'Navigation Background', 'generatepress' ),
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
'element' => '.main-navigation',
|
||||
'property' => 'background-color',
|
||||
'hide_label' => false,
|
||||
),
|
||||
'generate_settings[navigation_background_hover_color]' => array(
|
||||
'default_value' => $color_defaults['navigation_background_hover_color'],
|
||||
'label' => __( 'Navigation Background Hover', 'generatepress' ),
|
||||
'tooltip' => __( 'Choose Hover Color', 'generatepress' ),
|
||||
'element' => $menu_hover_selectors,
|
||||
'property' => 'background-color',
|
||||
'hide_label' => true,
|
||||
),
|
||||
'generate_settings[navigation_background_current_color]' => array(
|
||||
'default_value' => $color_defaults['navigation_background_current_color'],
|
||||
'label' => __( 'Navigation Background Current', 'generatepress' ),
|
||||
'tooltip' => __( 'Choose Current Color', 'generatepress' ),
|
||||
'element' => $menu_current_selectors,
|
||||
'property' => 'background-color',
|
||||
'hide_label' => true,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
// Navigation text group.
|
||||
GeneratePress_Customize_Field::add_color_field_group(
|
||||
'primary_navigation_text',
|
||||
'generate_colors_section',
|
||||
'primary-navigation-colors',
|
||||
array(
|
||||
'generate_settings[navigation_text_color]' => array(
|
||||
'default_value' => $color_defaults['navigation_text_color'],
|
||||
'label' => __( 'Navigation Text', 'generatepress' ),
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
'element' => '.main-navigation .main-nav ul li a, .main-navigation .menu-toggle, .main-navigation button.menu-toggle:hover, .main-navigation button.menu-toggle:focus, .main-navigation .mobile-bar-items a, .main-navigation .mobile-bar-items a:hover, .main-navigation .mobile-bar-items a:focus, .main-navigation .menu-bar-items',
|
||||
'property' => 'color',
|
||||
'hide_label' => false,
|
||||
),
|
||||
'generate_settings[navigation_text_hover_color]' => array(
|
||||
'default_value' => $color_defaults['navigation_text_hover_color'],
|
||||
'label' => __( 'Navigation Text Hover', 'generatepress' ),
|
||||
'tooltip' => __( 'Choose Hover Color', 'generatepress' ),
|
||||
'element' => $menu_hover_selectors,
|
||||
'property' => 'color',
|
||||
'hide_label' => true,
|
||||
),
|
||||
'generate_settings[navigation_text_current_color]' => array(
|
||||
'default_value' => $color_defaults['navigation_text_current_color'],
|
||||
'label' => __( 'Navigation Text Current', 'generatepress' ),
|
||||
'tooltip' => __( 'Choose Current Color', 'generatepress' ),
|
||||
'element' => $menu_current_selectors,
|
||||
'property' => 'color',
|
||||
'hide_label' => true,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
// Sub-Menu background group.
|
||||
GeneratePress_Customize_Field::add_color_field_group(
|
||||
'primary_navigation_submenu_background',
|
||||
'generate_colors_section',
|
||||
'primary-navigation-colors',
|
||||
array(
|
||||
'generate_settings[subnavigation_background_color]' => array(
|
||||
'default_value' => $color_defaults['subnavigation_background_color'],
|
||||
'label' => __( 'Sub-Menu Background', 'generatepress' ),
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
'element' => '.main-navigation ul ul',
|
||||
'property' => 'background-color',
|
||||
'hide_label' => false,
|
||||
),
|
||||
'generate_settings[subnavigation_background_hover_color]' => array(
|
||||
'default_value' => $color_defaults['subnavigation_background_hover_color'],
|
||||
'label' => __( 'Sub-Menu Background Hover', 'generatepress' ),
|
||||
'tooltip' => __( 'Choose Hover Color', 'generatepress' ),
|
||||
'element' => $submenu_hover_selectors,
|
||||
'property' => 'background-color',
|
||||
'hide_label' => true,
|
||||
),
|
||||
'generate_settings[subnavigation_background_current_color]' => array(
|
||||
'default_value' => $color_defaults['subnavigation_background_current_color'],
|
||||
'label' => __( 'Sub-Menu Background Current', 'generatepress' ),
|
||||
'tooltip' => __( 'Choose Current Color', 'generatepress' ),
|
||||
'element' => $submenu_current_selectors,
|
||||
'property' => 'background-color',
|
||||
'hide_label' => true,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
// Sub-Menu text group.
|
||||
GeneratePress_Customize_Field::add_color_field_group(
|
||||
'primary_navigation_submenu_text',
|
||||
'generate_colors_section',
|
||||
'primary-navigation-colors',
|
||||
array(
|
||||
'generate_settings[subnavigation_text_color]' => array(
|
||||
'default_value' => $color_defaults['subnavigation_text_color'],
|
||||
'label' => __( 'Sub-Menu Text', 'generatepress' ),
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
'element' => '.main-navigation .main-nav ul ul li a',
|
||||
'property' => 'color',
|
||||
'hide_label' => false,
|
||||
),
|
||||
'generate_settings[subnavigation_text_hover_color]' => array(
|
||||
'default_value' => $color_defaults['subnavigation_text_hover_color'],
|
||||
'label' => __( 'Sub-Menu Text Hover', 'generatepress' ),
|
||||
'tooltip' => __( 'Choose Hover Color', 'generatepress' ),
|
||||
'element' => $submenu_hover_selectors,
|
||||
'property' => 'color',
|
||||
'hide_label' => true,
|
||||
),
|
||||
'generate_settings[subnavigation_text_current_color]' => array(
|
||||
'default_value' => $color_defaults['subnavigation_text_current_color'],
|
||||
'label' => __( 'Sub-Menu Text Current', 'generatepress' ),
|
||||
'tooltip' => __( 'Choose Current Color', 'generatepress' ),
|
||||
'element' => $submenu_current_selectors,
|
||||
'property' => 'color',
|
||||
'hide_label' => true,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_title(
|
||||
'generate_navigation_search_colors_title',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'title' => __( 'Navigation Search', 'generatepress' ),
|
||||
'choices' => array(
|
||||
'toggleId' => 'primary-navigation-search-colors',
|
||||
),
|
||||
'active_callback' => function() {
|
||||
if ( 'enable' === generate_get_option( 'nav_search' ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[navigation_search_background_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['navigation_search_background_color'],
|
||||
'transport' => 'refresh',
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Background', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'alpha' => true,
|
||||
'toggleId' => 'primary-navigation-search-colors',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[navigation_search_text_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['navigation_search_text_color'],
|
||||
'transport' => 'refresh',
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Text', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'alpha' => true,
|
||||
'toggleId' => 'primary-navigation-search-colors',
|
||||
),
|
||||
)
|
||||
);
|
@ -0,0 +1,161 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the customizer fields for the sidebar widgets.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
GeneratePress_Customize_Field::add_title(
|
||||
'generate_sidebar_widgets_colors_title',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'title' => __( 'Sidebar Widgets', 'generatepress' ),
|
||||
'choices' => array(
|
||||
'toggleId' => 'sidebar-widget-colors',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[sidebar_widget_background_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['sidebar_widget_background_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Background', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'alpha' => true,
|
||||
'toggleId' => 'sidebar-widget-colors',
|
||||
'wrapper' => 'sidebar_widget_background_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.sidebar .widget',
|
||||
'property' => 'background-color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[sidebar_widget_text_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['sidebar_widget_text_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Text', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'sidebar-widget-colors',
|
||||
'wrapper' => 'sidebar_widget_text_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.sidebar .widget',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_wrapper(
|
||||
'generate_sidebar_widget_colors_wrapper',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'type' => 'color',
|
||||
'toggleId' => 'sidebar-widget-colors',
|
||||
'items' => array(
|
||||
'sidebar_widget_link_color',
|
||||
'sidebar_widget_link_hover_color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[sidebar_widget_link_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['sidebar_widget_link_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Link', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'sidebar-widget-colors',
|
||||
'wrapper' => 'sidebar_widget_link_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.sidebar .widget a',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[sidebar_widget_link_hover_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['sidebar_widget_link_hover_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Link Hover', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'sidebar-widget-colors',
|
||||
'wrapper' => 'sidebar_widget_link_hover_color',
|
||||
'tooltip' => __( 'Choose Hover Color', 'generatepress' ),
|
||||
'hideLabel' => true,
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.sidebar .widget a:hover',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[sidebar_widget_title_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['sidebar_widget_title_color'],
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'postMessage',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Widget Title', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'toggleId' => 'sidebar-widget-colors',
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.sidebar .widget .widget-title',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
@ -0,0 +1,140 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the customizer fields for the top bar.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
GeneratePress_Customize_Field::add_title(
|
||||
'generate_top_bar_colors_title',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'title' => __( 'Top Bar', 'generatepress' ),
|
||||
'choices' => array(
|
||||
'toggleId' => 'top-bar-colors',
|
||||
),
|
||||
'active_callback' => 'generate_is_top_bar_active',
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[top_bar_background_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['top_bar_background_color'],
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Background', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'settings' => 'generate_settings[top_bar_background_color]',
|
||||
'active_callback' => 'generate_is_top_bar_active',
|
||||
'choices' => array(
|
||||
'alpha' => true,
|
||||
'toggleId' => 'top-bar-colors',
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.top-bar',
|
||||
'property' => 'background-color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[top_bar_text_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['top_bar_text_color'],
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Text', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'active_callback' => 'generate_is_top_bar_active',
|
||||
'choices' => array(
|
||||
'toggleId' => 'top-bar-colors',
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.top-bar',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_wrapper(
|
||||
'generate_top_bar_link_wrapper',
|
||||
array(
|
||||
'section' => 'generate_colors_section',
|
||||
'choices' => array(
|
||||
'type' => 'color',
|
||||
'toggleId' => 'top-bar-colors',
|
||||
'items' => array(
|
||||
'top_bar_link_color',
|
||||
'top_bar_link_color_hover',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[top_bar_link_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['top_bar_link_color'],
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Link', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'active_callback' => 'generate_is_top_bar_active',
|
||||
'choices' => array(
|
||||
'wrapper' => 'top_bar_link_color',
|
||||
'tooltip' => __( 'Choose Initial Color', 'generatepress' ),
|
||||
'toggleId' => 'top-bar-colors',
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.top-bar a',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[top_bar_link_color_hover]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
array(
|
||||
'default' => $color_defaults['top_bar_link_color_hover'],
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Link Hover', 'generatepress' ),
|
||||
'section' => 'generate_colors_section',
|
||||
'active_callback' => 'generate_is_top_bar_active',
|
||||
'choices' => array(
|
||||
'wrapper' => 'top_bar_link_color_hover',
|
||||
'tooltip' => __( 'Choose Hover Color', 'generatepress' ),
|
||||
'toggleId' => 'top-bar-colors',
|
||||
'hideLabel' => true,
|
||||
),
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => '.top-bar a:hover',
|
||||
'property' => 'color',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
@ -1,348 +1,453 @@
|
||||
<?php
|
||||
/**
|
||||
* Helper functions for the Customizer.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_is_posts_page' ) ) {
|
||||
/**
|
||||
* Check to see if we're on a posts page
|
||||
*
|
||||
* @since 1.3.39
|
||||
*/
|
||||
function generate_is_posts_page() {
|
||||
return ( is_home() || is_archive() || is_tax() ) ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_is_footer_bar_active' ) ) {
|
||||
/**
|
||||
* Check to see if we're using our footer bar widget
|
||||
*
|
||||
* @since 1.3.42
|
||||
*/
|
||||
function generate_is_footer_bar_active() {
|
||||
return ( is_active_sidebar( 'footer-bar' ) ) ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_is_top_bar_active' ) ) {
|
||||
/**
|
||||
* Check to see if the top bar is active
|
||||
*
|
||||
* @since 1.3.45
|
||||
*/
|
||||
function generate_is_top_bar_active() {
|
||||
$top_bar = is_active_sidebar( 'top-bar' ) ? true : false;
|
||||
return apply_filters( 'generate_is_top_bar_active', $top_bar );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_customize_partial_blogname' ) ) {
|
||||
/**
|
||||
* Render the site title for the selective refresh partial.
|
||||
*
|
||||
* @since 1.3.41
|
||||
*/
|
||||
function generate_customize_partial_blogname() {
|
||||
bloginfo( 'name' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_customize_partial_blogdescription' ) ) {
|
||||
/**
|
||||
* Render the site tagline for the selective refresh partial.
|
||||
*
|
||||
* @since 1.3.41
|
||||
*/
|
||||
function generate_customize_partial_blogdescription() {
|
||||
bloginfo( 'description' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( '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.
|
||||
*
|
||||
* @since 1.3.42
|
||||
*/
|
||||
function generate_enqueue_color_palettes() {
|
||||
// Old versions of WP don't get nice things.
|
||||
if ( ! function_exists( 'wp_add_inline_script' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Grab our palette array and turn it into JS.
|
||||
$palettes = wp_json_encode( generate_get_default_color_palettes() );
|
||||
|
||||
// Add our custom palettes.
|
||||
// json_encode takes care of escaping.
|
||||
wp_add_inline_script( 'wp-color-picker', 'jQuery.wp.wpColorPicker.prototype.options.palettes = ' . $palettes . ';' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_sanitize_integer' ) ) {
|
||||
/**
|
||||
* Sanitize integers.
|
||||
*
|
||||
* @since 1.0.8
|
||||
* @param string $input The value to check.
|
||||
*/
|
||||
function generate_sanitize_integer( $input ) {
|
||||
return absint( $input );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_sanitize_decimal_integer' ) ) {
|
||||
/**
|
||||
* Sanitize integers that can use decimals.
|
||||
*
|
||||
* @since 1.3.41
|
||||
* @param string $input The value to check.
|
||||
*/
|
||||
function generate_sanitize_decimal_integer( $input ) {
|
||||
return abs( floatval( $input ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize a positive number, but allow an empty value.
|
||||
*
|
||||
* @since 2.2
|
||||
* @param string $input The value to check.
|
||||
*/
|
||||
function generate_sanitize_empty_absint( $input ) {
|
||||
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose.
|
||||
if ( '' == $input ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return absint( $input );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_sanitize_checkbox' ) ) {
|
||||
/**
|
||||
* Sanitize checkbox values.
|
||||
*
|
||||
* @since 1.0.8
|
||||
* @param string $checked The value to check.
|
||||
*/
|
||||
function generate_sanitize_checkbox( $checked ) {
|
||||
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose.
|
||||
return ( ( isset( $checked ) && true == $checked ) ? true : false );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_sanitize_blog_excerpt' ) ) {
|
||||
/**
|
||||
* Sanitize blog excerpt.
|
||||
* Needed because GP Premium calls the control ID which is different from the settings ID.
|
||||
*
|
||||
* @since 1.0.8
|
||||
* @param string $input The value to check.
|
||||
*/
|
||||
function generate_sanitize_blog_excerpt( $input ) {
|
||||
$valid = array(
|
||||
'full',
|
||||
'excerpt',
|
||||
);
|
||||
|
||||
if ( in_array( $input, $valid ) ) {
|
||||
return $input;
|
||||
} else {
|
||||
return 'full';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_sanitize_hex_color' ) ) {
|
||||
/**
|
||||
* Sanitize colors.
|
||||
* Allow blank value.
|
||||
*
|
||||
* @since 1.2.9.6
|
||||
* @param string $color The color to check.
|
||||
*/
|
||||
function generate_sanitize_hex_color( $color ) {
|
||||
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose.
|
||||
if ( '' === $color ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// 3 or 6 hex digits, or the empty string.
|
||||
if ( preg_match( '|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) {
|
||||
return $color;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize RGBA colors.
|
||||
*
|
||||
* @since 2.2
|
||||
* @param string $color The color to check.
|
||||
*/
|
||||
function generate_sanitize_rgba_color( $color ) {
|
||||
if ( '' === $color ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( false === strpos( $color, 'rgba' ) ) {
|
||||
return generate_sanitize_hex_color( $color );
|
||||
}
|
||||
|
||||
$color = str_replace( ' ', '', $color );
|
||||
sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha );
|
||||
|
||||
return 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $alpha . ')';
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_sanitize_choices' ) ) {
|
||||
/**
|
||||
* Sanitize choices.
|
||||
*
|
||||
* @since 1.3.24
|
||||
* @param string $input The value to check.
|
||||
* @param object $setting The setting object.
|
||||
*/
|
||||
function generate_sanitize_choices( $input, $setting ) {
|
||||
// Ensure input is a slug.
|
||||
$input = sanitize_key( $input );
|
||||
|
||||
// Get list of choices from the control.
|
||||
// associated with the setting.
|
||||
$choices = $setting->manager->get_control( $setting->id )->choices;
|
||||
|
||||
// If the input is a valid key, return it.
|
||||
// otherwise, return the default.
|
||||
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize our Google Font variants
|
||||
*
|
||||
* @since 2.0
|
||||
* @param string $input The value to check.
|
||||
*/
|
||||
function generate_sanitize_variants( $input ) {
|
||||
if ( is_array( $input ) ) {
|
||||
$input = implode( ',', $input );
|
||||
}
|
||||
return sanitize_text_field( $input );
|
||||
}
|
||||
|
||||
add_action( 'customize_controls_enqueue_scripts', 'generate_do_control_inline_scripts', 100 );
|
||||
/**
|
||||
* Add misc inline scripts to our controls.
|
||||
*
|
||||
* We don't want to add these to the controls themselves, as they will be repeated
|
||||
* each time the control is initialized.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
function generate_do_control_inline_scripts() {
|
||||
wp_localize_script(
|
||||
'generatepress-typography-customizer',
|
||||
'gp_customize',
|
||||
array(
|
||||
'nonce' => wp_create_nonce( 'gp_customize_nonce' ),
|
||||
)
|
||||
);
|
||||
|
||||
$number_of_fonts = apply_filters( 'generate_number_of_fonts', 200 );
|
||||
|
||||
wp_localize_script(
|
||||
'generatepress-typography-customizer',
|
||||
'generatePressTypography',
|
||||
array(
|
||||
'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_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_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_spacing_defaults', generate_spacing_get_defaults() );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_customizer_live_preview' ) ) {
|
||||
add_action( 'customize_preview_init', 'generate_customizer_live_preview', 100 );
|
||||
/**
|
||||
* Add our live preview scripts
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_customizer_live_preview() {
|
||||
$spacing_settings = wp_parse_args(
|
||||
get_option( 'generate_spacing_settings', array() ),
|
||||
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_localize_script(
|
||||
'generate-themecustomizer',
|
||||
'generatepress_live_preview',
|
||||
array(
|
||||
'mobile' => generate_get_media_query( 'mobile' ),
|
||||
'tablet' => generate_get_media_query( 'tablet' ),
|
||||
'desktop' => generate_get_media_query( 'desktop' ),
|
||||
'contentLeft' => absint( $spacing_settings['content_left'] ),
|
||||
'contentRight' => absint( $spacing_settings['content_right'] ),
|
||||
'isFlex' => generate_is_using_flexbox(),
|
||||
'isRTL' => is_rtl(),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if we have a logo or not.
|
||||
*
|
||||
* Used as an active callback. Calling has_custom_logo creates a PHP notice for
|
||||
* multisite users.
|
||||
*
|
||||
* @since 2.0.1
|
||||
*/
|
||||
function generate_has_custom_logo_callback() {
|
||||
if ( get_theme_mod( 'custom_logo' ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save our preset layout controls. These should always save to be "current".
|
||||
*
|
||||
* @since 2.2
|
||||
*/
|
||||
function generate_sanitize_preset_layout() {
|
||||
return 'current';
|
||||
}
|
||||
|
||||
/**
|
||||
* Display options if we're using the Floats structure.
|
||||
*/
|
||||
function generate_is_using_floats_callback() {
|
||||
return 'floats' === generate_get_option( 'structure' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to determine whether to show the inline logo option.
|
||||
*/
|
||||
function generate_show_inline_logo_callback() {
|
||||
return 'floats' === generate_get_option( 'structure' ) && generate_has_logo_site_branding();
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* Helper functions for the Customizer.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_is_posts_page' ) ) {
|
||||
/**
|
||||
* Check to see if we're on a posts page
|
||||
*
|
||||
* @since 1.3.39
|
||||
*/
|
||||
function generate_is_posts_page() {
|
||||
return ( is_home() || is_archive() || is_tax() ) ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_is_footer_bar_active' ) ) {
|
||||
/**
|
||||
* Check to see if we're using our footer bar widget
|
||||
*
|
||||
* @since 1.3.42
|
||||
*/
|
||||
function generate_is_footer_bar_active() {
|
||||
return ( is_active_sidebar( 'footer-bar' ) ) ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_is_top_bar_active' ) ) {
|
||||
/**
|
||||
* Check to see if the top bar is active
|
||||
*
|
||||
* @since 1.3.45
|
||||
*/
|
||||
function generate_is_top_bar_active() {
|
||||
$top_bar = is_active_sidebar( 'top-bar' ) ? true : false;
|
||||
return apply_filters( 'generate_is_top_bar_active', $top_bar );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_customize_partial_blogname' ) ) {
|
||||
/**
|
||||
* Render the site title for the selective refresh partial.
|
||||
*
|
||||
* @since 1.3.41
|
||||
*/
|
||||
function generate_customize_partial_blogname() {
|
||||
bloginfo( 'name' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_customize_partial_blogdescription' ) ) {
|
||||
/**
|
||||
* Render the site tagline for the selective refresh partial.
|
||||
*
|
||||
* @since 1.3.41
|
||||
*/
|
||||
function generate_customize_partial_blogdescription() {
|
||||
bloginfo( 'description' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( '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.
|
||||
*
|
||||
* @since 1.3.42
|
||||
*/
|
||||
function generate_enqueue_color_palettes() {
|
||||
// Old versions of WP don't get nice things.
|
||||
if ( ! function_exists( 'wp_add_inline_script' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Grab our palette array and turn it into JS.
|
||||
$palettes = wp_json_encode( generate_get_default_color_palettes() );
|
||||
|
||||
// Add our custom palettes.
|
||||
// json_encode takes care of escaping.
|
||||
wp_add_inline_script( 'wp-color-picker', 'jQuery.wp.wpColorPicker.prototype.options.palettes = ' . $palettes . ';' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_sanitize_integer' ) ) {
|
||||
/**
|
||||
* Sanitize integers.
|
||||
*
|
||||
* @since 1.0.8
|
||||
* @param string $input The value to check.
|
||||
*/
|
||||
function generate_sanitize_integer( $input ) {
|
||||
return absint( $input );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_sanitize_decimal_integer' ) ) {
|
||||
/**
|
||||
* Sanitize integers that can use decimals.
|
||||
*
|
||||
* @since 1.3.41
|
||||
* @param string $input The value to check.
|
||||
*/
|
||||
function generate_sanitize_decimal_integer( $input ) {
|
||||
return abs( floatval( $input ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize integers that can use decimals.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param string $input The value to check.
|
||||
*/
|
||||
function generate_sanitize_empty_decimal_integer( $input ) {
|
||||
if ( '' === $input ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return abs( floatval( $input ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize integers that can use negative decimals.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param string $input The value to check.
|
||||
*/
|
||||
function generate_sanitize_empty_negative_decimal_integer( $input ) {
|
||||
if ( '' === $input ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return floatval( $input );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize a positive number, but allow an empty value.
|
||||
*
|
||||
* @since 2.2
|
||||
* @param string $input The value to check.
|
||||
*/
|
||||
function generate_sanitize_empty_absint( $input ) {
|
||||
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose.
|
||||
if ( '' == $input ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return absint( $input );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_sanitize_checkbox' ) ) {
|
||||
/**
|
||||
* Sanitize checkbox values.
|
||||
*
|
||||
* @since 1.0.8
|
||||
* @param string $checked The value to check.
|
||||
*/
|
||||
function generate_sanitize_checkbox( $checked ) {
|
||||
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose.
|
||||
return ( ( isset( $checked ) && true == $checked ) ? true : false );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_sanitize_blog_excerpt' ) ) {
|
||||
/**
|
||||
* Sanitize blog excerpt.
|
||||
* Needed because GP Premium calls the control ID which is different from the settings ID.
|
||||
*
|
||||
* @since 1.0.8
|
||||
* @param string $input The value to check.
|
||||
*/
|
||||
function generate_sanitize_blog_excerpt( $input ) {
|
||||
$valid = array(
|
||||
'full',
|
||||
'excerpt',
|
||||
);
|
||||
|
||||
if ( in_array( $input, $valid ) ) {
|
||||
return $input;
|
||||
} else {
|
||||
return 'full';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_sanitize_hex_color' ) ) {
|
||||
/**
|
||||
* Sanitize colors.
|
||||
* Allow blank value.
|
||||
*
|
||||
* @since 1.2.9.6
|
||||
* @param string $color The color to check.
|
||||
*/
|
||||
function generate_sanitize_hex_color( $color ) {
|
||||
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose.
|
||||
if ( '' === $color ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// 3 or 6 hex digits, or the empty string.
|
||||
if ( preg_match( '|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) {
|
||||
return $color;
|
||||
}
|
||||
|
||||
if ( strpos( $color, 'var(' ) !== false ) {
|
||||
return sanitize_text_field( $color );
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize RGBA colors.
|
||||
*
|
||||
* @since 2.2
|
||||
* @param string $color The color to check.
|
||||
*/
|
||||
function generate_sanitize_rgba_color( $color ) {
|
||||
if ( '' === $color ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( false === strpos( $color, 'rgba' ) ) {
|
||||
return generate_sanitize_hex_color( $color );
|
||||
}
|
||||
|
||||
$color = str_replace( ' ', '', $color );
|
||||
sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha );
|
||||
|
||||
return 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $alpha . ')';
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_sanitize_choices' ) ) {
|
||||
/**
|
||||
* Sanitize choices.
|
||||
*
|
||||
* @since 1.3.24
|
||||
* @param string $input The value to check.
|
||||
* @param object $setting The setting object.
|
||||
*/
|
||||
function generate_sanitize_choices( $input, $setting ) {
|
||||
// Ensure input is a slug.
|
||||
$input = sanitize_key( $input );
|
||||
|
||||
// Get list of choices from the control.
|
||||
// associated with the setting.
|
||||
$choices = $setting->manager->get_control( $setting->id )->choices;
|
||||
|
||||
// If the input is a valid key, return it.
|
||||
// otherwise, return the default.
|
||||
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize our Google Font variants
|
||||
*
|
||||
* @since 2.0
|
||||
* @param string $input The value to check.
|
||||
*/
|
||||
function generate_sanitize_variants( $input ) {
|
||||
if ( is_array( $input ) ) {
|
||||
$input = implode( ',', $input );
|
||||
}
|
||||
return sanitize_text_field( $input );
|
||||
}
|
||||
|
||||
add_action( 'customize_controls_enqueue_scripts', 'generate_do_control_inline_scripts', 100 );
|
||||
/**
|
||||
* Add misc inline scripts to our controls.
|
||||
*
|
||||
* We don't want to add these to the controls themselves, as they will be repeated
|
||||
* each time the control is initialized.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
function generate_do_control_inline_scripts() {
|
||||
wp_localize_script(
|
||||
'generatepress-typography-customizer',
|
||||
'gp_customize',
|
||||
array(
|
||||
'nonce' => wp_create_nonce( 'gp_customize_nonce' ),
|
||||
)
|
||||
);
|
||||
|
||||
$number_of_fonts = apply_filters( 'generate_number_of_fonts', 200 );
|
||||
|
||||
wp_localize_script(
|
||||
'generatepress-typography-customizer',
|
||||
'generatePressTypography',
|
||||
array(
|
||||
'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_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_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_spacing_defaults', generate_spacing_get_defaults() );
|
||||
|
||||
wp_localize_script(
|
||||
'generatepress-customizer-controls',
|
||||
'generatepressCustomizeControls',
|
||||
array(
|
||||
'mappedTypographyData' => array(
|
||||
'typography' => GeneratePress_Typography_Migration::get_mapped_typography_data(),
|
||||
'fonts' => GeneratePress_Typography_Migration::get_mapped_font_data(),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'generate-customizer-controls',
|
||||
trailingslashit( get_template_directory_uri() ) . 'assets/dist/customizer.js',
|
||||
// We're including wp-color-picker for localized strings, nothing more.
|
||||
array( 'customize-controls', 'wp-i18n', 'wp-components', 'wp-element', 'jquery', 'customize-base', 'wp-color-picker' ),
|
||||
GENERATE_VERSION,
|
||||
true
|
||||
);
|
||||
|
||||
$color_palette = get_theme_support( 'editor-color-palette' );
|
||||
$colors = array();
|
||||
|
||||
if ( is_array( $color_palette ) ) {
|
||||
foreach ( $color_palette as $key => $value ) {
|
||||
foreach ( $value as $color ) {
|
||||
$colors[] = array(
|
||||
'name' => $color['name'],
|
||||
'color' => $color['color'],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wp_localize_script(
|
||||
'generate-customizer-controls',
|
||||
'generateCustomizerControls',
|
||||
array(
|
||||
'palette' => $colors,
|
||||
)
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'generate-customizer-controls',
|
||||
trailingslashit( get_template_directory_uri() ) . 'assets/dist/style-customizer.css',
|
||||
array( 'wp-components' ),
|
||||
GENERATE_VERSION
|
||||
);
|
||||
|
||||
$global_colors = generate_get_global_colors();
|
||||
$global_colors_css = ':root {';
|
||||
|
||||
if ( ! empty( $global_colors ) ) {
|
||||
foreach ( (array) $global_colors as $key => $data ) {
|
||||
$global_colors_css .= '--' . $data['slug'] . ':' . $data['color'] . ';';
|
||||
}
|
||||
}
|
||||
|
||||
$global_colors_css .= '}';
|
||||
|
||||
wp_add_inline_style( 'generate-customizer-controls', $global_colors_css );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_customizer_live_preview' ) ) {
|
||||
add_action( 'customize_preview_init', 'generate_customizer_live_preview', 100 );
|
||||
/**
|
||||
* Add our live preview scripts
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_customizer_live_preview() {
|
||||
$spacing_settings = wp_parse_args(
|
||||
get_option( 'generate_spacing_settings', array() ),
|
||||
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_localize_script(
|
||||
'generate-themecustomizer',
|
||||
'generatepress_live_preview',
|
||||
array(
|
||||
'mobile' => generate_get_media_query( 'mobile' ),
|
||||
'tablet' => generate_get_media_query( 'tablet_only' ),
|
||||
'desktop' => generate_get_media_query( 'desktop' ),
|
||||
'contentLeft' => absint( $spacing_settings['content_left'] ),
|
||||
'contentRight' => absint( $spacing_settings['content_right'] ),
|
||||
'isFlex' => generate_is_using_flexbox(),
|
||||
'isRTL' => is_rtl(),
|
||||
)
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'generate-postMessage',
|
||||
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/postMessage.js',
|
||||
array( 'jquery', 'customize-preview', 'wp-hooks' ),
|
||||
GENERATE_VERSION,
|
||||
true
|
||||
);
|
||||
|
||||
global $generate_customize_fields;
|
||||
wp_localize_script( 'generate-postMessage', 'gpPostMessageFields', $generate_customize_fields );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if we have a logo or not.
|
||||
*
|
||||
* Used as an active callback. Calling has_custom_logo creates a PHP notice for
|
||||
* multisite users.
|
||||
*
|
||||
* @since 2.0.1
|
||||
*/
|
||||
function generate_has_custom_logo_callback() {
|
||||
if ( get_theme_mod( 'custom_logo' ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save our preset layout controls. These should always save to be "current".
|
||||
*
|
||||
* @since 2.2
|
||||
*/
|
||||
function generate_sanitize_preset_layout() {
|
||||
return 'current';
|
||||
}
|
||||
|
||||
/**
|
||||
* Display options if we're using the Floats structure.
|
||||
*/
|
||||
function generate_is_using_floats_callback() {
|
||||
return 'floats' === generate_get_option( 'structure' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to determine whether to show the inline logo option.
|
||||
*/
|
||||
function generate_show_inline_logo_callback() {
|
||||
return 'floats' === generate_get_option( 'structure' ) && generate_has_logo_site_branding();
|
||||
}
|
||||
|
@ -1,378 +1,378 @@
|
||||
<?php
|
||||
/**
|
||||
* Builds our admin page.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_create_menu' ) ) {
|
||||
add_action( 'admin_menu', 'generate_create_menu' );
|
||||
/**
|
||||
* Adds our "GeneratePress" dashboard menu item
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
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' );
|
||||
add_action( "admin_print_styles-$generate_page", 'generate_options_styles' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_options_styles' ) ) {
|
||||
/**
|
||||
* Adds any necessary scripts to the GP dashboard page
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_options_styles() {
|
||||
wp_enqueue_style( 'generate-options', get_template_directory_uri() . '/assets/css/admin/style.css', array(), GENERATE_VERSION );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_settings_page' ) ) {
|
||||
/**
|
||||
* Builds the content of our GP dashboard page
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_settings_page() {
|
||||
?>
|
||||
<div class="wrap">
|
||||
<div class="metabox-holder">
|
||||
<div class="gp-masthead clearfix">
|
||||
<div class="gp-container">
|
||||
<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>
|
||||
</div>
|
||||
<div class="gp-masthead-links">
|
||||
<?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>
|
||||
<?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://docs.generatepress.com' ); ?>" target="_blank"><?php esc_html_e( 'Documentation', 'generatepress' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_dashboard_after_header hook.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
do_action( 'generate_dashboard_after_header' );
|
||||
?>
|
||||
|
||||
<div class="gp-container">
|
||||
<div class="postbox-container clearfix" style="float: none;">
|
||||
<div class="grid-container grid-parent">
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_dashboard_inside_container hook.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
do_action( 'generate_dashboard_inside_container' );
|
||||
?>
|
||||
|
||||
<div class="form-metabox grid-70" style="padding-left: 0;">
|
||||
<h2 style="height:0;margin:0;"><!-- admin notices below this element --></h2>
|
||||
<form method="post" action="options.php">
|
||||
<?php settings_fields( 'generate-settings-group' ); ?>
|
||||
<?php do_settings_sections( 'generate-settings-group' ); ?>
|
||||
<div class="customize-button hide-on-desktop">
|
||||
<?php
|
||||
printf(
|
||||
'<a id="generate_customize_button" class="button button-primary" href="%1$s">%2$s</a>',
|
||||
esc_url( admin_url( 'customize.php' ) ),
|
||||
esc_html__( 'Customize', 'generatepress' )
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_inside_options_form hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_inside_options_form' );
|
||||
?>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
$modules = array(
|
||||
'Backgrounds' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#backgrounds', false ),
|
||||
),
|
||||
'Blog' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#blog', false ),
|
||||
),
|
||||
'Colors' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#colors', false ),
|
||||
),
|
||||
'Copyright' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#copyright', false ),
|
||||
),
|
||||
'Disable Elements' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#disable-elements', false ),
|
||||
),
|
||||
'Elements' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#elements', false ),
|
||||
),
|
||||
'Import / Export' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#import-export', false ),
|
||||
),
|
||||
'Menu Plus' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#menu-plus', false ),
|
||||
),
|
||||
'Secondary Nav' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#secondary-nav', false ),
|
||||
),
|
||||
'Sections' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#sections', false ),
|
||||
),
|
||||
'Site Library' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/site-library', false ),
|
||||
),
|
||||
'Spacing' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#spacing', false ),
|
||||
),
|
||||
'Typography' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#typography', false ),
|
||||
),
|
||||
'WooCommerce' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#woocommerce', false ),
|
||||
),
|
||||
);
|
||||
|
||||
if ( ! defined( 'GP_PREMIUM_VERSION' ) ) :
|
||||
?>
|
||||
<div class="postbox generate-metabox">
|
||||
<h3 class="hndle"><?php esc_html_e( 'Premium Modules', 'generatepress' ); ?></h3>
|
||||
<div class="inside" style="margin:0;padding:0;">
|
||||
<div class="premium-addons">
|
||||
<?php
|
||||
foreach ( $modules as $module => $info ) {
|
||||
?>
|
||||
<div class="add-on activated gp-clear addon-container grid-parent">
|
||||
<div class="addon-name column-addon-name" style="">
|
||||
<a href="<?php echo esc_url( $info['url'] ); ?>" target="_blank"><?php echo esc_html( $module ); ?></a>
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gp-clear"></div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
/**
|
||||
* generate_options_items hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_options_items' );
|
||||
|
||||
$typography_section = 'customize.php?autofocus[section]=font_section';
|
||||
$colors_section = 'customize.php?autofocus[section]=body_section';
|
||||
|
||||
if ( function_exists( 'generatepress_is_module_active' ) ) {
|
||||
if ( generatepress_is_module_active( 'generate_package_typography', 'GENERATE_TYPOGRAPHY' ) ) {
|
||||
$typography_section = 'customize.php?autofocus[panel]=generate_typography_panel';
|
||||
}
|
||||
|
||||
if ( generatepress_is_module_active( 'generate_package_colors', 'GENERATE_COLORS' ) ) {
|
||||
$colors_section = 'customize.php?autofocus[panel]=generate_colors_panel';
|
||||
}
|
||||
}
|
||||
|
||||
$quick_settings = array(
|
||||
'logo' => array(
|
||||
'title' => __( 'Upload Logo', 'generatepress' ),
|
||||
'icon' => 'dashicons-format-image',
|
||||
'url' => admin_url( 'customize.php?autofocus[control]=custom_logo' ),
|
||||
),
|
||||
'typography' => array(
|
||||
'title' => __( 'Customize Fonts', 'generatepress' ),
|
||||
'icon' => 'dashicons-editor-textcolor',
|
||||
'url' => admin_url( $typography_section ),
|
||||
),
|
||||
'colors' => array(
|
||||
'title' => __( 'Customize Colors', 'generatepress' ),
|
||||
'icon' => 'dashicons-admin-customizer',
|
||||
'url' => admin_url( $colors_section ),
|
||||
),
|
||||
'layout' => array(
|
||||
'title' => __( 'Layout Options', 'generatepress' ),
|
||||
'icon' => 'dashicons-layout',
|
||||
'url' => admin_url( 'customize.php?autofocus[panel]=generate_layout_panel' ),
|
||||
),
|
||||
'all' => array(
|
||||
'title' => __( 'All Options', 'generatepress' ),
|
||||
'icon' => 'dashicons-admin-generic',
|
||||
'url' => admin_url( 'customize.php' ),
|
||||
),
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="generate-right-sidebar grid-30" style="padding-right: 0;">
|
||||
<div class="postbox generate-metabox start-customizing">
|
||||
<h3 class="hndle"><?php esc_html_e( 'Start Customizing', 'generatepress' ); ?></h3>
|
||||
<div class="inside">
|
||||
<ul>
|
||||
<?php
|
||||
foreach ( $quick_settings as $key => $data ) {
|
||||
printf(
|
||||
'<li><span class="dashicons %1$s"></span> <a href="%2$s">%3$s</a></li>',
|
||||
esc_attr( $data['icon'] ),
|
||||
esc_url( $data['url'] ),
|
||||
esc_html( $data['title'] )
|
||||
);
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
||||
<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 →', 'generatepress' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_admin_right_panel hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_admin_right_panel' );
|
||||
?>
|
||||
|
||||
<div class="postbox generate-metabox" id="gen-delete">
|
||||
<h3 class="hndle"><?php esc_html_e( 'Reset Settings', 'generatepress' ); ?></h3>
|
||||
<div class="inside">
|
||||
<p><?php esc_html_e( 'Deleting your settings can not be undone.', 'generatepress' ); ?></p>
|
||||
<form method="post">
|
||||
<p><input type="hidden" name="generate_reset_customizer" value="generate_reset_customizer_settings" /></p>
|
||||
<p>
|
||||
<?php
|
||||
$warning = 'return confirm("' . esc_html__( 'Warning: This will delete your settings.', 'generatepress' ) . '")';
|
||||
wp_nonce_field( 'generate_reset_customizer_nonce', 'generate_reset_customizer_nonce' );
|
||||
|
||||
submit_button(
|
||||
esc_attr__( 'Reset', 'generatepress' ),
|
||||
'button-primary',
|
||||
'submit',
|
||||
false,
|
||||
array(
|
||||
'onclick' => esc_js( $warning ),
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
|
||||
</form>
|
||||
<?php
|
||||
/**
|
||||
* generate_delete_settings_form hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_delete_settings_form' );
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gp-options-footer">
|
||||
<span>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Heart icon */
|
||||
_x( 'Made with %s by Tom Usborne', 'made with love', 'generatepress' ),
|
||||
'<span style="color:#D04848" class="dashicons dashicons-heart"></span>'
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_reset_customizer_settings' ) ) {
|
||||
add_action( 'admin_init', 'generate_reset_customizer_settings' );
|
||||
/**
|
||||
* Reset customizer settings
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_reset_customizer_settings() {
|
||||
if ( empty( $_POST['generate_reset_customizer'] ) || 'generate_reset_customizer_settings' !== $_POST['generate_reset_customizer'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$nonce = isset( $_POST['generate_reset_customizer_nonce'] ) ? sanitize_key( $_POST['generate_reset_customizer_nonce'] ) : '';
|
||||
|
||||
if ( ! wp_verify_nonce( $nonce, 'generate_reset_customizer_nonce' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete_option( 'generate_settings' );
|
||||
delete_option( 'generate_dynamic_css_output' );
|
||||
delete_option( 'generate_dynamic_css_cached_version' );
|
||||
remove_theme_mod( 'font_body_variants' );
|
||||
remove_theme_mod( 'font_body_category' );
|
||||
|
||||
wp_safe_redirect( admin_url( 'themes.php?page=generate-options&status=reset' ) );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_admin_errors' ) ) {
|
||||
add_action( 'admin_notices', 'generate_admin_errors' );
|
||||
/**
|
||||
* Add our admin notices
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_admin_errors() {
|
||||
$screen = get_current_screen();
|
||||
|
||||
if ( 'appearance_page_generate-options' !== $screen->base ) {
|
||||
return;
|
||||
}
|
||||
|
||||
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' );
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only checking. False positive.
|
||||
if ( isset( $_GET['status'] ) && 'imported' === $_GET['status'] ) {
|
||||
add_settings_error( 'generate-notices', 'imported', esc_html__( 'Import successful.', 'generatepress' ), 'updated' );
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only checking. False positive.
|
||||
if ( isset( $_GET['status'] ) && 'reset' === $_GET['status'] ) {
|
||||
add_settings_error( 'generate-notices', 'reset', esc_html__( 'Settings removed.', 'generatepress' ), 'updated' );
|
||||
}
|
||||
|
||||
settings_errors( 'generate-notices' );
|
||||
}
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* Builds our admin page.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_create_menu' ) ) {
|
||||
add_action( 'admin_menu', 'generate_create_menu' );
|
||||
/**
|
||||
* Adds our "GeneratePress" dashboard menu item
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
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' );
|
||||
add_action( "admin_print_styles-$generate_page", 'generate_options_styles' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_options_styles' ) ) {
|
||||
/**
|
||||
* Adds any necessary scripts to the GP dashboard page
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_options_styles() {
|
||||
wp_enqueue_style( 'generate-options', get_template_directory_uri() . '/assets/css/admin/style.css', array(), GENERATE_VERSION );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_settings_page' ) ) {
|
||||
/**
|
||||
* Builds the content of our GP dashboard page
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_settings_page() {
|
||||
?>
|
||||
<div class="wrap">
|
||||
<div class="metabox-holder">
|
||||
<div class="gp-masthead clearfix">
|
||||
<div class="gp-container">
|
||||
<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>
|
||||
</div>
|
||||
<div class="gp-masthead-links">
|
||||
<?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>
|
||||
<?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://docs.generatepress.com' ); ?>" target="_blank"><?php esc_html_e( 'Documentation', 'generatepress' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_dashboard_after_header hook.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
do_action( 'generate_dashboard_after_header' );
|
||||
?>
|
||||
|
||||
<div class="gp-container">
|
||||
<div class="postbox-container clearfix" style="float: none;">
|
||||
<div class="grid-container grid-parent">
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_dashboard_inside_container hook.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
do_action( 'generate_dashboard_inside_container' );
|
||||
?>
|
||||
|
||||
<div class="form-metabox grid-70" style="padding-left: 0;">
|
||||
<h2 style="height:0;margin:0;"><!-- admin notices below this element --></h2>
|
||||
<form method="post" action="options.php">
|
||||
<?php settings_fields( 'generate-settings-group' ); ?>
|
||||
<?php do_settings_sections( 'generate-settings-group' ); ?>
|
||||
<div class="customize-button hide-on-desktop">
|
||||
<?php
|
||||
printf(
|
||||
'<a id="generate_customize_button" class="button button-primary" href="%1$s">%2$s</a>',
|
||||
esc_url( admin_url( 'customize.php' ) ),
|
||||
esc_html__( 'Customize', 'generatepress' )
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_inside_options_form hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_inside_options_form' );
|
||||
?>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
$modules = array(
|
||||
'Backgrounds' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#backgrounds', false ),
|
||||
),
|
||||
'Blog' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#blog', false ),
|
||||
),
|
||||
'Colors' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#colors', false ),
|
||||
),
|
||||
'Copyright' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#copyright', false ),
|
||||
),
|
||||
'Disable Elements' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#disable-elements', false ),
|
||||
),
|
||||
'Elements' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#elements', false ),
|
||||
),
|
||||
'Import / Export' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#import-export', false ),
|
||||
),
|
||||
'Menu Plus' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#menu-plus', false ),
|
||||
),
|
||||
'Secondary Nav' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#secondary-nav', false ),
|
||||
),
|
||||
'Sections' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#sections', false ),
|
||||
),
|
||||
'Site Library' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/site-library', false ),
|
||||
),
|
||||
'Spacing' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#spacing', false ),
|
||||
),
|
||||
'Typography' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#typography', false ),
|
||||
),
|
||||
'WooCommerce' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#woocommerce', false ),
|
||||
),
|
||||
);
|
||||
|
||||
if ( ! defined( 'GP_PREMIUM_VERSION' ) ) :
|
||||
?>
|
||||
<div class="postbox generate-metabox">
|
||||
<h3 class="hndle"><?php esc_html_e( 'Premium Modules', 'generatepress' ); ?></h3>
|
||||
<div class="inside" style="margin:0;padding:0;">
|
||||
<div class="premium-addons">
|
||||
<?php
|
||||
foreach ( $modules as $module => $info ) {
|
||||
?>
|
||||
<div class="add-on activated gp-clear addon-container grid-parent">
|
||||
<div class="addon-name column-addon-name" style="">
|
||||
<a href="<?php echo esc_url( $info['url'] ); ?>" target="_blank"><?php echo esc_html( $module ); ?></a>
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gp-clear"></div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
/**
|
||||
* generate_options_items hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_options_items' );
|
||||
|
||||
$typography_section = 'customize.php?autofocus[section]=font_section';
|
||||
$colors_section = 'customize.php?autofocus[section]=body_section';
|
||||
|
||||
if ( function_exists( 'generatepress_is_module_active' ) ) {
|
||||
if ( generatepress_is_module_active( 'generate_package_typography', 'GENERATE_TYPOGRAPHY' ) ) {
|
||||
$typography_section = 'customize.php?autofocus[panel]=generate_typography_panel';
|
||||
}
|
||||
|
||||
if ( generatepress_is_module_active( 'generate_package_colors', 'GENERATE_COLORS' ) ) {
|
||||
$colors_section = 'customize.php?autofocus[panel]=generate_colors_panel';
|
||||
}
|
||||
}
|
||||
|
||||
$quick_settings = array(
|
||||
'logo' => array(
|
||||
'title' => __( 'Upload Logo', 'generatepress' ),
|
||||
'icon' => 'dashicons-format-image',
|
||||
'url' => admin_url( 'customize.php?autofocus[control]=custom_logo' ),
|
||||
),
|
||||
'typography' => array(
|
||||
'title' => __( 'Customize Fonts', 'generatepress' ),
|
||||
'icon' => 'dashicons-editor-textcolor',
|
||||
'url' => admin_url( $typography_section ),
|
||||
),
|
||||
'colors' => array(
|
||||
'title' => __( 'Customize Colors', 'generatepress' ),
|
||||
'icon' => 'dashicons-admin-customizer',
|
||||
'url' => admin_url( $colors_section ),
|
||||
),
|
||||
'layout' => array(
|
||||
'title' => __( 'Layout Options', 'generatepress' ),
|
||||
'icon' => 'dashicons-layout',
|
||||
'url' => admin_url( 'customize.php?autofocus[panel]=generate_layout_panel' ),
|
||||
),
|
||||
'all' => array(
|
||||
'title' => __( 'All Options', 'generatepress' ),
|
||||
'icon' => 'dashicons-admin-generic',
|
||||
'url' => admin_url( 'customize.php' ),
|
||||
),
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="generate-right-sidebar grid-30" style="padding-right: 0;">
|
||||
<div class="postbox generate-metabox start-customizing">
|
||||
<h3 class="hndle"><?php esc_html_e( 'Start Customizing', 'generatepress' ); ?></h3>
|
||||
<div class="inside">
|
||||
<ul>
|
||||
<?php
|
||||
foreach ( $quick_settings as $key => $data ) {
|
||||
printf(
|
||||
'<li><span class="dashicons %1$s"></span> <a href="%2$s">%3$s</a></li>',
|
||||
esc_attr( $data['icon'] ),
|
||||
esc_url( $data['url'] ),
|
||||
esc_html( $data['title'] )
|
||||
);
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
||||
<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 →', 'generatepress' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_admin_right_panel hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_admin_right_panel' );
|
||||
?>
|
||||
|
||||
<div class="postbox generate-metabox" id="gen-delete">
|
||||
<h3 class="hndle"><?php esc_html_e( 'Reset Settings', 'generatepress' ); ?></h3>
|
||||
<div class="inside">
|
||||
<p><?php esc_html_e( 'Deleting your settings can not be undone.', 'generatepress' ); ?></p>
|
||||
<form method="post">
|
||||
<p><input type="hidden" name="generate_reset_customizer" value="generate_reset_customizer_settings" /></p>
|
||||
<p>
|
||||
<?php
|
||||
$warning = 'return confirm("' . esc_html__( 'Warning: This will delete your settings.', 'generatepress' ) . '")';
|
||||
wp_nonce_field( 'generate_reset_customizer_nonce', 'generate_reset_customizer_nonce' );
|
||||
|
||||
submit_button(
|
||||
esc_attr__( 'Reset', 'generatepress' ),
|
||||
'button-primary',
|
||||
'submit',
|
||||
false,
|
||||
array(
|
||||
'onclick' => esc_js( $warning ),
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
|
||||
</form>
|
||||
<?php
|
||||
/**
|
||||
* generate_delete_settings_form hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_delete_settings_form' );
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gp-options-footer">
|
||||
<span>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Heart icon */
|
||||
_x( 'Made with %s by Tom Usborne', 'made with love', 'generatepress' ),
|
||||
'<span style="color:#D04848" class="dashicons dashicons-heart"></span>'
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_reset_customizer_settings' ) ) {
|
||||
add_action( 'admin_init', 'generate_reset_customizer_settings' );
|
||||
/**
|
||||
* Reset customizer settings
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_reset_customizer_settings() {
|
||||
if ( empty( $_POST['generate_reset_customizer'] ) || 'generate_reset_customizer_settings' !== $_POST['generate_reset_customizer'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$nonce = isset( $_POST['generate_reset_customizer_nonce'] ) ? sanitize_key( $_POST['generate_reset_customizer_nonce'] ) : '';
|
||||
|
||||
if ( ! wp_verify_nonce( $nonce, 'generate_reset_customizer_nonce' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete_option( 'generate_settings' );
|
||||
delete_option( 'generate_dynamic_css_output' );
|
||||
delete_option( 'generate_dynamic_css_cached_version' );
|
||||
remove_theme_mod( 'font_body_variants' );
|
||||
remove_theme_mod( 'font_body_category' );
|
||||
|
||||
wp_safe_redirect( admin_url( 'themes.php?page=generate-options&status=reset' ) );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_admin_errors' ) ) {
|
||||
add_action( 'admin_notices', 'generate_admin_errors' );
|
||||
/**
|
||||
* Add our admin notices
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_admin_errors() {
|
||||
$screen = get_current_screen();
|
||||
|
||||
if ( 'appearance_page_generate-options' !== $screen->base ) {
|
||||
return;
|
||||
}
|
||||
|
||||
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' );
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only checking. False positive.
|
||||
if ( isset( $_GET['status'] ) && 'imported' === $_GET['status'] ) {
|
||||
add_settings_error( 'generate-notices', 'imported', esc_html__( 'Import successful.', 'generatepress' ), 'updated' );
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only checking. False positive.
|
||||
if ( isset( $_GET['status'] ) && 'reset' === $_GET['status'] ) {
|
||||
add_settings_error( 'generate-notices', 'reset', esc_html__( 'Settings removed.', 'generatepress' ), 'updated' );
|
||||
}
|
||||
|
||||
settings_errors( 'generate-notices' );
|
||||
}
|
||||
}
|
||||
|
@ -1,368 +1,414 @@
|
||||
<?php
|
||||
/**
|
||||
* Sets all of our theme defaults.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_get_defaults' ) ) {
|
||||
/**
|
||||
* Set default options
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_get_defaults() {
|
||||
return apply_filters(
|
||||
'generate_option_defaults',
|
||||
array(
|
||||
'hide_title' => '',
|
||||
'hide_tagline' => true,
|
||||
'logo' => '',
|
||||
'inline_logo_site_branding' => false,
|
||||
'retina_logo' => '',
|
||||
'logo_width' => '',
|
||||
'top_bar_width' => 'full',
|
||||
'top_bar_inner_width' => 'contained',
|
||||
'top_bar_alignment' => 'right',
|
||||
'container_width' => '1200',
|
||||
'container_alignment' => 'text',
|
||||
'header_layout_setting' => 'fluid-header',
|
||||
'header_inner_width' => 'contained',
|
||||
'nav_alignment_setting' => is_rtl() ? 'right' : 'left',
|
||||
'header_alignment_setting' => is_rtl() ? 'right' : 'left',
|
||||
'nav_layout_setting' => 'fluid-nav',
|
||||
'nav_inner_width' => 'contained',
|
||||
'nav_position_setting' => 'nav-float-right',
|
||||
'nav_drop_point' => '',
|
||||
'nav_dropdown_type' => 'hover',
|
||||
'nav_dropdown_direction' => is_rtl() ? 'left' : 'right',
|
||||
'nav_search' => 'disable',
|
||||
'content_layout_setting' => 'separate-containers',
|
||||
'layout_setting' => 'right-sidebar',
|
||||
'blog_layout_setting' => 'right-sidebar',
|
||||
'single_layout_setting' => 'right-sidebar',
|
||||
'post_content' => 'excerpt',
|
||||
'footer_layout_setting' => 'fluid-footer',
|
||||
'footer_inner_width' => 'contained',
|
||||
'footer_widget_setting' => '3',
|
||||
'footer_bar_alignment' => 'right',
|
||||
'back_to_top' => '',
|
||||
'background_color' => '#f7f8f9',
|
||||
'text_color' => '#222222',
|
||||
'link_color' => '#1e73be',
|
||||
'link_color_hover' => '#000000',
|
||||
'link_color_visited' => '',
|
||||
'font_awesome_essentials' => true,
|
||||
'icons' => 'svg',
|
||||
'combine_css' => true,
|
||||
'dynamic_css_cache' => true,
|
||||
'structure' => 'flexbox',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_get_color_defaults' ) ) {
|
||||
/**
|
||||
* Set default options
|
||||
*/
|
||||
function generate_get_color_defaults() {
|
||||
return apply_filters(
|
||||
'generate_color_option_defaults',
|
||||
array(
|
||||
'top_bar_background_color' => '#636363',
|
||||
'top_bar_text_color' => '#ffffff',
|
||||
'top_bar_link_color' => '#ffffff',
|
||||
'top_bar_link_color_hover' => '#303030',
|
||||
'header_background_color' => '#ffffff',
|
||||
'header_text_color' => '',
|
||||
'header_link_color' => '',
|
||||
'header_link_hover_color' => '',
|
||||
'site_title_color' => '#222222',
|
||||
'site_tagline_color' => '#757575',
|
||||
'navigation_background_color' => '#ffffff',
|
||||
'navigation_text_color' => '#515151',
|
||||
'navigation_background_hover_color' => '#ffffff',
|
||||
'navigation_text_hover_color' => '#7a8896',
|
||||
'navigation_background_current_color' => '#ffffff',
|
||||
'navigation_text_current_color' => '#7a8896',
|
||||
'subnavigation_background_color' => '#eaeaea',
|
||||
'subnavigation_text_color' => '#515151',
|
||||
'subnavigation_background_hover_color' => '#eaeaea',
|
||||
'subnavigation_text_hover_color' => '#7a8896',
|
||||
'subnavigation_background_current_color' => '#eaeaea',
|
||||
'subnavigation_text_current_color' => '#7a8896',
|
||||
'navigation_search_background_color' => '',
|
||||
'navigation_search_text_color' => '',
|
||||
'content_background_color' => '#ffffff',
|
||||
'content_text_color' => '',
|
||||
'content_link_color' => '',
|
||||
'content_link_hover_color' => '',
|
||||
'content_title_color' => '',
|
||||
'blog_post_title_color' => '#222222',
|
||||
'blog_post_title_hover_color' => '#55555e',
|
||||
'entry_meta_text_color' => '#595959',
|
||||
'entry_meta_link_color' => '',
|
||||
'entry_meta_link_color_hover' => '',
|
||||
'h1_color' => '',
|
||||
'h2_color' => '',
|
||||
'h3_color' => '',
|
||||
'h4_color' => '',
|
||||
'h5_color' => '',
|
||||
'h6_color' => '',
|
||||
'sidebar_widget_background_color' => '#ffffff',
|
||||
'sidebar_widget_text_color' => '',
|
||||
'sidebar_widget_link_color' => '',
|
||||
'sidebar_widget_link_hover_color' => '',
|
||||
'sidebar_widget_title_color' => '',
|
||||
'footer_widget_background_color' => '#ffffff',
|
||||
'footer_widget_text_color' => '',
|
||||
'footer_widget_link_color' => '',
|
||||
'footer_widget_link_hover_color' => '',
|
||||
'footer_widget_title_color' => '#000000',
|
||||
'footer_background_color' => '#55555e',
|
||||
'footer_text_color' => '#ffffff',
|
||||
'footer_link_color' => '#ffffff',
|
||||
'footer_link_hover_color' => '#d3d3d3',
|
||||
'form_background_color' => '#fafafa',
|
||||
'form_text_color' => '#666666',
|
||||
'form_background_color_focus' => '#ffffff',
|
||||
'form_text_color_focus' => '#666666',
|
||||
'form_border_color' => '#cccccc',
|
||||
'form_border_color_focus' => '#bfbfbf',
|
||||
'form_button_background_color' => '#55555e',
|
||||
'form_button_background_color_hover' => '#3f4047',
|
||||
'form_button_text_color' => '#ffffff',
|
||||
'form_button_text_color_hover' => '#ffffff',
|
||||
'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_text_color' => '#ffffff',
|
||||
'back_to_top_text_color_hover' => '#ffffff',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_get_default_fonts' ) ) {
|
||||
/**
|
||||
* Set default options.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @param bool $filter Whether to return the filtered values or original values.
|
||||
* @return array Option defaults.
|
||||
*/
|
||||
function generate_get_default_fonts( $filter = true ) {
|
||||
$defaults = array(
|
||||
'font_body' => 'System Stack',
|
||||
'font_body_category' => '',
|
||||
'font_body_variants' => '',
|
||||
'body_font_weight' => 'normal',
|
||||
'body_font_transform' => 'none',
|
||||
'body_font_size' => '17',
|
||||
'body_line_height' => '1.5', // no unit.
|
||||
'paragraph_margin' => '1.5', // em.
|
||||
'font_top_bar' => 'inherit',
|
||||
'font_top_bar_category' => '',
|
||||
'font_top_bar_variants' => '',
|
||||
'top_bar_font_weight' => 'normal',
|
||||
'top_bar_font_transform' => 'none',
|
||||
'top_bar_font_size' => '13',
|
||||
'font_site_title' => 'inherit',
|
||||
'font_site_title_category' => '',
|
||||
'font_site_title_variants' => '',
|
||||
'site_title_font_weight' => 'bold',
|
||||
'site_title_font_transform' => 'none',
|
||||
'site_title_font_size' => '25',
|
||||
'mobile_site_title_font_size' => '',
|
||||
'font_site_tagline' => 'inherit',
|
||||
'font_site_tagline_category' => '',
|
||||
'font_site_tagline_variants' => '',
|
||||
'site_tagline_font_weight' => 'normal',
|
||||
'site_tagline_font_transform' => 'none',
|
||||
'site_tagline_font_size' => '15',
|
||||
'font_navigation' => 'inherit',
|
||||
'font_navigation_category' => '',
|
||||
'font_navigation_variants' => '',
|
||||
'navigation_font_weight' => 'normal',
|
||||
'navigation_font_transform' => 'none',
|
||||
'navigation_font_size' => '15',
|
||||
'font_widget_title' => 'inherit',
|
||||
'font_widget_title_category' => '',
|
||||
'font_widget_title_variants' => '',
|
||||
'widget_title_font_weight' => 'normal',
|
||||
'widget_title_font_transform' => 'none',
|
||||
'widget_title_font_size' => '20',
|
||||
'widget_title_separator' => '30',
|
||||
'widget_content_font_size' => '17',
|
||||
'font_buttons' => 'inherit',
|
||||
'font_buttons_category' => '',
|
||||
'font_buttons_variants' => '',
|
||||
'buttons_font_weight' => 'normal',
|
||||
'buttons_font_transform' => 'none',
|
||||
'buttons_font_size' => '',
|
||||
'font_heading_1' => 'inherit',
|
||||
'font_heading_1_category' => '',
|
||||
'font_heading_1_variants' => '',
|
||||
'heading_1_weight' => 'normal',
|
||||
'heading_1_transform' => 'none',
|
||||
'heading_1_font_size' => '42',
|
||||
'heading_1_line_height' => '1.2', // em.
|
||||
'heading_1_margin_bottom' => '20',
|
||||
'mobile_heading_1_font_size' => '31',
|
||||
'font_heading_2' => 'inherit',
|
||||
'font_heading_2_category' => '',
|
||||
'font_heading_2_variants' => '',
|
||||
'heading_2_weight' => 'normal',
|
||||
'heading_2_transform' => 'none',
|
||||
'heading_2_font_size' => '35',
|
||||
'heading_2_line_height' => '1.2', // em.
|
||||
'heading_2_margin_bottom' => '20',
|
||||
'mobile_heading_2_font_size' => '27',
|
||||
'font_heading_3' => 'inherit',
|
||||
'font_heading_3_category' => '',
|
||||
'font_heading_3_variants' => '',
|
||||
'heading_3_weight' => 'normal',
|
||||
'heading_3_transform' => 'none',
|
||||
'heading_3_font_size' => '29',
|
||||
'heading_3_line_height' => '1.2', // em.
|
||||
'heading_3_margin_bottom' => '20',
|
||||
'mobile_heading_3_font_size' => '24',
|
||||
'font_heading_4' => 'inherit',
|
||||
'font_heading_4_category' => '',
|
||||
'font_heading_4_variants' => '',
|
||||
'heading_4_weight' => 'normal',
|
||||
'heading_4_transform' => 'none',
|
||||
'heading_4_font_size' => '24',
|
||||
'heading_4_line_height' => '', // em.
|
||||
'mobile_heading_4_font_size' => '22',
|
||||
'font_heading_5' => 'inherit',
|
||||
'font_heading_5_category' => '',
|
||||
'font_heading_5_variants' => '',
|
||||
'heading_5_weight' => 'normal',
|
||||
'heading_5_transform' => 'none',
|
||||
'heading_5_font_size' => '20',
|
||||
'heading_5_line_height' => '', // em.
|
||||
'mobile_heading_5_font_size' => '19',
|
||||
'font_heading_6' => 'inherit',
|
||||
'font_heading_6_category' => '',
|
||||
'font_heading_6_variants' => '',
|
||||
'heading_6_weight' => 'normal',
|
||||
'heading_6_transform' => 'none',
|
||||
'heading_6_font_size' => '',
|
||||
'heading_6_line_height' => '', // em.
|
||||
'font_footer' => 'inherit',
|
||||
'font_footer_category' => '',
|
||||
'font_footer_variants' => '',
|
||||
'footer_weight' => 'normal',
|
||||
'footer_transform' => 'none',
|
||||
'footer_font_size' => '15',
|
||||
);
|
||||
|
||||
if ( $filter ) {
|
||||
return apply_filters( 'generate_font_option_defaults', $defaults );
|
||||
}
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_spacing_get_defaults' ) ) {
|
||||
/**
|
||||
* Set the default options.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @param bool $filter Whether to return the filtered values or original values.
|
||||
* @return array Option defaults.
|
||||
*/
|
||||
function generate_spacing_get_defaults( $filter = true ) {
|
||||
$defaults = array(
|
||||
'top_bar_top' => '10',
|
||||
'top_bar_right' => '40',
|
||||
'top_bar_bottom' => '10',
|
||||
'top_bar_left' => '40',
|
||||
'mobile_top_bar_top' => '',
|
||||
'mobile_top_bar_right' => '30',
|
||||
'mobile_top_bar_bottom' => '',
|
||||
'mobile_top_bar_left' => '30',
|
||||
'header_top' => '20',
|
||||
'header_right' => '40',
|
||||
'header_bottom' => '20',
|
||||
'header_left' => '40',
|
||||
'menu_item' => '20',
|
||||
'menu_item_height' => '60',
|
||||
'sub_menu_item_height' => '10',
|
||||
'sub_menu_width' => '200',
|
||||
'content_top' => '40',
|
||||
'content_right' => '40',
|
||||
'content_bottom' => '40',
|
||||
'content_left' => '40',
|
||||
'mobile_content_top' => '30',
|
||||
'mobile_content_right' => '30',
|
||||
'mobile_content_bottom' => '30',
|
||||
'mobile_content_left' => '30',
|
||||
'separator' => '20',
|
||||
'mobile_separator' => '',
|
||||
'left_sidebar_width' => '30',
|
||||
'right_sidebar_width' => '30',
|
||||
'widget_top' => '40',
|
||||
'widget_right' => '40',
|
||||
'widget_bottom' => '40',
|
||||
'widget_left' => '40',
|
||||
'footer_widget_container_top' => '40',
|
||||
'footer_widget_container_right' => '40',
|
||||
'footer_widget_container_bottom' => '40',
|
||||
'footer_widget_container_left' => '40',
|
||||
'footer_widget_separator' => '40',
|
||||
'footer_top' => '20',
|
||||
'footer_right' => '40',
|
||||
'footer_bottom' => '20',
|
||||
'footer_left' => '40',
|
||||
'mobile_footer_top' => '',
|
||||
'mobile_footer_right' => '30',
|
||||
'mobile_footer_bottom' => '',
|
||||
'mobile_footer_left' => '30',
|
||||
);
|
||||
|
||||
if ( $filter ) {
|
||||
return apply_filters( 'generate_spacing_option_defaults', $defaults );
|
||||
}
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_typography_default_fonts' ) ) {
|
||||
/**
|
||||
* Set the default system fonts.
|
||||
*
|
||||
* @since 1.3.40
|
||||
*/
|
||||
function generate_typography_default_fonts() {
|
||||
$fonts = array(
|
||||
'inherit',
|
||||
'System Stack',
|
||||
'Arial, Helvetica, sans-serif',
|
||||
'Century Gothic',
|
||||
'Comic Sans MS',
|
||||
'Courier New',
|
||||
'Georgia, Times New Roman, Times, serif',
|
||||
'Helvetica',
|
||||
'Impact',
|
||||
'Lucida Console',
|
||||
'Lucida Sans Unicode',
|
||||
'Palatino Linotype',
|
||||
'Segoe UI, Helvetica Neue, Helvetica, sans-serif',
|
||||
'Tahoma, Geneva, sans-serif',
|
||||
'Trebuchet MS, Helvetica, sans-serif',
|
||||
'Verdana, Geneva, sans-serif',
|
||||
);
|
||||
|
||||
return apply_filters( 'generate_typography_default_fonts', $fonts );
|
||||
}
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* Sets all of our theme defaults.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_get_defaults' ) ) {
|
||||
/**
|
||||
* Set default options
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_get_defaults() {
|
||||
return apply_filters(
|
||||
'generate_option_defaults',
|
||||
array(
|
||||
'hide_title' => '',
|
||||
'hide_tagline' => true,
|
||||
'logo' => '',
|
||||
'inline_logo_site_branding' => false,
|
||||
'retina_logo' => '',
|
||||
'logo_width' => '',
|
||||
'top_bar_width' => 'full',
|
||||
'top_bar_inner_width' => 'contained',
|
||||
'top_bar_alignment' => 'right',
|
||||
'container_width' => '1200',
|
||||
'container_alignment' => 'text',
|
||||
'header_layout_setting' => 'fluid-header',
|
||||
'header_inner_width' => 'contained',
|
||||
'nav_alignment_setting' => is_rtl() ? 'right' : 'left',
|
||||
'header_alignment_setting' => is_rtl() ? 'right' : 'left',
|
||||
'nav_layout_setting' => 'fluid-nav',
|
||||
'nav_inner_width' => 'contained',
|
||||
'nav_position_setting' => 'nav-float-right',
|
||||
'nav_drop_point' => '',
|
||||
'nav_dropdown_type' => 'hover',
|
||||
'nav_dropdown_direction' => is_rtl() ? 'left' : 'right',
|
||||
'nav_search' => 'disable',
|
||||
'content_layout_setting' => 'separate-containers',
|
||||
'layout_setting' => 'right-sidebar',
|
||||
'blog_layout_setting' => 'right-sidebar',
|
||||
'single_layout_setting' => 'right-sidebar',
|
||||
'post_content' => 'excerpt',
|
||||
'footer_layout_setting' => 'fluid-footer',
|
||||
'footer_inner_width' => 'contained',
|
||||
'footer_widget_setting' => '3',
|
||||
'footer_bar_alignment' => 'right',
|
||||
'back_to_top' => '',
|
||||
'background_color' => 'var(--base-2)',
|
||||
'text_color' => 'var(--contrast)',
|
||||
'link_color' => 'var(--accent)',
|
||||
'link_color_hover' => 'var(--contrast)',
|
||||
'link_color_visited' => '',
|
||||
'font_awesome_essentials' => true,
|
||||
'icons' => 'svg',
|
||||
'combine_css' => true,
|
||||
'dynamic_css_cache' => true,
|
||||
'structure' => 'flexbox',
|
||||
'underline_links' => 'always',
|
||||
'font_manager' => array(),
|
||||
'typography' => array(),
|
||||
'google_font_display' => 'auto',
|
||||
'use_dynamic_typography' => true,
|
||||
'global_colors' => array(
|
||||
array(
|
||||
'name' => __( 'Contrast', 'generatepress' ),
|
||||
'slug' => 'contrast',
|
||||
'color' => '#222222',
|
||||
),
|
||||
array(
|
||||
/* translators: Contrast number */
|
||||
'name' => sprintf( __( 'Contrast %s', 'generatepress' ), '2' ),
|
||||
'slug' => 'contrast-2',
|
||||
'color' => '#575760',
|
||||
),
|
||||
array(
|
||||
/* translators: Contrast number */
|
||||
'name' => sprintf( __( 'Contrast %s', 'generatepress' ), '3' ),
|
||||
'slug' => 'contrast-3',
|
||||
'color' => '#b2b2be',
|
||||
),
|
||||
array(
|
||||
'name' => __( 'Base', 'generatepress' ),
|
||||
'slug' => 'base',
|
||||
'color' => '#f0f0f0',
|
||||
),
|
||||
array(
|
||||
/* translators: Base number */
|
||||
'name' => sprintf( __( 'Base %s', 'generatepress' ), '2' ),
|
||||
'slug' => 'base-2',
|
||||
'color' => '#f7f8f9',
|
||||
),
|
||||
array(
|
||||
/* translators: Base number */
|
||||
'name' => sprintf( __( 'Base %s', 'generatepress' ), '3' ),
|
||||
'slug' => 'base-3',
|
||||
'color' => '#ffffff',
|
||||
),
|
||||
array(
|
||||
'name' => __( 'Accent', 'generatepress' ),
|
||||
'slug' => 'accent',
|
||||
'color' => '#1e73be',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_get_color_defaults' ) ) {
|
||||
/**
|
||||
* Set default options
|
||||
*/
|
||||
function generate_get_color_defaults() {
|
||||
return apply_filters(
|
||||
'generate_color_option_defaults',
|
||||
array(
|
||||
'top_bar_background_color' => '#636363',
|
||||
'top_bar_text_color' => '#ffffff',
|
||||
'top_bar_link_color' => '#ffffff',
|
||||
'top_bar_link_color_hover' => '#303030',
|
||||
'header_background_color' => 'var(--base-3)',
|
||||
'header_text_color' => '',
|
||||
'header_link_color' => '',
|
||||
'header_link_hover_color' => '',
|
||||
'site_title_color' => 'var(--contrast)',
|
||||
'site_tagline_color' => 'var(--contrast-2)',
|
||||
'navigation_background_color' => 'var(--base-3)',
|
||||
'navigation_text_color' => 'var(--contrast)',
|
||||
'navigation_background_hover_color' => '',
|
||||
'navigation_text_hover_color' => 'var(--accent)',
|
||||
'navigation_background_current_color' => '',
|
||||
'navigation_text_current_color' => 'var(--accent)',
|
||||
'subnavigation_background_color' => 'var(--base)',
|
||||
'subnavigation_text_color' => '',
|
||||
'subnavigation_background_hover_color' => '',
|
||||
'subnavigation_text_hover_color' => '',
|
||||
'subnavigation_background_current_color' => '',
|
||||
'subnavigation_text_current_color' => '',
|
||||
'navigation_search_background_color' => '',
|
||||
'navigation_search_text_color' => '',
|
||||
'content_background_color' => 'var(--base-3)',
|
||||
'content_text_color' => '',
|
||||
'content_link_color' => '',
|
||||
'content_link_hover_color' => '',
|
||||
'content_title_color' => '',
|
||||
'blog_post_title_color' => 'var(--contrast)',
|
||||
'blog_post_title_hover_color' => 'var(--contrast-2)',
|
||||
'entry_meta_text_color' => 'var(--contrast-2)',
|
||||
'entry_meta_link_color' => '',
|
||||
'entry_meta_link_color_hover' => '',
|
||||
'h1_color' => '',
|
||||
'h2_color' => '',
|
||||
'h3_color' => '',
|
||||
'h4_color' => '',
|
||||
'h5_color' => '',
|
||||
'h6_color' => '',
|
||||
'sidebar_widget_background_color' => 'var(--base-3)',
|
||||
'sidebar_widget_text_color' => '',
|
||||
'sidebar_widget_link_color' => '',
|
||||
'sidebar_widget_link_hover_color' => '',
|
||||
'sidebar_widget_title_color' => '',
|
||||
'footer_widget_background_color' => 'var(--base-3)',
|
||||
'footer_widget_text_color' => '',
|
||||
'footer_widget_link_color' => '',
|
||||
'footer_widget_link_hover_color' => '',
|
||||
'footer_widget_title_color' => '',
|
||||
'footer_background_color' => 'var(--base-3)',
|
||||
'footer_text_color' => '',
|
||||
'footer_link_color' => '',
|
||||
'footer_link_hover_color' => '',
|
||||
'form_background_color' => 'var(--base-2)',
|
||||
'form_text_color' => 'var(--contrast)',
|
||||
'form_background_color_focus' => 'var(--base-2)',
|
||||
'form_text_color_focus' => 'var(--contrast)',
|
||||
'form_border_color' => 'var(--base)',
|
||||
'form_border_color_focus' => 'var(--contrast-3)',
|
||||
'form_button_background_color' => '#55555e',
|
||||
'form_button_background_color_hover' => '#3f4047',
|
||||
'form_button_text_color' => '#ffffff',
|
||||
'form_button_text_color_hover' => '#ffffff',
|
||||
'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_text_color' => '#ffffff',
|
||||
'back_to_top_text_color_hover' => '#ffffff',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_get_default_fonts' ) ) {
|
||||
/**
|
||||
* Set default options.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @param bool $filter Whether to return the filtered values or original values.
|
||||
* @return array Option defaults.
|
||||
*/
|
||||
function generate_get_default_fonts( $filter = true ) {
|
||||
$defaults = array(
|
||||
'font_body' => 'System Stack',
|
||||
'font_body_category' => '',
|
||||
'font_body_variants' => '',
|
||||
'body_font_weight' => 'normal',
|
||||
'body_font_transform' => 'none',
|
||||
'body_font_size' => '17',
|
||||
'body_line_height' => '1.5', // no unit.
|
||||
'paragraph_margin' => '1.5', // em.
|
||||
'font_top_bar' => 'inherit',
|
||||
'font_top_bar_category' => '',
|
||||
'font_top_bar_variants' => '',
|
||||
'top_bar_font_weight' => 'normal',
|
||||
'top_bar_font_transform' => 'none',
|
||||
'top_bar_font_size' => '13',
|
||||
'font_site_title' => 'inherit',
|
||||
'font_site_title_category' => '',
|
||||
'font_site_title_variants' => '',
|
||||
'site_title_font_weight' => 'bold',
|
||||
'site_title_font_transform' => 'none',
|
||||
'site_title_font_size' => '25',
|
||||
'mobile_site_title_font_size' => '',
|
||||
'font_site_tagline' => 'inherit',
|
||||
'font_site_tagline_category' => '',
|
||||
'font_site_tagline_variants' => '',
|
||||
'site_tagline_font_weight' => 'normal',
|
||||
'site_tagline_font_transform' => 'none',
|
||||
'site_tagline_font_size' => '15',
|
||||
'font_navigation' => 'inherit',
|
||||
'font_navigation_category' => '',
|
||||
'font_navigation_variants' => '',
|
||||
'navigation_font_weight' => 'normal',
|
||||
'navigation_font_transform' => 'none',
|
||||
'navigation_font_size' => '15',
|
||||
'font_widget_title' => 'inherit',
|
||||
'font_widget_title_category' => '',
|
||||
'font_widget_title_variants' => '',
|
||||
'widget_title_font_weight' => 'normal',
|
||||
'widget_title_font_transform' => 'none',
|
||||
'widget_title_font_size' => '20',
|
||||
'widget_title_separator' => '30',
|
||||
'widget_content_font_size' => '17',
|
||||
'font_buttons' => 'inherit',
|
||||
'font_buttons_category' => '',
|
||||
'font_buttons_variants' => '',
|
||||
'buttons_font_weight' => 'normal',
|
||||
'buttons_font_transform' => 'none',
|
||||
'buttons_font_size' => '',
|
||||
'font_heading_1' => 'inherit',
|
||||
'font_heading_1_category' => '',
|
||||
'font_heading_1_variants' => '',
|
||||
'heading_1_weight' => 'normal',
|
||||
'heading_1_transform' => 'none',
|
||||
'heading_1_font_size' => '42',
|
||||
'heading_1_line_height' => '1.2', // em.
|
||||
'heading_1_margin_bottom' => '20',
|
||||
'mobile_heading_1_font_size' => '31',
|
||||
'font_heading_2' => 'inherit',
|
||||
'font_heading_2_category' => '',
|
||||
'font_heading_2_variants' => '',
|
||||
'heading_2_weight' => 'normal',
|
||||
'heading_2_transform' => 'none',
|
||||
'heading_2_font_size' => '35',
|
||||
'heading_2_line_height' => '1.2', // em.
|
||||
'heading_2_margin_bottom' => '20',
|
||||
'mobile_heading_2_font_size' => '27',
|
||||
'font_heading_3' => 'inherit',
|
||||
'font_heading_3_category' => '',
|
||||
'font_heading_3_variants' => '',
|
||||
'heading_3_weight' => 'normal',
|
||||
'heading_3_transform' => 'none',
|
||||
'heading_3_font_size' => '29',
|
||||
'heading_3_line_height' => '1.2', // em.
|
||||
'heading_3_margin_bottom' => '20',
|
||||
'mobile_heading_3_font_size' => '24',
|
||||
'font_heading_4' => 'inherit',
|
||||
'font_heading_4_category' => '',
|
||||
'font_heading_4_variants' => '',
|
||||
'heading_4_weight' => 'normal',
|
||||
'heading_4_transform' => 'none',
|
||||
'heading_4_font_size' => '24',
|
||||
'heading_4_line_height' => '', // em.
|
||||
'mobile_heading_4_font_size' => '22',
|
||||
'font_heading_5' => 'inherit',
|
||||
'font_heading_5_category' => '',
|
||||
'font_heading_5_variants' => '',
|
||||
'heading_5_weight' => 'normal',
|
||||
'heading_5_transform' => 'none',
|
||||
'heading_5_font_size' => '20',
|
||||
'heading_5_line_height' => '', // em.
|
||||
'mobile_heading_5_font_size' => '19',
|
||||
'font_heading_6' => 'inherit',
|
||||
'font_heading_6_category' => '',
|
||||
'font_heading_6_variants' => '',
|
||||
'heading_6_weight' => 'normal',
|
||||
'heading_6_transform' => 'none',
|
||||
'heading_6_font_size' => '',
|
||||
'heading_6_line_height' => '', // em.
|
||||
'font_footer' => 'inherit',
|
||||
'font_footer_category' => '',
|
||||
'font_footer_variants' => '',
|
||||
'footer_weight' => 'normal',
|
||||
'footer_transform' => 'none',
|
||||
'footer_font_size' => '15',
|
||||
);
|
||||
|
||||
if ( $filter ) {
|
||||
return apply_filters( 'generate_font_option_defaults', $defaults );
|
||||
}
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_spacing_get_defaults' ) ) {
|
||||
/**
|
||||
* Set the default options.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @param bool $filter Whether to return the filtered values or original values.
|
||||
* @return array Option defaults.
|
||||
*/
|
||||
function generate_spacing_get_defaults( $filter = true ) {
|
||||
$defaults = array(
|
||||
'top_bar_top' => '10',
|
||||
'top_bar_right' => '40',
|
||||
'top_bar_bottom' => '10',
|
||||
'top_bar_left' => '40',
|
||||
'mobile_top_bar_top' => '',
|
||||
'mobile_top_bar_right' => '30',
|
||||
'mobile_top_bar_bottom' => '',
|
||||
'mobile_top_bar_left' => '30',
|
||||
'header_top' => '20',
|
||||
'header_right' => '40',
|
||||
'header_bottom' => '20',
|
||||
'header_left' => '40',
|
||||
'menu_item' => '20',
|
||||
'menu_item_height' => '60',
|
||||
'sub_menu_item_height' => '10',
|
||||
'sub_menu_width' => '200',
|
||||
'content_top' => '40',
|
||||
'content_right' => '40',
|
||||
'content_bottom' => '40',
|
||||
'content_left' => '40',
|
||||
'mobile_content_top' => '30',
|
||||
'mobile_content_right' => '30',
|
||||
'mobile_content_bottom' => '30',
|
||||
'mobile_content_left' => '30',
|
||||
'separator' => '20',
|
||||
'mobile_separator' => '',
|
||||
'left_sidebar_width' => '30',
|
||||
'right_sidebar_width' => '30',
|
||||
'widget_top' => '40',
|
||||
'widget_right' => '40',
|
||||
'widget_bottom' => '40',
|
||||
'widget_left' => '40',
|
||||
'footer_widget_container_top' => '40',
|
||||
'footer_widget_container_right' => '40',
|
||||
'footer_widget_container_bottom' => '40',
|
||||
'footer_widget_container_left' => '40',
|
||||
'footer_widget_separator' => '40',
|
||||
'footer_top' => '20',
|
||||
'footer_right' => '40',
|
||||
'footer_bottom' => '20',
|
||||
'footer_left' => '40',
|
||||
'mobile_footer_top' => '',
|
||||
'mobile_footer_right' => '30',
|
||||
'mobile_footer_bottom' => '',
|
||||
'mobile_footer_left' => '30',
|
||||
);
|
||||
|
||||
if ( $filter ) {
|
||||
return apply_filters( 'generate_spacing_option_defaults', $defaults );
|
||||
}
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_typography_default_fonts' ) ) {
|
||||
/**
|
||||
* Set the default system fonts.
|
||||
*
|
||||
* @since 1.3.40
|
||||
*/
|
||||
function generate_typography_default_fonts() {
|
||||
$fonts = array(
|
||||
'inherit',
|
||||
'System Stack',
|
||||
'Arial, Helvetica, sans-serif',
|
||||
'Century Gothic',
|
||||
'Comic Sans MS',
|
||||
'Courier New',
|
||||
'Georgia, Times New Roman, Times, serif',
|
||||
'Helvetica',
|
||||
'Impact',
|
||||
'Lucida Console',
|
||||
'Lucida Sans Unicode',
|
||||
'Palatino Linotype',
|
||||
'Segoe UI, Helvetica Neue, Helvetica, sans-serif',
|
||||
'Tahoma, Geneva, sans-serif',
|
||||
'Trebuchet MS, Helvetica, sans-serif',
|
||||
'Verdana, Geneva, sans-serif',
|
||||
);
|
||||
|
||||
return apply_filters( 'generate_typography_default_fonts', $fonts );
|
||||
}
|
||||
}
|
||||
|
@ -1,436 +1,461 @@
|
||||
<?php
|
||||
/**
|
||||
* General functions.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_scripts' ) ) {
|
||||
add_action( 'wp_enqueue_scripts', 'generate_scripts' );
|
||||
/**
|
||||
* Enqueue scripts and styles
|
||||
*/
|
||||
function generate_scripts() {
|
||||
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
||||
$dir_uri = get_template_directory_uri();
|
||||
|
||||
if ( generate_is_using_flexbox() ) {
|
||||
if ( is_singular() && comments_open() ) {
|
||||
wp_enqueue_style( 'generate-comments', $dir_uri . "/assets/css/components/comments{$suffix}.css", array(), GENERATE_VERSION, 'all' );
|
||||
}
|
||||
|
||||
if (
|
||||
is_active_sidebar( 'top-bar' ) ||
|
||||
is_active_sidebar( 'footer-bar' ) ||
|
||||
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' )
|
||||
) {
|
||||
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' );
|
||||
} else {
|
||||
if ( generate_get_option( 'combine_css' ) && $suffix ) {
|
||||
wp_enqueue_style( 'generate-style', $dir_uri . "/assets/css/all{$suffix}.css", array(), GENERATE_VERSION, 'all' );
|
||||
} else {
|
||||
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-mobile-style', $dir_uri . "/assets/css/mobile{$suffix}.css", array(), GENERATE_VERSION, 'all' );
|
||||
}
|
||||
}
|
||||
|
||||
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' );
|
||||
}
|
||||
|
||||
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' );
|
||||
}
|
||||
|
||||
if ( is_rtl() ) {
|
||||
if ( generate_is_using_flexbox() ) {
|
||||
wp_enqueue_style( 'generate-rtl', $dir_uri . "/assets/css/main-rtl{$suffix}.css", array(), GENERATE_VERSION, 'all' );
|
||||
} else {
|
||||
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 ) ) {
|
||||
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' ) ) {
|
||||
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' );
|
||||
}
|
||||
|
||||
if ( apply_filters( 'generate_combine_js', true ) && $suffix ) {
|
||||
wp_enqueue_script( 'generate-main', $dir_uri . "/assets/js/main{$suffix}.js", array(), GENERATE_VERSION, true );
|
||||
$script_handle = 'generate-main';
|
||||
} else {
|
||||
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 );
|
||||
$script_handle = 'generate-menu';
|
||||
}
|
||||
|
||||
wp_localize_script(
|
||||
$script_handle,
|
||||
'generatepressMenu',
|
||||
apply_filters(
|
||||
'generate_localize_js_args',
|
||||
array(
|
||||
'toggleOpenedSubMenus' => true,
|
||||
'openSubMenuLabel' => esc_attr__( 'Open 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' ) ) {
|
||||
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' ) ) {
|
||||
wp_enqueue_script( 'generate-navigation-search', $dir_uri . "/assets/js/navigation-search{$suffix}.js", array(), GENERATE_VERSION, true );
|
||||
|
||||
wp_localize_script(
|
||||
'generate-navigation-search',
|
||||
'generatepressNavSearch',
|
||||
array(
|
||||
'open' => esc_attr__( 'Open Search Bar', 'generatepress' ),
|
||||
'close' => esc_attr__( 'Close Search Bar', 'generatepress' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
|
||||
wp_enqueue_script( 'comment-reply' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_widgets_init' ) ) {
|
||||
add_action( 'widgets_init', 'generate_widgets_init' );
|
||||
/**
|
||||
* Register widgetized area and update sidebar with default widgets
|
||||
*/
|
||||
function generate_widgets_init() {
|
||||
$widgets = array(
|
||||
'sidebar-1' => __( 'Right Sidebar', 'generatepress' ),
|
||||
'sidebar-2' => __( 'Left Sidebar', 'generatepress' ),
|
||||
'header' => __( 'Header', 'generatepress' ),
|
||||
'footer-1' => __( 'Footer Widget 1', 'generatepress' ),
|
||||
'footer-2' => __( 'Footer Widget 2', 'generatepress' ),
|
||||
'footer-3' => __( 'Footer Widget 3', 'generatepress' ),
|
||||
'footer-4' => __( 'Footer Widget 4', 'generatepress' ),
|
||||
'footer-5' => __( 'Footer Widget 5', 'generatepress' ),
|
||||
'footer-bar' => __( 'Footer Bar', 'generatepress' ),
|
||||
'top-bar' => __( 'Top Bar', 'generatepress' ),
|
||||
);
|
||||
|
||||
foreach ( $widgets as $id => $name ) {
|
||||
register_sidebar(
|
||||
array(
|
||||
'name' => $name,
|
||||
'id' => $id,
|
||||
'before_widget' => '<aside id="%1$s" class="widget inner-padding %2$s">',
|
||||
'after_widget' => '</aside>',
|
||||
'before_title' => apply_filters( 'generate_start_widget_title', '<h2 class="widget-title">' ),
|
||||
'after_title' => apply_filters( 'generate_end_widget_title', '</h2>' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_smart_content_width' ) ) {
|
||||
add_action( 'wp', 'generate_smart_content_width' );
|
||||
/**
|
||||
* Set the $content_width depending on layout of current page
|
||||
* 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
|
||||
*/
|
||||
function generate_smart_content_width() {
|
||||
global $content_width;
|
||||
|
||||
$container_width = generate_get_option( 'container_width' );
|
||||
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
|
||||
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
|
||||
$layout = generate_get_layout();
|
||||
|
||||
if ( 'left-sidebar' === $layout ) {
|
||||
$content_width = $container_width * ( ( 100 - $left_sidebar_width ) / 100 );
|
||||
} elseif ( 'right-sidebar' === $layout ) {
|
||||
$content_width = $container_width * ( ( 100 - $right_sidebar_width ) / 100 );
|
||||
} elseif ( 'no-sidebar' === $layout ) {
|
||||
$content_width = $container_width;
|
||||
} else {
|
||||
$content_width = $container_width * ( ( 100 - ( $left_sidebar_width + $right_sidebar_width ) ) / 100 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( '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.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @param array $args The existing menu args.
|
||||
* @return array Menu args.
|
||||
*/
|
||||
function generate_page_menu_args( $args ) {
|
||||
$args['show_home'] = true;
|
||||
|
||||
return $args;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_disable_title' ) ) {
|
||||
add_filter( 'generate_show_title', 'generate_disable_title' );
|
||||
/**
|
||||
* Remove our title if set.
|
||||
*
|
||||
* @since 1.3.18
|
||||
*
|
||||
* @param bool $title Whether the title is displayed or not.
|
||||
* @return bool Whether to display the content title.
|
||||
*/
|
||||
function generate_disable_title( $title ) {
|
||||
if ( is_singular() ) {
|
||||
$disable_title = get_post_meta( get_the_ID(), '_generate-disable-headline', true );
|
||||
|
||||
if ( $disable_title ) {
|
||||
$title = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $title;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_resource_hints' ) ) {
|
||||
add_filter( 'wp_resource_hints', 'generate_resource_hints', 10, 2 );
|
||||
/**
|
||||
* Add resource hints to our Google fonts call.
|
||||
*
|
||||
* @since 1.3.42
|
||||
*
|
||||
* @param array $urls URLs to print for resource hints.
|
||||
* @param string $relation_type The relation type the URLs are printed.
|
||||
* @return array $urls URLs to print for resource hints.
|
||||
*/
|
||||
function generate_resource_hints( $urls, $relation_type ) {
|
||||
if ( wp_style_is( 'generate-fonts', 'queue' ) && 'preconnect' === $relation_type ) {
|
||||
if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '>=' ) ) {
|
||||
$urls[] = array(
|
||||
'href' => 'https://fonts.gstatic.com',
|
||||
'crossorigin',
|
||||
);
|
||||
} else {
|
||||
$urls[] = 'https://fonts.gstatic.com';
|
||||
}
|
||||
}
|
||||
|
||||
return $urls;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_remove_caption_padding' ) ) {
|
||||
add_filter( 'img_caption_shortcode_width', 'generate_remove_caption_padding' );
|
||||
/**
|
||||
* Remove WordPress's default padding on images with captions
|
||||
*
|
||||
* @param int $width Default WP .wp-caption width (image width + 10px).
|
||||
* @return int Updated width to remove 10px padding.
|
||||
*/
|
||||
function generate_remove_caption_padding( $width ) {
|
||||
return $width - 10;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_enhanced_image_navigation' ) ) {
|
||||
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.
|
||||
*
|
||||
* @param string $url The input URL.
|
||||
* @param int $id The ID of the post.
|
||||
*/
|
||||
function generate_enhanced_image_navigation( $url, $id ) {
|
||||
if ( ! is_attachment() && ! wp_attachment_is_image( $id ) ) {
|
||||
return $url;
|
||||
}
|
||||
|
||||
$image = get_post( $id );
|
||||
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose.
|
||||
if ( ! empty( $image->post_parent ) && $image->post_parent != $id ) {
|
||||
$url .= '#main';
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_categorized_blog' ) ) {
|
||||
/**
|
||||
* Determine whether blog/site has more than one category.
|
||||
*
|
||||
* @since 1.2.5
|
||||
*
|
||||
* @return bool True of there is more than one category, false otherwise.
|
||||
*/
|
||||
function generate_categorized_blog() {
|
||||
if ( false === ( $all_the_cool_cats = get_transient( 'generate_categories' ) ) ) { // phpcs:ignore
|
||||
// Create an array of all the categories that are attached to posts.
|
||||
$all_the_cool_cats = get_categories(
|
||||
array(
|
||||
'fields' => 'ids',
|
||||
'hide_empty' => 1,
|
||||
|
||||
// We only need to know if there is more than one category.
|
||||
'number' => 2,
|
||||
)
|
||||
);
|
||||
|
||||
// Count the number of categories that are attached to the posts.
|
||||
$all_the_cool_cats = count( $all_the_cool_cats );
|
||||
|
||||
set_transient( 'generate_categories', $all_the_cool_cats );
|
||||
}
|
||||
|
||||
if ( $all_the_cool_cats > 1 ) {
|
||||
// This blog has more than 1 category so twentyfifteen_categorized_blog should return true.
|
||||
return true;
|
||||
} else {
|
||||
// This blog has only 1 category so twentyfifteen_categorized_blog should return false.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_category_transient_flusher' ) ) {
|
||||
add_action( 'edit_category', 'generate_category_transient_flusher' );
|
||||
add_action( 'save_post', 'generate_category_transient_flusher' );
|
||||
/**
|
||||
* Flush out the transients used in {@see generate_categorized_blog()}.
|
||||
*
|
||||
* @since 1.2.5
|
||||
*/
|
||||
function generate_category_transient_flusher() {
|
||||
// Like, beat it. Dig?
|
||||
delete_transient( 'generate_categories' );
|
||||
}
|
||||
}
|
||||
|
||||
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.
|
||||
*
|
||||
* @since 1.3.42
|
||||
*/
|
||||
function generate_get_default_color_palettes() {
|
||||
$palettes = array(
|
||||
'#000000',
|
||||
'#FFFFFF',
|
||||
'#F1C40F',
|
||||
'#E74C3C',
|
||||
'#1ABC9C',
|
||||
'#1e72bd',
|
||||
'#8E44AD',
|
||||
'#00CC77',
|
||||
);
|
||||
|
||||
return apply_filters( 'generate_default_color_palettes', $palettes );
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'generate_fontawesome_essentials', 'generate_set_font_awesome_essentials' );
|
||||
/**
|
||||
* Check to see if we should include the full Font Awesome library or not.
|
||||
*
|
||||
* @since 2.0
|
||||
*
|
||||
* @param bool $essentials The existing value.
|
||||
* @return bool
|
||||
*/
|
||||
function generate_set_font_awesome_essentials( $essentials ) {
|
||||
if ( generate_get_option( 'font_awesome_essentials' ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $essentials;
|
||||
}
|
||||
|
||||
add_filter( 'generate_dynamic_css_skip_cache', 'generate_skip_dynamic_css_cache' );
|
||||
/**
|
||||
* Skips caching of the dynamic CSS if set to false.
|
||||
*
|
||||
* @since 2.0
|
||||
*
|
||||
* @param bool $cache The existing value.
|
||||
* @return bool
|
||||
*/
|
||||
function generate_skip_dynamic_css_cache( $cache ) {
|
||||
if ( ! generate_get_option( 'dynamic_css_cache' ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $cache;
|
||||
}
|
||||
|
||||
add_filter( 'wp_headers', 'generate_set_wp_headers' );
|
||||
/**
|
||||
* Set any necessary headers.
|
||||
*
|
||||
* @param array $headers The existing headers.
|
||||
*
|
||||
* @since 2.3
|
||||
*/
|
||||
function generate_set_wp_headers( $headers ) {
|
||||
$headers['X-UA-Compatible'] = 'IE=edge';
|
||||
|
||||
return $headers;
|
||||
}
|
||||
|
||||
add_filter( 'generate_after_element_class_attribute', 'generate_set_microdata_markup', 10, 2 );
|
||||
/**
|
||||
* Adds microdata to elements.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param string $output The existing output after the class attribute.
|
||||
* @param string $context What element we're targeting.
|
||||
*/
|
||||
function generate_set_microdata_markup( $output, $context ) {
|
||||
if ( 'left_sidebar' === $context || 'right_sidebar' === $context ) {
|
||||
$context = 'sidebar';
|
||||
}
|
||||
|
||||
if ( 'footer' === $context ) {
|
||||
return $output;
|
||||
}
|
||||
|
||||
if ( 'site-info' === $context ) {
|
||||
$context = 'footer';
|
||||
}
|
||||
|
||||
$microdata = generate_get_microdata( $context );
|
||||
|
||||
if ( $microdata ) {
|
||||
return $microdata;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* General functions.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_scripts' ) ) {
|
||||
add_action( 'wp_enqueue_scripts', 'generate_scripts' );
|
||||
/**
|
||||
* Enqueue scripts and styles
|
||||
*/
|
||||
function generate_scripts() {
|
||||
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
||||
$dir_uri = get_template_directory_uri();
|
||||
|
||||
if ( generate_is_using_flexbox() ) {
|
||||
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentionally loose.
|
||||
if ( is_singular() && ( comments_open() || '0' != get_comments_number() ) ) {
|
||||
wp_enqueue_style( 'generate-comments', $dir_uri . "/assets/css/components/comments{$suffix}.css", array(), GENERATE_VERSION, 'all' );
|
||||
}
|
||||
|
||||
if (
|
||||
is_active_sidebar( 'top-bar' ) ||
|
||||
is_active_sidebar( 'footer-bar' ) ||
|
||||
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' )
|
||||
) {
|
||||
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' );
|
||||
} else {
|
||||
if ( generate_get_option( 'combine_css' ) && $suffix ) {
|
||||
wp_enqueue_style( 'generate-style', $dir_uri . "/assets/css/all{$suffix}.css", array(), GENERATE_VERSION, 'all' );
|
||||
} else {
|
||||
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-mobile-style', $dir_uri . "/assets/css/mobile{$suffix}.css", array(), GENERATE_VERSION, 'all' );
|
||||
}
|
||||
}
|
||||
|
||||
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' );
|
||||
}
|
||||
|
||||
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' );
|
||||
}
|
||||
|
||||
if ( is_rtl() ) {
|
||||
if ( generate_is_using_flexbox() ) {
|
||||
wp_enqueue_style( 'generate-rtl', $dir_uri . "/assets/css/main-rtl{$suffix}.css", array(), GENERATE_VERSION, 'all' );
|
||||
} else {
|
||||
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 ) ) {
|
||||
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' ) ) {
|
||||
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' );
|
||||
}
|
||||
|
||||
if ( generate_has_active_menu() ) {
|
||||
wp_enqueue_script( 'generate-menu', $dir_uri . "/assets/js/menu{$suffix}.js", array(), GENERATE_VERSION, true );
|
||||
}
|
||||
|
||||
wp_localize_script(
|
||||
'generate-menu',
|
||||
'generatepressMenu',
|
||||
apply_filters(
|
||||
'generate_localize_js_args',
|
||||
array(
|
||||
'toggleOpenedSubMenus' => true,
|
||||
'openSubMenuLabel' => esc_attr__( 'Open 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' ) ) {
|
||||
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' ) ) {
|
||||
wp_enqueue_script( 'generate-navigation-search', $dir_uri . "/assets/js/navigation-search{$suffix}.js", array(), GENERATE_VERSION, true );
|
||||
|
||||
wp_localize_script(
|
||||
'generate-navigation-search',
|
||||
'generatepressNavSearch',
|
||||
array(
|
||||
'open' => esc_attr__( 'Open Search Bar', 'generatepress' ),
|
||||
'close' => esc_attr__( 'Close Search Bar', 'generatepress' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
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_localize_script(
|
||||
'generate-back-to-top',
|
||||
'generatepressBackToTop',
|
||||
apply_filters(
|
||||
'generate_back_to_top_js_args',
|
||||
array(
|
||||
'smooth' => true,
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
|
||||
wp_enqueue_script( 'comment-reply' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_widgets_init' ) ) {
|
||||
add_action( 'widgets_init', 'generate_widgets_init' );
|
||||
/**
|
||||
* Register widgetized area and update sidebar with default widgets
|
||||
*/
|
||||
function generate_widgets_init() {
|
||||
$widgets = array(
|
||||
'sidebar-1' => __( 'Right Sidebar', 'generatepress' ),
|
||||
'sidebar-2' => __( 'Left Sidebar', 'generatepress' ),
|
||||
'header' => __( 'Header', 'generatepress' ),
|
||||
'footer-1' => __( 'Footer Widget 1', 'generatepress' ),
|
||||
'footer-2' => __( 'Footer Widget 2', 'generatepress' ),
|
||||
'footer-3' => __( 'Footer Widget 3', 'generatepress' ),
|
||||
'footer-4' => __( 'Footer Widget 4', 'generatepress' ),
|
||||
'footer-5' => __( 'Footer Widget 5', 'generatepress' ),
|
||||
'footer-bar' => __( 'Footer Bar', 'generatepress' ),
|
||||
'top-bar' => __( 'Top Bar', 'generatepress' ),
|
||||
);
|
||||
|
||||
foreach ( $widgets as $id => $name ) {
|
||||
register_sidebar(
|
||||
array(
|
||||
'name' => $name,
|
||||
'id' => $id,
|
||||
'before_widget' => '<aside id="%1$s" class="widget inner-padding %2$s">',
|
||||
'after_widget' => '</aside>',
|
||||
'before_title' => apply_filters( 'generate_start_widget_title', '<h2 class="widget-title">' ),
|
||||
'after_title' => apply_filters( 'generate_end_widget_title', '</h2>' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_smart_content_width' ) ) {
|
||||
add_action( 'wp', 'generate_smart_content_width' );
|
||||
/**
|
||||
* Set the $content_width depending on layout of current page
|
||||
* 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
|
||||
*/
|
||||
function generate_smart_content_width() {
|
||||
global $content_width;
|
||||
|
||||
$container_width = generate_get_option( 'container_width' );
|
||||
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
|
||||
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
|
||||
$layout = generate_get_layout();
|
||||
|
||||
if ( 'left-sidebar' === $layout ) {
|
||||
$content_width = $container_width * ( ( 100 - $left_sidebar_width ) / 100 );
|
||||
} elseif ( 'right-sidebar' === $layout ) {
|
||||
$content_width = $container_width * ( ( 100 - $right_sidebar_width ) / 100 );
|
||||
} elseif ( 'no-sidebar' === $layout ) {
|
||||
$content_width = $container_width;
|
||||
} else {
|
||||
$content_width = $container_width * ( ( 100 - ( $left_sidebar_width + $right_sidebar_width ) ) / 100 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( '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.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @param array $args The existing menu args.
|
||||
* @return array Menu args.
|
||||
*/
|
||||
function generate_page_menu_args( $args ) {
|
||||
$args['show_home'] = true;
|
||||
|
||||
return $args;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_disable_title' ) ) {
|
||||
add_filter( 'generate_show_title', 'generate_disable_title' );
|
||||
/**
|
||||
* Remove our title if set.
|
||||
*
|
||||
* @since 1.3.18
|
||||
*
|
||||
* @param bool $title Whether the title is displayed or not.
|
||||
* @return bool Whether to display the content title.
|
||||
*/
|
||||
function generate_disable_title( $title ) {
|
||||
if ( is_singular() ) {
|
||||
$disable_title = get_post_meta( get_the_ID(), '_generate-disable-headline', true );
|
||||
|
||||
if ( $disable_title ) {
|
||||
$title = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $title;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_resource_hints' ) ) {
|
||||
add_filter( 'wp_resource_hints', 'generate_resource_hints', 10, 2 );
|
||||
/**
|
||||
* Add resource hints to our Google fonts call.
|
||||
*
|
||||
* @since 1.3.42
|
||||
*
|
||||
* @param array $urls URLs to print for resource hints.
|
||||
* @param string $relation_type The relation type the URLs are printed.
|
||||
* @return array $urls URLs to print for resource hints.
|
||||
*/
|
||||
function generate_resource_hints( $urls, $relation_type ) {
|
||||
$handle = generate_is_using_dynamic_typography() ? 'generate-google-fonts' : 'generate-fonts';
|
||||
|
||||
if ( wp_style_is( $handle, 'queue' ) && 'preconnect' === $relation_type ) {
|
||||
if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '>=' ) ) {
|
||||
$urls[] = array(
|
||||
'href' => 'https://fonts.gstatic.com',
|
||||
'crossorigin',
|
||||
);
|
||||
} else {
|
||||
$urls[] = 'https://fonts.gstatic.com';
|
||||
}
|
||||
}
|
||||
|
||||
return $urls;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_remove_caption_padding' ) ) {
|
||||
add_filter( 'img_caption_shortcode_width', 'generate_remove_caption_padding' );
|
||||
/**
|
||||
* Remove WordPress's default padding on images with captions
|
||||
*
|
||||
* @param int $width Default WP .wp-caption width (image width + 10px).
|
||||
* @return int Updated width to remove 10px padding.
|
||||
*/
|
||||
function generate_remove_caption_padding( $width ) {
|
||||
return $width - 10;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_enhanced_image_navigation' ) ) {
|
||||
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.
|
||||
*
|
||||
* @param string $url The input URL.
|
||||
* @param int $id The ID of the post.
|
||||
*/
|
||||
function generate_enhanced_image_navigation( $url, $id ) {
|
||||
if ( ! is_attachment() && ! wp_attachment_is_image( $id ) ) {
|
||||
return $url;
|
||||
}
|
||||
|
||||
$image = get_post( $id );
|
||||
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose.
|
||||
if ( ! empty( $image->post_parent ) && $image->post_parent != $id ) {
|
||||
$url .= '#main';
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_categorized_blog' ) ) {
|
||||
/**
|
||||
* Determine whether blog/site has more than one category.
|
||||
*
|
||||
* @since 1.2.5
|
||||
*
|
||||
* @return bool True of there is more than one category, false otherwise.
|
||||
*/
|
||||
function generate_categorized_blog() {
|
||||
if ( false === ( $all_the_cool_cats = get_transient( 'generate_categories' ) ) ) { // phpcs:ignore
|
||||
// Create an array of all the categories that are attached to posts.
|
||||
$all_the_cool_cats = get_categories(
|
||||
array(
|
||||
'fields' => 'ids',
|
||||
'hide_empty' => 1,
|
||||
|
||||
// We only need to know if there is more than one category.
|
||||
'number' => 2,
|
||||
)
|
||||
);
|
||||
|
||||
// Count the number of categories that are attached to the posts.
|
||||
$all_the_cool_cats = count( $all_the_cool_cats );
|
||||
|
||||
set_transient( 'generate_categories', $all_the_cool_cats );
|
||||
}
|
||||
|
||||
if ( $all_the_cool_cats > 1 ) {
|
||||
// This blog has more than 1 category so twentyfifteen_categorized_blog should return true.
|
||||
return true;
|
||||
} else {
|
||||
// This blog has only 1 category so twentyfifteen_categorized_blog should return false.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_category_transient_flusher' ) ) {
|
||||
add_action( 'edit_category', 'generate_category_transient_flusher' );
|
||||
add_action( 'save_post', 'generate_category_transient_flusher' );
|
||||
/**
|
||||
* Flush out the transients used in {@see generate_categorized_blog()}.
|
||||
*
|
||||
* @since 1.2.5
|
||||
*/
|
||||
function generate_category_transient_flusher() {
|
||||
// Like, beat it. Dig?
|
||||
delete_transient( 'generate_categories' );
|
||||
}
|
||||
}
|
||||
|
||||
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.
|
||||
*
|
||||
* @since 1.3.42
|
||||
*/
|
||||
function generate_get_default_color_palettes() {
|
||||
$palettes = array(
|
||||
'#000000',
|
||||
'#FFFFFF',
|
||||
'#F1C40F',
|
||||
'#E74C3C',
|
||||
'#1ABC9C',
|
||||
'#1e72bd',
|
||||
'#8E44AD',
|
||||
'#00CC77',
|
||||
);
|
||||
|
||||
return apply_filters( 'generate_default_color_palettes', $palettes );
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'generate_fontawesome_essentials', 'generate_set_font_awesome_essentials' );
|
||||
/**
|
||||
* Check to see if we should include the full Font Awesome library or not.
|
||||
*
|
||||
* @since 2.0
|
||||
*
|
||||
* @param bool $essentials The existing value.
|
||||
* @return bool
|
||||
*/
|
||||
function generate_set_font_awesome_essentials( $essentials ) {
|
||||
if ( generate_get_option( 'font_awesome_essentials' ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $essentials;
|
||||
}
|
||||
|
||||
add_filter( 'generate_dynamic_css_skip_cache', 'generate_skip_dynamic_css_cache' );
|
||||
/**
|
||||
* Skips caching of the dynamic CSS if set to false.
|
||||
*
|
||||
* @since 2.0
|
||||
*
|
||||
* @param bool $cache The existing value.
|
||||
* @return bool
|
||||
*/
|
||||
function generate_skip_dynamic_css_cache( $cache ) {
|
||||
if ( ! generate_get_option( 'dynamic_css_cache' ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $cache;
|
||||
}
|
||||
|
||||
add_filter( 'wp_headers', 'generate_set_wp_headers' );
|
||||
/**
|
||||
* Set any necessary headers.
|
||||
*
|
||||
* @param array $headers The existing headers.
|
||||
*
|
||||
* @since 2.3
|
||||
*/
|
||||
function generate_set_wp_headers( $headers ) {
|
||||
$headers['X-UA-Compatible'] = 'IE=edge';
|
||||
|
||||
return $headers;
|
||||
}
|
||||
|
||||
add_filter( 'generate_after_element_class_attribute', 'generate_set_microdata_markup', 10, 2 );
|
||||
/**
|
||||
* Adds microdata to elements.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param string $output The existing output after the class attribute.
|
||||
* @param string $context What element we're targeting.
|
||||
*/
|
||||
function generate_set_microdata_markup( $output, $context ) {
|
||||
if ( 'left_sidebar' === $context || 'right_sidebar' === $context ) {
|
||||
$context = 'sidebar';
|
||||
}
|
||||
|
||||
if ( 'footer' === $context ) {
|
||||
return $output;
|
||||
}
|
||||
|
||||
if ( 'site-info' === $context ) {
|
||||
$context = 'footer';
|
||||
}
|
||||
|
||||
$microdata = generate_get_microdata( $context );
|
||||
|
||||
if ( $microdata ) {
|
||||
return $microdata;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
add_action( 'wp_footer', 'generate_do_a11y_scripts' );
|
||||
/**
|
||||
* Enqueue scripts in the footer.
|
||||
*
|
||||
* @since 3.1.0
|
||||
*/
|
||||
function generate_do_a11y_scripts() {
|
||||
if ( apply_filters( 'generate_print_a11y_script', true ) ) {
|
||||
// Add our small a11y script inline.
|
||||
printf(
|
||||
'<script id="generate-a11y">%s</script>',
|
||||
'!function(){"use strict";if("querySelector"in document&&"addEventListener"in window){var e=document.body;e.addEventListener("mousedown",function(){e.classList.add("using-mouse")}),e.addEventListener("keydown",function(){e.classList.remove("using-mouse")})}}();'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ function generate_register_layout_meta_box() {
|
||||
$blog_id = get_option( 'page_for_posts' );
|
||||
|
||||
// No need for the Layout metabox on the blog page.
|
||||
if ( $blog_id && (int) $blog_id === (int) $post->ID ) {
|
||||
if ( isset( $post->ID ) && $blog_id && (int) $blog_id === (int) $post->ID ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,117 +1,142 @@
|
||||
<?php
|
||||
/**
|
||||
* Archive elements.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_archive_title' ) ) {
|
||||
add_action( 'generate_archive_title', 'generate_archive_title' );
|
||||
/**
|
||||
* Build the archive title
|
||||
*
|
||||
* @since 1.3.24
|
||||
*/
|
||||
function generate_archive_title() {
|
||||
if ( ! function_exists( 'the_archive_title' ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<header class="page-header">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_archive_title hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_archive_title' );
|
||||
?>
|
||||
|
||||
<h1 class="page-title">
|
||||
<?php the_archive_title(); ?>
|
||||
</h1>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_archive_title hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_do_archive_description - 10
|
||||
*/
|
||||
do_action( 'generate_after_archive_title' );
|
||||
?>
|
||||
</header>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_filter_the_archive_title' ) ) {
|
||||
add_filter( 'get_the_archive_title', 'generate_filter_the_archive_title' );
|
||||
/**
|
||||
* Alter the_archive_title() function to match our original archive title function
|
||||
*
|
||||
* @since 1.3.45
|
||||
*
|
||||
* @param string $title The archive title.
|
||||
* @return string The altered archive title
|
||||
*/
|
||||
function generate_filter_the_archive_title( $title ) {
|
||||
if ( is_category() ) {
|
||||
$title = single_cat_title( '', false );
|
||||
} elseif ( is_tag() ) {
|
||||
$title = single_tag_title( '', false );
|
||||
} elseif ( is_author() ) {
|
||||
/*
|
||||
* Queue the first post, that way we know
|
||||
* what author we're dealing with (if that is the case).
|
||||
*/
|
||||
the_post();
|
||||
|
||||
$title = sprintf(
|
||||
'%1$s<span class="vcard">%2$s</span>',
|
||||
get_avatar( get_the_author_meta( 'ID' ), 50 ),
|
||||
get_the_author()
|
||||
);
|
||||
|
||||
/*
|
||||
* Since we called the_post() above, we need to
|
||||
* rewind the loop back to the beginning that way
|
||||
* we can run the loop properly, in full.
|
||||
*/
|
||||
rewind_posts();
|
||||
}
|
||||
|
||||
return $title;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'generate_after_archive_title', 'generate_do_archive_description' );
|
||||
/**
|
||||
* Output the archive description.
|
||||
*
|
||||
* @since 2.3
|
||||
*/
|
||||
function generate_do_archive_description() {
|
||||
$term_description = term_description();
|
||||
|
||||
if ( ! empty( $term_description ) ) {
|
||||
printf( '<div class="taxonomy-description">%s</div>', $term_description ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
|
||||
if ( get_the_author_meta( 'description' ) && is_author() ) {
|
||||
echo '<div class="author-info">' . get_the_author_meta( 'description' ) . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_archive_description hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_archive_description' );
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* Archive elements.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_archive_title' ) ) {
|
||||
add_action( 'generate_archive_title', 'generate_archive_title' );
|
||||
/**
|
||||
* Build the archive title
|
||||
*
|
||||
* @since 1.3.24
|
||||
*/
|
||||
function generate_archive_title() {
|
||||
if ( ! function_exists( 'the_archive_title' ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<header <?php generate_do_attr( 'page-header' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_archive_title hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_archive_title' );
|
||||
?>
|
||||
|
||||
<h1 class="page-title">
|
||||
<?php the_archive_title(); ?>
|
||||
</h1>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_archive_title hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_do_archive_description - 10
|
||||
*/
|
||||
do_action( 'generate_after_archive_title' );
|
||||
?>
|
||||
</header>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_filter_the_archive_title' ) ) {
|
||||
add_filter( 'get_the_archive_title', 'generate_filter_the_archive_title' );
|
||||
/**
|
||||
* Alter the_archive_title() function to match our original archive title function
|
||||
*
|
||||
* @since 1.3.45
|
||||
*
|
||||
* @param string $title The archive title.
|
||||
* @return string The altered archive title
|
||||
*/
|
||||
function generate_filter_the_archive_title( $title ) {
|
||||
if ( is_category() ) {
|
||||
$title = single_cat_title( '', false );
|
||||
} elseif ( is_tag() ) {
|
||||
$title = single_tag_title( '', false );
|
||||
} elseif ( is_author() ) {
|
||||
/*
|
||||
* Queue the first post, that way we know
|
||||
* what author we're dealing with (if that is the case).
|
||||
*/
|
||||
the_post();
|
||||
|
||||
$title = sprintf(
|
||||
'%1$s<span class="vcard">%2$s</span>',
|
||||
get_avatar( get_the_author_meta( 'ID' ), 50 ),
|
||||
get_the_author()
|
||||
);
|
||||
|
||||
/*
|
||||
* Since we called the_post() above, we need to
|
||||
* rewind the loop back to the beginning that way
|
||||
* we can run the loop properly, in full.
|
||||
*/
|
||||
rewind_posts();
|
||||
}
|
||||
|
||||
return $title;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'generate_after_archive_title', 'generate_do_archive_description' );
|
||||
/**
|
||||
* Output the archive description.
|
||||
*
|
||||
* @since 2.3
|
||||
*/
|
||||
function generate_do_archive_description() {
|
||||
$term_description = get_the_archive_description();
|
||||
|
||||
if ( ! empty( $term_description ) ) {
|
||||
if ( is_author() ) {
|
||||
printf( '<div class="author-info">%s</div>', $term_description ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
} else {
|
||||
printf( '<div class="taxonomy-description">%s</div>', $term_description ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_archive_description hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_archive_description' );
|
||||
}
|
||||
|
||||
add_action( 'generate_before_loop', 'generate_do_search_results_title' );
|
||||
/**
|
||||
* Add the search results title to the search results page.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param string $template The template we're targeting.
|
||||
*/
|
||||
function generate_do_search_results_title( $template ) {
|
||||
if ( 'search' === $template ) {
|
||||
// phpcs:ignore -- No escaping needed.
|
||||
echo apply_filters(
|
||||
'generate_search_title_output',
|
||||
sprintf(
|
||||
'<header %s><h1 class="page-title">%s</h1></header>',
|
||||
generate_get_attr( 'page-header' ),
|
||||
sprintf(
|
||||
/* translators: 1: Search query name */
|
||||
__( 'Search Results for: %s', 'generatepress' ),
|
||||
'<span>' . get_search_query() . '</span>'
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,204 +1,219 @@
|
||||
<?php
|
||||
/**
|
||||
* Comment structure.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_comment' ) ) {
|
||||
/**
|
||||
* Template for comments and pingbacks.
|
||||
* Used as a callback by wp_list_comments() for displaying the comments.
|
||||
*
|
||||
* @param object $comment The comment object.
|
||||
* @param array $args The existing args.
|
||||
* @param int $depth The thread depth.
|
||||
*/
|
||||
function generate_comment( $comment, $args, $depth ) {
|
||||
$args['avatar_size'] = apply_filters( 'generate_comment_avatar_size', 50 );
|
||||
|
||||
if ( 'pingback' === $comment->comment_type || 'trackback' === $comment->comment_type ) : ?>
|
||||
|
||||
<li id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
|
||||
<div class="comment-body">
|
||||
<?php esc_html_e( 'Pingback:', 'generatepress' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( 'Edit', 'generatepress' ), '<span class="edit-link">', '</span>' ); ?>
|
||||
</div>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<li id="comment-<?php comment_ID(); ?>" <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?>>
|
||||
<article id="div-comment-<?php comment_ID(); ?>" <?php generate_do_element_classes( 'comment-body', 'comment-body' ); ?>>
|
||||
<footer class="comment-meta">
|
||||
<?php
|
||||
if ( 0 != $args['avatar_size'] ) { // phpcs:ignore
|
||||
echo get_avatar( $comment, $args['avatar_size'] );
|
||||
}
|
||||
?>
|
||||
<div class="comment-author-info">
|
||||
<div <?php generate_do_element_classes( 'comment-author' ); ?>>
|
||||
<?php printf( '<cite itemprop="name" class="fn">%s</cite>', get_comment_author_link() ); ?>
|
||||
</div>
|
||||
|
||||
<div class="entry-meta comment-metadata">
|
||||
<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
|
||||
<time datetime="<?php comment_time( 'c' ); ?>" itemprop="datePublished">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: 1: date, 2: time */
|
||||
_x( '%1$s at %2$s', '1: date, 2: time', 'generatepress' ), // phpcs:ignore
|
||||
get_comment_date(), // phpcs:ignore
|
||||
get_comment_time() // phpcs:ignore
|
||||
);
|
||||
?>
|
||||
</time>
|
||||
</a>
|
||||
<?php edit_comment_link( __( 'Edit', 'generatepress' ), '<span class="edit-link">| ', '</span>' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ( '0' == $comment->comment_approved ) : // phpcs:ignore ?>
|
||||
<p class="comment-awaiting-moderation"><?php esc_html_e( 'Your comment is awaiting moderation.', 'generatepress' ); ?></p>
|
||||
<?php endif; ?>
|
||||
</footer>
|
||||
|
||||
<div class="comment-content" itemprop="text">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_comment_content hook.
|
||||
*
|
||||
* @since 2.4
|
||||
*/
|
||||
do_action( 'generate_before_comment_text', $comment, $args, $depth );
|
||||
|
||||
comment_text();
|
||||
|
||||
/**
|
||||
* generate_after_comment_content hook.
|
||||
*
|
||||
* @since 2.4
|
||||
*/
|
||||
do_action( 'generate_after_comment_text', $comment, $args, $depth );
|
||||
?>
|
||||
</div>
|
||||
</article>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'generate_after_comment_text', 'generate_do_comment_reply_link', 10, 3 );
|
||||
/**
|
||||
* Add our comment reply link after the comment text.
|
||||
*
|
||||
* @since 2.4
|
||||
* @param object $comment The comment object.
|
||||
* @param array $args The existing args.
|
||||
* @param int $depth The thread depth.
|
||||
*/
|
||||
function generate_do_comment_reply_link( $comment, $args, $depth ) {
|
||||
comment_reply_link(
|
||||
array_merge(
|
||||
$args,
|
||||
array(
|
||||
'add_below' => 'div-comment',
|
||||
'depth' => $depth,
|
||||
'max_depth' => $args['max_depth'],
|
||||
'before' => '<span class="reply">',
|
||||
'after' => '</span>',
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
add_filter( 'comment_form_defaults', 'generate_set_comment_form_defaults' );
|
||||
/**
|
||||
* Set the default settings for our comments.
|
||||
*
|
||||
* @since 2.3
|
||||
*
|
||||
* @param array $defaults The existing defaults.
|
||||
* @return array
|
||||
*/
|
||||
function generate_set_comment_form_defaults( $defaults ) {
|
||||
$defaults['comment_field'] = sprintf(
|
||||
'<p class="comment-form-comment"><label for="comment" class="screen-reader-text">%1$s</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true" required></textarea></p>',
|
||||
esc_html__( 'Comment', 'generatepress' )
|
||||
);
|
||||
|
||||
$defaults['comment_notes_before'] = null;
|
||||
$defaults['comment_notes_after'] = null;
|
||||
$defaults['id_form'] = 'commentform';
|
||||
$defaults['id_submit'] = 'submit';
|
||||
$defaults['title_reply'] = apply_filters( 'generate_leave_comment', __( 'Leave a Comment', 'generatepress' ) );
|
||||
$defaults['label_submit'] = apply_filters( 'generate_post_comment', __( 'Post Comment', 'generatepress' ) );
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
|
||||
add_filter( 'comment_form_default_fields', 'generate_filter_comment_fields' );
|
||||
/**
|
||||
* Customizes the existing comment fields.
|
||||
*
|
||||
* @since 2.1.2
|
||||
* @param array $fields The existing fields.
|
||||
* @return array
|
||||
*/
|
||||
function generate_filter_comment_fields( $fields ) {
|
||||
$commenter = wp_get_current_commenter();
|
||||
$required = get_option( 'require_name_email' );
|
||||
|
||||
$fields['author'] = sprintf(
|
||||
'<label for="author" class="screen-reader-text">%1$s</label><input placeholder="%1$s%3$s" id="author" name="author" type="text" value="%2$s" size="30" />',
|
||||
esc_html__( 'Name', 'generatepress' ),
|
||||
esc_attr( $commenter['comment_author'] ),
|
||||
$required ? ' *' : ''
|
||||
);
|
||||
|
||||
$fields['email'] = sprintf(
|
||||
'<label for="email" class="screen-reader-text">%1$s</label><input placeholder="%1$s%3$s" id="email" name="email" type="email" value="%2$s" size="30" />',
|
||||
esc_html__( 'Email', 'generatepress' ),
|
||||
esc_attr( $commenter['comment_author_email'] ),
|
||||
$required ? ' *' : ''
|
||||
);
|
||||
|
||||
$fields['url'] = sprintf(
|
||||
'<label for="url" class="screen-reader-text">%1$s</label><input placeholder="%1$s" id="url" name="url" type="url" value="%2$s" size="30" />',
|
||||
esc_html__( 'Website', 'generatepress' ),
|
||||
esc_attr( $commenter['comment_author_url'] )
|
||||
);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
add_action( 'generate_after_do_template_part', 'generate_do_comments_template', 15 );
|
||||
/**
|
||||
* Add the comments template to pages and single posts.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param string $template The template we're targeting.
|
||||
*/
|
||||
function generate_do_comments_template( $template ) {
|
||||
if ( 'single' === $template || 'page' === $template ) {
|
||||
// If comments are open or we have at least one comment, load up the comment template.
|
||||
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentionally loose.
|
||||
if ( comments_open() || '0' != get_comments_number() ) :
|
||||
/**
|
||||
* generate_before_comments_container hook.
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
do_action( 'generate_before_comments_container' );
|
||||
?>
|
||||
|
||||
<div class="comments-area">
|
||||
<?php comments_template(); ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* Comment structure.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_comment' ) ) {
|
||||
/**
|
||||
* Template for comments and pingbacks.
|
||||
* Used as a callback by wp_list_comments() for displaying the comments.
|
||||
*
|
||||
* @param object $comment The comment object.
|
||||
* @param array $args The existing args.
|
||||
* @param int $depth The thread depth.
|
||||
*/
|
||||
function generate_comment( $comment, $args, $depth ) {
|
||||
$args['avatar_size'] = apply_filters( 'generate_comment_avatar_size', 50 );
|
||||
|
||||
if ( 'pingback' === $comment->comment_type || 'trackback' === $comment->comment_type ) : ?>
|
||||
|
||||
<li id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
|
||||
<div class="comment-body">
|
||||
<?php esc_html_e( 'Pingback:', 'generatepress' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( 'Edit', 'generatepress' ), '<span class="edit-link">', '</span>' ); ?>
|
||||
</div>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<li id="comment-<?php comment_ID(); ?>" <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?>>
|
||||
<article <?php generate_do_attr( 'comment-body', array(), array( 'comment-id' => get_comment_ID() ) ); ?>>
|
||||
<footer <?php generate_do_attr( 'comment-meta' ); ?>>
|
||||
<?php
|
||||
if ( 0 != $args['avatar_size'] ) { // phpcs:ignore
|
||||
echo get_avatar( $comment, $args['avatar_size'] );
|
||||
}
|
||||
?>
|
||||
<div class="comment-author-info">
|
||||
<div <?php generate_do_element_classes( 'comment-author' ); ?>>
|
||||
<?php printf( '<cite itemprop="name" class="fn">%s</cite>', get_comment_author_link() ); ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_comment_author_name hook.
|
||||
*
|
||||
* @since 3.1.0
|
||||
*/
|
||||
do_action( 'generate_after_comment_author_name' );
|
||||
|
||||
if ( apply_filters( 'generate_show_comment_entry_meta', true ) ) :
|
||||
?>
|
||||
<div class="entry-meta comment-metadata">
|
||||
<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
|
||||
<time datetime="<?php comment_time( 'c' ); ?>" itemprop="datePublished">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: 1: date, 2: time */
|
||||
_x( '%1$s at %2$s', '1: date, 2: time', 'generatepress' ), // phpcs:ignore
|
||||
get_comment_date(), // phpcs:ignore
|
||||
get_comment_time() // phpcs:ignore
|
||||
);
|
||||
?>
|
||||
</time>
|
||||
</a>
|
||||
<?php edit_comment_link( __( 'Edit', 'generatepress' ), '<span class="edit-link">| ', '</span>' ); ?>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php if ( '0' == $comment->comment_approved ) : // phpcs:ignore ?>
|
||||
<p class="comment-awaiting-moderation"><?php esc_html_e( 'Your comment is awaiting moderation.', 'generatepress' ); ?></p>
|
||||
<?php endif; ?>
|
||||
</footer>
|
||||
|
||||
<div class="comment-content" itemprop="text">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_comment_content hook.
|
||||
*
|
||||
* @since 2.4
|
||||
*/
|
||||
do_action( 'generate_before_comment_text', $comment, $args, $depth );
|
||||
|
||||
comment_text();
|
||||
|
||||
/**
|
||||
* generate_after_comment_content hook.
|
||||
*
|
||||
* @since 2.4
|
||||
*/
|
||||
do_action( 'generate_after_comment_text', $comment, $args, $depth );
|
||||
?>
|
||||
</div>
|
||||
</article>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'generate_after_comment_text', 'generate_do_comment_reply_link', 10, 3 );
|
||||
/**
|
||||
* Add our comment reply link after the comment text.
|
||||
*
|
||||
* @since 2.4
|
||||
* @param object $comment The comment object.
|
||||
* @param array $args The existing args.
|
||||
* @param int $depth The thread depth.
|
||||
*/
|
||||
function generate_do_comment_reply_link( $comment, $args, $depth ) {
|
||||
comment_reply_link(
|
||||
array_merge(
|
||||
$args,
|
||||
array(
|
||||
'add_below' => 'div-comment',
|
||||
'depth' => $depth,
|
||||
'max_depth' => $args['max_depth'],
|
||||
'before' => '<span class="reply">',
|
||||
'after' => '</span>',
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
add_filter( 'comment_form_defaults', 'generate_set_comment_form_defaults' );
|
||||
/**
|
||||
* Set the default settings for our comments.
|
||||
*
|
||||
* @since 2.3
|
||||
*
|
||||
* @param array $defaults The existing defaults.
|
||||
* @return array
|
||||
*/
|
||||
function generate_set_comment_form_defaults( $defaults ) {
|
||||
$defaults['comment_field'] = sprintf(
|
||||
'<p class="comment-form-comment"><label for="comment" class="screen-reader-text">%1$s</label><textarea id="comment" name="comment" cols="45" rows="8" required></textarea></p>',
|
||||
esc_html__( 'Comment', 'generatepress' )
|
||||
);
|
||||
|
||||
$defaults['comment_notes_before'] = null;
|
||||
$defaults['comment_notes_after'] = null;
|
||||
$defaults['id_form'] = 'commentform';
|
||||
$defaults['id_submit'] = 'submit';
|
||||
$defaults['title_reply'] = apply_filters( 'generate_leave_comment', __( 'Leave a Comment', 'generatepress' ) );
|
||||
$defaults['label_submit'] = apply_filters( 'generate_post_comment', __( 'Post Comment', 'generatepress' ) );
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
|
||||
add_filter( 'comment_form_default_fields', 'generate_filter_comment_fields' );
|
||||
/**
|
||||
* Customizes the existing comment fields.
|
||||
*
|
||||
* @since 2.1.2
|
||||
* @param array $fields The existing fields.
|
||||
* @return array
|
||||
*/
|
||||
function generate_filter_comment_fields( $fields ) {
|
||||
$commenter = wp_get_current_commenter();
|
||||
$required = get_option( 'require_name_email' );
|
||||
|
||||
$fields['author'] = sprintf(
|
||||
'<label for="author" class="screen-reader-text">%1$s</label><input placeholder="%1$s%3$s" id="author" name="author" type="text" value="%2$s" size="30"%4$s />',
|
||||
esc_html__( 'Name', 'generatepress' ),
|
||||
esc_attr( $commenter['comment_author'] ),
|
||||
$required ? ' *' : '',
|
||||
$required ? ' required' : ''
|
||||
);
|
||||
|
||||
$fields['email'] = sprintf(
|
||||
'<label for="email" class="screen-reader-text">%1$s</label><input placeholder="%1$s%3$s" id="email" name="email" type="email" value="%2$s" size="30"%4$s />',
|
||||
esc_html__( 'Email', 'generatepress' ),
|
||||
esc_attr( $commenter['comment_author_email'] ),
|
||||
$required ? ' *' : '',
|
||||
$required ? ' required' : ''
|
||||
);
|
||||
|
||||
$fields['url'] = sprintf(
|
||||
'<label for="url" class="screen-reader-text">%1$s</label><input placeholder="%1$s" id="url" name="url" type="url" value="%2$s" size="30" />',
|
||||
esc_html__( 'Website', 'generatepress' ),
|
||||
esc_attr( $commenter['comment_author_url'] )
|
||||
);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
add_action( 'generate_after_do_template_part', 'generate_do_comments_template', 15 );
|
||||
/**
|
||||
* Add the comments template to pages and single posts.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param string $template The template we're targeting.
|
||||
*/
|
||||
function generate_do_comments_template( $template ) {
|
||||
if ( 'single' === $template || 'page' === $template ) {
|
||||
// If comments are open or we have at least one comment, load up the comment template.
|
||||
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentionally loose.
|
||||
if ( comments_open() || '0' != get_comments_number() ) :
|
||||
/**
|
||||
* generate_before_comments_container hook.
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
do_action( 'generate_before_comments_container' );
|
||||
?>
|
||||
|
||||
<div class="comments-area">
|
||||
<?php comments_template(); ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
}
|
||||
|
@ -1,245 +1,236 @@
|
||||
<?php
|
||||
/**
|
||||
* Footer elements.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_construct_footer' ) ) {
|
||||
add_action( 'generate_footer', 'generate_construct_footer' );
|
||||
/**
|
||||
* Build our footer.
|
||||
*
|
||||
* @since 1.3.42
|
||||
*/
|
||||
function generate_construct_footer() {
|
||||
$inside_site_info_class = '';
|
||||
|
||||
if ( 'full-width' !== generate_get_option( 'footer_inner_width' ) ) {
|
||||
$inside_site_info_class = ' grid-container grid-parent';
|
||||
|
||||
if ( generate_is_using_flexbox() ) {
|
||||
$inside_site_info_class = ' grid-container';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<footer <?php generate_do_element_classes( 'site-info', 'site-info' ); ?>>
|
||||
<div class="inside-site-info<?php echo $inside_site_info_class; // phpcs:ignore ?>">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_copyright hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_footer_bar - 15
|
||||
*/
|
||||
do_action( 'generate_before_copyright' );
|
||||
?>
|
||||
<div class="copyright-bar">
|
||||
<?php
|
||||
/**
|
||||
* generate_credits hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_add_footer_info - 10
|
||||
*/
|
||||
do_action( 'generate_credits' );
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_footer_bar' ) ) {
|
||||
add_action( 'generate_before_copyright', 'generate_footer_bar', 15 );
|
||||
/**
|
||||
* Build our footer bar
|
||||
*
|
||||
* @since 1.3.42
|
||||
*/
|
||||
function generate_footer_bar() {
|
||||
if ( ! is_active_sidebar( 'footer-bar' ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div class="footer-bar">
|
||||
<?php dynamic_sidebar( 'footer-bar' ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_add_footer_info' ) ) {
|
||||
add_action( 'generate_credits', 'generate_add_footer_info' );
|
||||
/**
|
||||
* Add the copyright to the footer
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_add_footer_info() {
|
||||
$copyright = sprintf(
|
||||
'<span class="copyright">© %1$s %2$s</span> • %4$s <a href="%3$s"%6$s>%5$s</a>',
|
||||
date( 'Y' ), // phpcs:ignore
|
||||
get_bloginfo( 'name' ),
|
||||
esc_url( 'https://generatepress.com' ),
|
||||
_x( 'Built with', 'GeneratePress', 'generatepress' ),
|
||||
__( 'GeneratePress', 'generatepress' ),
|
||||
'microdata' === generate_get_schema_type() ? ' itemprop="url"' : ''
|
||||
);
|
||||
|
||||
echo apply_filters( 'generate_copyright', $copyright ); // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build our individual footer widgets.
|
||||
* Displays a sample widget if no widget is found in the area.
|
||||
*
|
||||
* @since 2.0
|
||||
*
|
||||
* @param int $widget_width The width class of our widget.
|
||||
* @param int $widget The ID of our widget.
|
||||
*/
|
||||
function generate_do_footer_widget( $widget_width, $widget ) {
|
||||
$widget_classes = sprintf(
|
||||
'footer-widget-%s',
|
||||
absint( $widget )
|
||||
);
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$widget_width = apply_filters( "generate_footer_widget_{$widget}_width", $widget_width );
|
||||
$tablet_widget_width = apply_filters( "generate_footer_widget_{$widget}_tablet_width", '50' );
|
||||
|
||||
$widget_classes = sprintf(
|
||||
'footer-widget-%1$s grid-parent grid-%2$s tablet-grid-%3$s mobile-grid-100',
|
||||
absint( $widget ),
|
||||
absint( $widget_width ),
|
||||
absint( $tablet_widget_width )
|
||||
);
|
||||
}
|
||||
?>
|
||||
<div class="<?php echo $widget_classes; // phpcs:ignore ?>">
|
||||
<?php dynamic_sidebar( 'footer-' . absint( $widget ) ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_construct_footer_widgets' ) ) {
|
||||
add_action( 'generate_footer', 'generate_construct_footer_widgets', 5 );
|
||||
/**
|
||||
* Build our footer widgets.
|
||||
*
|
||||
* @since 1.3.42
|
||||
*/
|
||||
function generate_construct_footer_widgets() {
|
||||
// Get how many widgets to show.
|
||||
$widgets = generate_get_footer_widgets();
|
||||
|
||||
if ( ! empty( $widgets ) && 0 !== $widgets ) :
|
||||
|
||||
// If no footer widgets exist, we don't need to continue.
|
||||
if ( ! is_active_sidebar( 'footer-1' ) && ! is_active_sidebar( 'footer-2' ) && ! is_active_sidebar( 'footer-3' ) && ! is_active_sidebar( 'footer-4' ) && ! is_active_sidebar( 'footer-5' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set up the widget width.
|
||||
$widget_width = '';
|
||||
|
||||
if ( 1 === (int) $widgets ) {
|
||||
$widget_width = '100';
|
||||
}
|
||||
|
||||
if ( 2 === (int) $widgets ) {
|
||||
$widget_width = '50';
|
||||
}
|
||||
|
||||
if ( 3 === (int) $widgets ) {
|
||||
$widget_width = '33';
|
||||
}
|
||||
|
||||
if ( 4 === (int) $widgets ) {
|
||||
$widget_width = '25';
|
||||
}
|
||||
|
||||
if ( 5 === (int) $widgets ) {
|
||||
$widget_width = '20';
|
||||
}
|
||||
?>
|
||||
<div id="footer-widgets" class="site footer-widgets">
|
||||
<div <?php generate_do_element_classes( 'inside_footer' ); ?>>
|
||||
<div class="inside-footer-widgets">
|
||||
<?php
|
||||
if ( $widgets >= 1 ) {
|
||||
generate_do_footer_widget( $widget_width, 1 );
|
||||
}
|
||||
|
||||
if ( $widgets >= 2 ) {
|
||||
generate_do_footer_widget( $widget_width, 2 );
|
||||
}
|
||||
|
||||
if ( $widgets >= 3 ) {
|
||||
generate_do_footer_widget( $widget_width, 3 );
|
||||
}
|
||||
|
||||
if ( $widgets >= 4 ) {
|
||||
generate_do_footer_widget( $widget_width, 4 );
|
||||
}
|
||||
|
||||
if ( $widgets >= 5 ) {
|
||||
generate_do_footer_widget( $widget_width, 5 );
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
/**
|
||||
* generate_after_footer_widgets hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_footer_widgets' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_back_to_top' ) ) {
|
||||
add_action( 'generate_after_footer', 'generate_back_to_top' );
|
||||
/**
|
||||
* Build the back to top button
|
||||
*
|
||||
* @since 1.3.24
|
||||
*/
|
||||
function generate_back_to_top() {
|
||||
$generate_settings = wp_parse_args(
|
||||
get_option( 'generate_settings', array() ),
|
||||
generate_get_defaults()
|
||||
);
|
||||
|
||||
if ( 'enable' !== $generate_settings['back_to_top'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
echo apply_filters( // phpcs:ignore
|
||||
'generate_back_to_top_output',
|
||||
sprintf(
|
||||
'<a title="%1$s" aria-label="%1$s" rel="nofollow" href="#" class="generate-back-to-top" style="opacity:0;visibility:hidden;" data-scroll-speed="%2$s" data-start-scroll="%3$s">
|
||||
%5$s
|
||||
</a>',
|
||||
esc_attr__( 'Scroll back to top', 'generatepress' ),
|
||||
absint( apply_filters( 'generate_back_to_top_scroll_speed', 400 ) ),
|
||||
absint( apply_filters( 'generate_back_to_top_start_scroll', 300 ) ),
|
||||
esc_attr( apply_filters( 'generate_back_to_top_icon', 'fa-angle-up' ) ),
|
||||
generate_get_svg_icon( 'arrow-up' )
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* Footer elements.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_construct_footer' ) ) {
|
||||
add_action( 'generate_footer', 'generate_construct_footer' );
|
||||
/**
|
||||
* Build our footer.
|
||||
*
|
||||
* @since 1.3.42
|
||||
*/
|
||||
function generate_construct_footer() {
|
||||
?>
|
||||
<footer <?php generate_do_attr( 'site-info' ); ?>>
|
||||
<div <?php generate_do_attr( 'inside-site-info' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_copyright hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_footer_bar - 15
|
||||
*/
|
||||
do_action( 'generate_before_copyright' );
|
||||
?>
|
||||
<div class="copyright-bar">
|
||||
<?php
|
||||
/**
|
||||
* generate_credits hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_add_footer_info - 10
|
||||
*/
|
||||
do_action( 'generate_credits' );
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_footer_bar' ) ) {
|
||||
add_action( 'generate_before_copyright', 'generate_footer_bar', 15 );
|
||||
/**
|
||||
* Build our footer bar
|
||||
*
|
||||
* @since 1.3.42
|
||||
*/
|
||||
function generate_footer_bar() {
|
||||
if ( ! is_active_sidebar( 'footer-bar' ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div class="footer-bar">
|
||||
<?php dynamic_sidebar( 'footer-bar' ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_add_footer_info' ) ) {
|
||||
add_action( 'generate_credits', 'generate_add_footer_info' );
|
||||
/**
|
||||
* Add the copyright to the footer
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_add_footer_info() {
|
||||
$copyright = sprintf(
|
||||
'<span class="copyright">© %1$s %2$s</span> • %4$s <a href="%3$s"%6$s>%5$s</a>',
|
||||
date( 'Y' ), // phpcs:ignore
|
||||
get_bloginfo( 'name' ),
|
||||
esc_url( 'https://generatepress.com' ),
|
||||
_x( 'Built with', 'GeneratePress', 'generatepress' ),
|
||||
__( 'GeneratePress', 'generatepress' ),
|
||||
'microdata' === generate_get_schema_type() ? ' itemprop="url"' : ''
|
||||
);
|
||||
|
||||
echo apply_filters( 'generate_copyright', $copyright ); // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build our individual footer widgets.
|
||||
* Displays a sample widget if no widget is found in the area.
|
||||
*
|
||||
* @since 2.0
|
||||
*
|
||||
* @param int $widget_width The width class of our widget.
|
||||
* @param int $widget The ID of our widget.
|
||||
*/
|
||||
function generate_do_footer_widget( $widget_width, $widget ) {
|
||||
$widget_classes = sprintf(
|
||||
'footer-widget-%s',
|
||||
absint( $widget )
|
||||
);
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$widget_width = apply_filters( "generate_footer_widget_{$widget}_width", $widget_width );
|
||||
$tablet_widget_width = apply_filters( "generate_footer_widget_{$widget}_tablet_width", '50' );
|
||||
|
||||
$widget_classes = sprintf(
|
||||
'footer-widget-%1$s grid-parent grid-%2$s tablet-grid-%3$s mobile-grid-100',
|
||||
absint( $widget ),
|
||||
absint( $widget_width ),
|
||||
absint( $tablet_widget_width )
|
||||
);
|
||||
}
|
||||
?>
|
||||
<div class="<?php echo $widget_classes; // phpcs:ignore ?>">
|
||||
<?php dynamic_sidebar( 'footer-' . absint( $widget ) ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_construct_footer_widgets' ) ) {
|
||||
add_action( 'generate_footer', 'generate_construct_footer_widgets', 5 );
|
||||
/**
|
||||
* Build our footer widgets.
|
||||
*
|
||||
* @since 1.3.42
|
||||
*/
|
||||
function generate_construct_footer_widgets() {
|
||||
// Get how many widgets to show.
|
||||
$widgets = generate_get_footer_widgets();
|
||||
|
||||
if ( ! empty( $widgets ) && 0 !== $widgets ) :
|
||||
|
||||
// If no footer widgets exist, we don't need to continue.
|
||||
if ( ! is_active_sidebar( 'footer-1' ) && ! is_active_sidebar( 'footer-2' ) && ! is_active_sidebar( 'footer-3' ) && ! is_active_sidebar( 'footer-4' ) && ! is_active_sidebar( 'footer-5' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set up the widget width.
|
||||
$widget_width = '';
|
||||
|
||||
if ( 1 === (int) $widgets ) {
|
||||
$widget_width = '100';
|
||||
}
|
||||
|
||||
if ( 2 === (int) $widgets ) {
|
||||
$widget_width = '50';
|
||||
}
|
||||
|
||||
if ( 3 === (int) $widgets ) {
|
||||
$widget_width = '33';
|
||||
}
|
||||
|
||||
if ( 4 === (int) $widgets ) {
|
||||
$widget_width = '25';
|
||||
}
|
||||
|
||||
if ( 5 === (int) $widgets ) {
|
||||
$widget_width = '20';
|
||||
}
|
||||
?>
|
||||
<div id="footer-widgets" class="site footer-widgets">
|
||||
<div <?php generate_do_attr( 'footer-widgets-container' ); ?>>
|
||||
<div class="inside-footer-widgets">
|
||||
<?php
|
||||
if ( $widgets >= 1 ) {
|
||||
generate_do_footer_widget( $widget_width, 1 );
|
||||
}
|
||||
|
||||
if ( $widgets >= 2 ) {
|
||||
generate_do_footer_widget( $widget_width, 2 );
|
||||
}
|
||||
|
||||
if ( $widgets >= 3 ) {
|
||||
generate_do_footer_widget( $widget_width, 3 );
|
||||
}
|
||||
|
||||
if ( $widgets >= 4 ) {
|
||||
generate_do_footer_widget( $widget_width, 4 );
|
||||
}
|
||||
|
||||
if ( $widgets >= 5 ) {
|
||||
generate_do_footer_widget( $widget_width, 5 );
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
/**
|
||||
* generate_after_footer_widgets hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_footer_widgets' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_back_to_top' ) ) {
|
||||
add_action( 'generate_after_footer', 'generate_back_to_top' );
|
||||
/**
|
||||
* Build the back to top button
|
||||
*
|
||||
* @since 1.3.24
|
||||
*/
|
||||
function generate_back_to_top() {
|
||||
$generate_settings = wp_parse_args(
|
||||
get_option( 'generate_settings', array() ),
|
||||
generate_get_defaults()
|
||||
);
|
||||
|
||||
if ( 'enable' !== $generate_settings['back_to_top'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
echo apply_filters( // phpcs:ignore
|
||||
'generate_back_to_top_output',
|
||||
sprintf(
|
||||
'<a title="%1$s" aria-label="%1$s" rel="nofollow" href="#" class="generate-back-to-top" style="opacity:0;visibility:hidden;" data-scroll-speed="%2$s" data-start-scroll="%3$s">
|
||||
%5$s
|
||||
</a>',
|
||||
esc_attr__( 'Scroll back to top', 'generatepress' ),
|
||||
absint( apply_filters( 'generate_back_to_top_scroll_speed', 400 ) ),
|
||||
absint( apply_filters( 'generate_back_to_top_start_scroll', 300 ) ),
|
||||
esc_attr( apply_filters( 'generate_back_to_top_icon', 'fa-angle-up' ) ),
|
||||
generate_get_svg_icon( 'arrow-up' )
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,404 +1,394 @@
|
||||
<?php
|
||||
/**
|
||||
* Header elements.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_construct_header' ) ) {
|
||||
add_action( 'generate_header', 'generate_construct_header' );
|
||||
/**
|
||||
* Build the header.
|
||||
*
|
||||
* @since 1.3.42
|
||||
*/
|
||||
function generate_construct_header() {
|
||||
?>
|
||||
<header id="masthead" <?php generate_do_element_classes( 'header' ); ?>>
|
||||
<div <?php generate_do_element_classes( 'inside_header' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_header_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_header_content' );
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
// Add our main header items.
|
||||
generate_header_items();
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_header_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_add_navigation_float_right - 5
|
||||
*/
|
||||
do_action( 'generate_after_header_content' );
|
||||
?>
|
||||
</div>
|
||||
</header>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_header_items' ) ) {
|
||||
/**
|
||||
* Build the header contents.
|
||||
* Wrapping this into a function allows us to customize the order.
|
||||
*
|
||||
* @since 1.2.9.7
|
||||
*/
|
||||
function generate_header_items() {
|
||||
$order = apply_filters(
|
||||
'generate_header_items_order',
|
||||
array(
|
||||
'header-widget',
|
||||
'site-branding',
|
||||
'logo',
|
||||
)
|
||||
);
|
||||
|
||||
foreach ( $order as $item ) {
|
||||
if ( 'header-widget' === $item ) {
|
||||
generate_construct_header_widget();
|
||||
}
|
||||
|
||||
if ( 'site-branding' === $item ) {
|
||||
generate_construct_site_title();
|
||||
}
|
||||
|
||||
if ( 'logo' === $item ) {
|
||||
generate_construct_logo();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_construct_logo' ) ) {
|
||||
/**
|
||||
* Build the logo
|
||||
*
|
||||
* @since 1.3.28
|
||||
*/
|
||||
function generate_construct_logo() {
|
||||
$logo_url = ( function_exists( 'the_custom_logo' ) && get_theme_mod( 'custom_logo' ) ) ? wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'full' ) : false;
|
||||
$logo_url = ( $logo_url ) ? $logo_url[0] : generate_get_option( 'logo' );
|
||||
|
||||
$logo_url = esc_url( apply_filters( 'generate_logo', $logo_url ) );
|
||||
$retina_logo_url = esc_url( apply_filters( 'generate_retina_logo', generate_get_option( 'retina_logo' ) ) );
|
||||
|
||||
// If we don't have a logo, bail.
|
||||
if ( empty( $logo_url ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_before_logo hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_logo' );
|
||||
|
||||
$attr = apply_filters(
|
||||
'generate_logo_attributes',
|
||||
array(
|
||||
'class' => 'header-image is-logo-image',
|
||||
'alt' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
|
||||
'src' => $logo_url,
|
||||
'title' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
|
||||
)
|
||||
);
|
||||
|
||||
if ( '' !== $retina_logo_url ) {
|
||||
$attr['srcset'] = $logo_url . ' 1x, ' . $retina_logo_url . ' 2x';
|
||||
|
||||
// Add dimensions to image if retina is set. This fixes a container width bug in Firefox.
|
||||
if ( function_exists( 'the_custom_logo' ) && get_theme_mod( 'custom_logo' ) ) {
|
||||
$data = wp_get_attachment_metadata( get_theme_mod( 'custom_logo' ) );
|
||||
|
||||
if ( ! empty( $data ) ) {
|
||||
$attr['width'] = $data['width'];
|
||||
$attr['height'] = $data['height'];
|
||||
}
|
||||
}
|
||||
} elseif ( generate_is_using_flexbox() ) {
|
||||
// Add this to flexbox version only until we can verify it won't conflict with existing installs.
|
||||
if ( function_exists( 'the_custom_logo' ) && get_theme_mod( 'custom_logo' ) ) {
|
||||
$data = wp_get_attachment_metadata( get_theme_mod( 'custom_logo' ) );
|
||||
|
||||
if ( ! empty( $data ) ) {
|
||||
$attr['width'] = $data['width'];
|
||||
$attr['height'] = $data['height'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$attr = array_map( 'esc_attr', $attr );
|
||||
|
||||
$html_attr = '';
|
||||
foreach ( $attr as $name => $value ) {
|
||||
$html_attr .= " $name=" . '"' . $value . '"';
|
||||
}
|
||||
|
||||
// Print our HTML.
|
||||
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'generate_logo_output',
|
||||
sprintf(
|
||||
'<div class="site-logo">
|
||||
<a href="%1$s" title="%2$s" rel="home">
|
||||
<img %3$s />
|
||||
</a>
|
||||
</div>',
|
||||
esc_url( apply_filters( 'generate_logo_href', home_url( '/' ) ) ),
|
||||
esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
|
||||
$html_attr
|
||||
),
|
||||
$logo_url,
|
||||
$html_attr
|
||||
);
|
||||
|
||||
/**
|
||||
* generate_after_logo hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_logo' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_construct_site_title' ) ) {
|
||||
/**
|
||||
* Build the site title and tagline.
|
||||
*
|
||||
* @since 1.3.28
|
||||
*/
|
||||
function generate_construct_site_title() {
|
||||
$generate_settings = wp_parse_args(
|
||||
get_option( 'generate_settings', array() ),
|
||||
generate_get_defaults()
|
||||
);
|
||||
|
||||
// Get the title and tagline.
|
||||
$title = get_bloginfo( 'title' );
|
||||
$tagline = get_bloginfo( 'description' );
|
||||
|
||||
// If the disable title checkbox is checked, or the title field is empty, return true.
|
||||
$disable_title = ( '1' == $generate_settings['hide_title'] || '' == $title ) ? true : false; // phpcs:ignore
|
||||
|
||||
// If the disable tagline checkbox is checked, or the tagline field is empty, return true.
|
||||
$disable_tagline = ( '1' == $generate_settings['hide_tagline'] || '' == $tagline ) ? true : false; // phpcs:ignore
|
||||
|
||||
$schema_type = generate_get_schema_type();
|
||||
|
||||
// Build our site title.
|
||||
$site_title = apply_filters(
|
||||
'generate_site_title_output',
|
||||
sprintf(
|
||||
'<%1$s class="main-title"%4$s>
|
||||
<a href="%2$s" rel="home">
|
||||
%3$s
|
||||
</a>
|
||||
</%1$s>',
|
||||
( is_front_page() && is_home() ) ? 'h1' : 'p',
|
||||
esc_url( apply_filters( 'generate_site_title_href', home_url( '/' ) ) ),
|
||||
get_bloginfo( 'name' ),
|
||||
'microdata' === generate_get_schema_type() ? ' itemprop="headline"' : ''
|
||||
)
|
||||
);
|
||||
|
||||
// Build our tagline.
|
||||
$site_tagline = apply_filters(
|
||||
'generate_site_description_output',
|
||||
sprintf(
|
||||
'<p class="site-description"%2$s>
|
||||
%1$s
|
||||
</p>',
|
||||
html_entity_decode( get_bloginfo( 'description', 'display' ) ), // phpcs:ignore
|
||||
'microdata' === generate_get_schema_type() ? ' itemprop="description"' : ''
|
||||
)
|
||||
);
|
||||
|
||||
// Site title and tagline.
|
||||
if ( false === $disable_title || false === $disable_tagline ) {
|
||||
if ( generate_needs_site_branding_container() ) {
|
||||
echo '<div class="site-branding-container">';
|
||||
generate_construct_logo();
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- outputting site title and tagline. False positive.
|
||||
echo apply_filters(
|
||||
'generate_site_branding_output',
|
||||
sprintf(
|
||||
'<div class="site-branding">
|
||||
%1$s
|
||||
%2$s
|
||||
</div>',
|
||||
( ! $disable_title ) ? $site_title : '',
|
||||
( ! $disable_tagline ) ? $site_tagline : ''
|
||||
)
|
||||
);
|
||||
|
||||
if ( generate_needs_site_branding_container() ) {
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'generate_header_items_order', 'generate_reorder_inline_site_branding' );
|
||||
/**
|
||||
* Remove the logo from it's usual position.
|
||||
*
|
||||
* @since 2.3
|
||||
* @param array $order Order of the header items.
|
||||
*/
|
||||
function generate_reorder_inline_site_branding( $order ) {
|
||||
if ( ! generate_get_option( 'inline_logo_site_branding' ) || ! generate_has_logo_site_branding() ) {
|
||||
return $order;
|
||||
}
|
||||
|
||||
return array(
|
||||
'header-widget',
|
||||
'site-branding',
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_construct_header_widget' ) ) {
|
||||
/**
|
||||
* Build the header widget.
|
||||
*
|
||||
* @since 1.3.28
|
||||
*/
|
||||
function generate_construct_header_widget() {
|
||||
if ( is_active_sidebar( 'header' ) ) :
|
||||
?>
|
||||
<div class="header-widget">
|
||||
<?php dynamic_sidebar( 'header' ); ?>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'generate_before_header_content', 'generate_do_site_logo', 5 );
|
||||
/**
|
||||
* Add the site logo to our header.
|
||||
* Only added if we aren't using floats to preserve backwards compatibility.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_do_site_logo() {
|
||||
if ( ! generate_is_using_flexbox() || generate_needs_site_branding_container() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
generate_construct_logo();
|
||||
}
|
||||
|
||||
add_action( 'generate_before_header_content', 'generate_do_site_branding' );
|
||||
/**
|
||||
* Add the site branding to our header.
|
||||
* Only added if we aren't using floats to preserve backwards compatibility.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_do_site_branding() {
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
generate_construct_site_title();
|
||||
}
|
||||
|
||||
add_action( 'generate_after_header_content', 'generate_do_header_widget' );
|
||||
/**
|
||||
* Add the header widget to our header.
|
||||
* Only used when grid isn't using floats to preserve backwards compatibility.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_do_header_widget() {
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
generate_construct_header_widget();
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_top_bar' ) ) {
|
||||
add_action( 'generate_before_header', 'generate_top_bar', 5 );
|
||||
/**
|
||||
* Build our top bar.
|
||||
*
|
||||
* @since 1.3.45
|
||||
*/
|
||||
function generate_top_bar() {
|
||||
if ( ! is_active_sidebar( 'top-bar' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$inside_top_bar_class = '';
|
||||
|
||||
if ( 'contained' === generate_get_option( 'top_bar_inner_width' ) ) {
|
||||
$inside_top_bar_class = ' grid-container grid-parent';
|
||||
|
||||
if ( generate_is_using_flexbox() ) {
|
||||
$inside_top_bar_class = ' grid-container';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div <?php generate_do_element_classes( 'top_bar' ); ?>>
|
||||
<div class="inside-top-bar<?php echo $inside_top_bar_class; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- False positive. ?>">
|
||||
<?php dynamic_sidebar( 'top-bar' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_pingback_header' ) ) {
|
||||
add_action( 'wp_head', 'generate_pingback_header' );
|
||||
/**
|
||||
* Add a pingback url auto-discovery header for singularly identifiable articles.
|
||||
*
|
||||
* @since 1.3.42
|
||||
*/
|
||||
function generate_pingback_header() {
|
||||
if ( is_singular() && pings_open() ) {
|
||||
printf( '<link rel="pingback" href="%s">' . "\n", esc_url( get_bloginfo( 'pingback_url' ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_add_viewport' ) ) {
|
||||
add_action( 'wp_head', 'generate_add_viewport' );
|
||||
/**
|
||||
* Add viewport to wp_head.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
function generate_add_viewport() {
|
||||
echo apply_filters( 'generate_meta_viewport', '<meta name="viewport" content="width=device-width, initial-scale=1">' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'generate_before_header', 'generate_do_skip_to_content_link', 2 );
|
||||
/**
|
||||
* Add skip to content link before the header.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
function generate_do_skip_to_content_link() {
|
||||
printf(
|
||||
'<a class="screen-reader-text skip-link" href="#content" title="%1$s">%2$s</a>',
|
||||
esc_attr__( 'Skip to content', 'generatepress' ),
|
||||
esc_html__( 'Skip to content', 'generatepress' )
|
||||
);
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* Header elements.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_construct_header' ) ) {
|
||||
add_action( 'generate_header', 'generate_construct_header' );
|
||||
/**
|
||||
* Build the header.
|
||||
*
|
||||
* @since 1.3.42
|
||||
*/
|
||||
function generate_construct_header() {
|
||||
?>
|
||||
<header <?php generate_do_attr( 'header' ); ?>>
|
||||
<div <?php generate_do_attr( 'inside-header' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_header_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_header_content' );
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
// Add our main header items.
|
||||
generate_header_items();
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_header_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_add_navigation_float_right - 5
|
||||
*/
|
||||
do_action( 'generate_after_header_content' );
|
||||
?>
|
||||
</div>
|
||||
</header>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_header_items' ) ) {
|
||||
/**
|
||||
* Build the header contents.
|
||||
* Wrapping this into a function allows us to customize the order.
|
||||
*
|
||||
* @since 1.2.9.7
|
||||
*/
|
||||
function generate_header_items() {
|
||||
$order = apply_filters(
|
||||
'generate_header_items_order',
|
||||
array(
|
||||
'header-widget',
|
||||
'site-branding',
|
||||
'logo',
|
||||
)
|
||||
);
|
||||
|
||||
foreach ( $order as $item ) {
|
||||
if ( 'header-widget' === $item ) {
|
||||
generate_construct_header_widget();
|
||||
}
|
||||
|
||||
if ( 'site-branding' === $item ) {
|
||||
generate_construct_site_title();
|
||||
}
|
||||
|
||||
if ( 'logo' === $item ) {
|
||||
generate_construct_logo();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_construct_logo' ) ) {
|
||||
/**
|
||||
* Build the logo
|
||||
*
|
||||
* @since 1.3.28
|
||||
*/
|
||||
function generate_construct_logo() {
|
||||
$logo_url = ( function_exists( 'the_custom_logo' ) && get_theme_mod( 'custom_logo' ) ) ? wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'full' ) : false;
|
||||
$logo_url = ( $logo_url ) ? $logo_url[0] : generate_get_option( 'logo' );
|
||||
|
||||
$logo_url = esc_url( apply_filters( 'generate_logo', $logo_url ) );
|
||||
$retina_logo_url = esc_url( apply_filters( 'generate_retina_logo', generate_get_option( 'retina_logo' ) ) );
|
||||
|
||||
// If we don't have a logo, bail.
|
||||
if ( empty( $logo_url ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_before_logo hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_logo' );
|
||||
|
||||
$attr = apply_filters(
|
||||
'generate_logo_attributes',
|
||||
array(
|
||||
'class' => 'header-image is-logo-image',
|
||||
'alt' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
|
||||
'src' => $logo_url,
|
||||
'title' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
|
||||
)
|
||||
);
|
||||
|
||||
if ( '' !== $retina_logo_url ) {
|
||||
$attr['srcset'] = $logo_url . ' 1x, ' . $retina_logo_url . ' 2x';
|
||||
|
||||
// Add dimensions to image if retina is set. This fixes a container width bug in Firefox.
|
||||
if ( function_exists( 'the_custom_logo' ) && get_theme_mod( 'custom_logo' ) ) {
|
||||
$data = wp_get_attachment_metadata( get_theme_mod( 'custom_logo' ) );
|
||||
|
||||
if ( ! empty( $data ) ) {
|
||||
$attr['width'] = $data['width'];
|
||||
$attr['height'] = $data['height'];
|
||||
}
|
||||
}
|
||||
} elseif ( generate_is_using_flexbox() ) {
|
||||
// Add this to flexbox version only until we can verify it won't conflict with existing installs.
|
||||
if ( function_exists( 'the_custom_logo' ) && get_theme_mod( 'custom_logo' ) ) {
|
||||
$data = wp_get_attachment_metadata( get_theme_mod( 'custom_logo' ) );
|
||||
|
||||
if ( ! empty( $data ) ) {
|
||||
$attr['width'] = $data['width'];
|
||||
$attr['height'] = $data['height'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$attr = array_map( 'esc_attr', $attr );
|
||||
|
||||
$html_attr = '';
|
||||
foreach ( $attr as $name => $value ) {
|
||||
$html_attr .= " $name=" . '"' . $value . '"';
|
||||
}
|
||||
|
||||
// Print our HTML.
|
||||
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'generate_logo_output',
|
||||
sprintf(
|
||||
'<div class="site-logo">
|
||||
<a href="%1$s" title="%2$s" rel="home">
|
||||
<img %3$s />
|
||||
</a>
|
||||
</div>',
|
||||
esc_url( apply_filters( 'generate_logo_href', home_url( '/' ) ) ),
|
||||
esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
|
||||
$html_attr
|
||||
),
|
||||
$logo_url,
|
||||
$html_attr
|
||||
);
|
||||
|
||||
/**
|
||||
* generate_after_logo hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_logo' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_construct_site_title' ) ) {
|
||||
/**
|
||||
* Build the site title and tagline.
|
||||
*
|
||||
* @since 1.3.28
|
||||
*/
|
||||
function generate_construct_site_title() {
|
||||
$generate_settings = wp_parse_args(
|
||||
get_option( 'generate_settings', array() ),
|
||||
generate_get_defaults()
|
||||
);
|
||||
|
||||
// Get the title and tagline.
|
||||
$title = get_bloginfo( 'title' );
|
||||
$tagline = get_bloginfo( 'description' );
|
||||
|
||||
// If the disable title checkbox is checked, or the title field is empty, return true.
|
||||
$disable_title = ( '1' == $generate_settings['hide_title'] || '' == $title ) ? true : false; // phpcs:ignore
|
||||
|
||||
// If the disable tagline checkbox is checked, or the tagline field is empty, return true.
|
||||
$disable_tagline = ( '1' == $generate_settings['hide_tagline'] || '' == $tagline ) ? true : false; // phpcs:ignore
|
||||
|
||||
$schema_type = generate_get_schema_type();
|
||||
|
||||
// Build our site title.
|
||||
$site_title = apply_filters(
|
||||
'generate_site_title_output',
|
||||
sprintf(
|
||||
'<%1$s class="main-title"%4$s>
|
||||
<a href="%2$s" rel="home">
|
||||
%3$s
|
||||
</a>
|
||||
</%1$s>',
|
||||
( is_front_page() && is_home() ) ? 'h1' : 'p',
|
||||
esc_url( apply_filters( 'generate_site_title_href', home_url( '/' ) ) ),
|
||||
get_bloginfo( 'name' ),
|
||||
'microdata' === generate_get_schema_type() ? ' itemprop="headline"' : ''
|
||||
)
|
||||
);
|
||||
|
||||
// Build our tagline.
|
||||
$site_tagline = apply_filters(
|
||||
'generate_site_description_output',
|
||||
sprintf(
|
||||
'<p class="site-description"%2$s>
|
||||
%1$s
|
||||
</p>',
|
||||
html_entity_decode( get_bloginfo( 'description', 'display' ) ), // phpcs:ignore
|
||||
'microdata' === generate_get_schema_type() ? ' itemprop="description"' : ''
|
||||
)
|
||||
);
|
||||
|
||||
// Site title and tagline.
|
||||
if ( false === $disable_title || false === $disable_tagline ) {
|
||||
if ( generate_needs_site_branding_container() ) {
|
||||
echo '<div class="site-branding-container">';
|
||||
generate_construct_logo();
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- outputting site title and tagline. False positive.
|
||||
echo apply_filters(
|
||||
'generate_site_branding_output',
|
||||
sprintf(
|
||||
'<div class="site-branding">
|
||||
%1$s
|
||||
%2$s
|
||||
</div>',
|
||||
( ! $disable_title ) ? $site_title : '',
|
||||
( ! $disable_tagline ) ? $site_tagline : ''
|
||||
)
|
||||
);
|
||||
|
||||
if ( generate_needs_site_branding_container() ) {
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'generate_header_items_order', 'generate_reorder_inline_site_branding' );
|
||||
/**
|
||||
* Remove the logo from it's usual position.
|
||||
*
|
||||
* @since 2.3
|
||||
* @param array $order Order of the header items.
|
||||
*/
|
||||
function generate_reorder_inline_site_branding( $order ) {
|
||||
if ( ! generate_get_option( 'inline_logo_site_branding' ) || ! generate_has_logo_site_branding() ) {
|
||||
return $order;
|
||||
}
|
||||
|
||||
return array(
|
||||
'header-widget',
|
||||
'site-branding',
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_construct_header_widget' ) ) {
|
||||
/**
|
||||
* Build the header widget.
|
||||
*
|
||||
* @since 1.3.28
|
||||
*/
|
||||
function generate_construct_header_widget() {
|
||||
if ( is_active_sidebar( 'header' ) ) :
|
||||
?>
|
||||
<div class="header-widget">
|
||||
<?php dynamic_sidebar( 'header' ); ?>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'generate_before_header_content', 'generate_do_site_logo', 5 );
|
||||
/**
|
||||
* Add the site logo to our header.
|
||||
* Only added if we aren't using floats to preserve backwards compatibility.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_do_site_logo() {
|
||||
if ( ! generate_is_using_flexbox() || generate_needs_site_branding_container() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
generate_construct_logo();
|
||||
}
|
||||
|
||||
add_action( 'generate_before_header_content', 'generate_do_site_branding' );
|
||||
/**
|
||||
* Add the site branding to our header.
|
||||
* Only added if we aren't using floats to preserve backwards compatibility.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_do_site_branding() {
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
generate_construct_site_title();
|
||||
}
|
||||
|
||||
add_action( 'generate_after_header_content', 'generate_do_header_widget' );
|
||||
/**
|
||||
* Add the header widget to our header.
|
||||
* Only used when grid isn't using floats to preserve backwards compatibility.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_do_header_widget() {
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
generate_construct_header_widget();
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_top_bar' ) ) {
|
||||
add_action( 'generate_before_header', 'generate_top_bar', 5 );
|
||||
/**
|
||||
* Build our top bar.
|
||||
*
|
||||
* @since 1.3.45
|
||||
*/
|
||||
function generate_top_bar() {
|
||||
if ( ! is_active_sidebar( 'top-bar' ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div <?php generate_do_attr( 'top-bar' ); ?>>
|
||||
<div <?php generate_do_attr( 'inside-top-bar' ); ?>>
|
||||
<?php dynamic_sidebar( 'top-bar' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_pingback_header' ) ) {
|
||||
add_action( 'wp_head', 'generate_pingback_header' );
|
||||
/**
|
||||
* Add a pingback url auto-discovery header for singularly identifiable articles.
|
||||
*
|
||||
* @since 1.3.42
|
||||
*/
|
||||
function generate_pingback_header() {
|
||||
if ( is_singular() && pings_open() ) {
|
||||
printf( '<link rel="pingback" href="%s">' . "\n", esc_url( get_bloginfo( 'pingback_url' ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_add_viewport' ) ) {
|
||||
add_action( 'wp_head', 'generate_add_viewport', 1 );
|
||||
/**
|
||||
* Add viewport to wp_head.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
function generate_add_viewport() {
|
||||
echo apply_filters( 'generate_meta_viewport', '<meta name="viewport" content="width=device-width, initial-scale=1">' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'generate_before_header', 'generate_do_skip_to_content_link', 2 );
|
||||
/**
|
||||
* Add skip to content link before the header.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
function generate_do_skip_to_content_link() {
|
||||
printf(
|
||||
'<a class="screen-reader-text skip-link" href="#content" title="%1$s">%2$s</a>',
|
||||
esc_attr__( 'Skip to content', 'generatepress' ),
|
||||
esc_html__( 'Skip to content', 'generatepress' )
|
||||
);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,75 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* The main template file.
|
||||
*
|
||||
* 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).
|
||||
* 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.
|
||||
* Learn more: http://codex.wordpress.org/Template_Hierarchy
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
get_header(); ?>
|
||||
|
||||
<div id="primary" <?php generate_do_element_classes( 'content' ); ?>>
|
||||
<main id="main" <?php generate_do_element_classes( 'main' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_main_content' );
|
||||
|
||||
if ( generate_has_default_loop() ) {
|
||||
if ( have_posts() ) :
|
||||
|
||||
while ( have_posts() ) :
|
||||
|
||||
the_post();
|
||||
|
||||
generate_do_template_part( 'index' );
|
||||
|
||||
endwhile;
|
||||
|
||||
/**
|
||||
* generate_after_loop hook.
|
||||
*
|
||||
* @since 2.3
|
||||
*/
|
||||
do_action( 'generate_after_loop', 'index' );
|
||||
|
||||
else :
|
||||
|
||||
generate_do_template_part( 'none' );
|
||||
|
||||
endif;
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_main_content' );
|
||||
?>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_primary_content_area hook.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
do_action( 'generate_after_primary_content_area' );
|
||||
|
||||
generate_construct_sidebars();
|
||||
|
||||
get_footer();
|
||||
<?php
|
||||
/**
|
||||
* The main template file.
|
||||
*
|
||||
* 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).
|
||||
* 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.
|
||||
* Learn more: http://codex.wordpress.org/Template_Hierarchy
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
get_header(); ?>
|
||||
|
||||
<div <?php generate_do_attr( 'content' ); ?>>
|
||||
<main <?php generate_do_attr( 'main' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_main_content' );
|
||||
|
||||
if ( generate_has_default_loop() ) {
|
||||
if ( have_posts() ) :
|
||||
|
||||
/**
|
||||
* generate_before_loop hook.
|
||||
*
|
||||
* @since 3.1.0
|
||||
*/
|
||||
do_action( 'generate_before_loop', 'index' );
|
||||
|
||||
while ( have_posts() ) :
|
||||
|
||||
the_post();
|
||||
|
||||
generate_do_template_part( 'index' );
|
||||
|
||||
endwhile;
|
||||
|
||||
/**
|
||||
* generate_after_loop hook.
|
||||
*
|
||||
* @since 2.3
|
||||
*/
|
||||
do_action( 'generate_after_loop', 'index' );
|
||||
|
||||
else :
|
||||
|
||||
generate_do_template_part( 'none' );
|
||||
|
||||
endif;
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_main_content' );
|
||||
?>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_primary_content_area hook.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
do_action( 'generate_after_primary_content_area' );
|
||||
|
||||
generate_construct_sidebars();
|
||||
|
||||
get_footer();
|
||||
|
@ -1,78 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* The template part for displaying a message that posts cannot be found.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="no-results not-found">
|
||||
<div class="inside-article">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_featured_page_header_inside_single - 10
|
||||
*/
|
||||
do_action( 'generate_before_content' );
|
||||
?>
|
||||
|
||||
<header class="entry-header">
|
||||
<h1 class="entry-title"><?php _e( 'Nothing Found', 'generatepress' ); ?></h1>
|
||||
</header>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_entry_header hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_post_image - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_header' );
|
||||
?>
|
||||
|
||||
<div class="entry-content">
|
||||
|
||||
<?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
|
||||
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: 1: Admin URL */
|
||||
__( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'generatepress' ),
|
||||
esc_url( admin_url( 'post-new.php' ) )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
|
||||
<?php elseif ( is_search() ) : ?>
|
||||
|
||||
<p><?php _e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'generatepress' ); ?></p>
|
||||
<?php get_search_form(); ?>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<p><?php _e( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'generatepress' ); ?></p>
|
||||
<?php get_search_form(); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_content' );
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
/**
|
||||
* The template part for displaying a message that posts cannot be found.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="no-results not-found">
|
||||
<div class="inside-article">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_featured_page_header_inside_single - 10
|
||||
*/
|
||||
do_action( 'generate_before_content' );
|
||||
?>
|
||||
|
||||
<header <?php generate_do_attr( 'entry-header' ); ?>>
|
||||
<h1 class="entry-title"><?php _e( 'Nothing Found', 'generatepress' ); ?></h1>
|
||||
</header>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_entry_header hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @hooked generate_post_image - 10
|
||||
*/
|
||||
do_action( 'generate_after_entry_header' );
|
||||
?>
|
||||
|
||||
<div class="entry-content">
|
||||
|
||||
<?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
|
||||
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: 1: Admin URL */
|
||||
__( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'generatepress' ),
|
||||
esc_url( admin_url( 'post-new.php' ) )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
|
||||
<?php elseif ( is_search() ) : ?>
|
||||
|
||||
<p><?php _e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'generatepress' ); ?></p>
|
||||
<?php get_search_form(); ?>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<p><?php _e( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'generatepress' ); ?></p>
|
||||
<?php get_search_form(); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_content' );
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,59 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying all pages.
|
||||
*
|
||||
* This is the template that displays all pages by default.
|
||||
* Please note that this is the WordPress construct of pages
|
||||
* and that other 'pages' on your WordPress site will use a
|
||||
* different template.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
get_header(); ?>
|
||||
|
||||
<div id="primary" <?php generate_do_element_classes( 'content' ); ?>>
|
||||
<main id="main" <?php generate_do_element_classes( 'main' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_main_content' );
|
||||
|
||||
if ( generate_has_default_loop() ) {
|
||||
while ( have_posts() ) :
|
||||
|
||||
the_post();
|
||||
|
||||
generate_do_template_part( 'page' );
|
||||
|
||||
endwhile;
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_main_content' );
|
||||
?>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_primary_content_area hook.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
do_action( 'generate_after_primary_content_area' );
|
||||
|
||||
generate_construct_sidebars();
|
||||
|
||||
get_footer();
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying all pages.
|
||||
*
|
||||
* This is the template that displays all pages by default.
|
||||
* Please note that this is the WordPress construct of pages
|
||||
* and that other 'pages' on your WordPress site will use a
|
||||
* different template.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
get_header(); ?>
|
||||
|
||||
<div <?php generate_do_attr( 'content' ); ?>>
|
||||
<main <?php generate_do_attr( 'main' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_main_content' );
|
||||
|
||||
if ( generate_has_default_loop() ) {
|
||||
while ( have_posts() ) :
|
||||
|
||||
the_post();
|
||||
|
||||
generate_do_template_part( 'page' );
|
||||
|
||||
endwhile;
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_main_content' );
|
||||
?>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_primary_content_area hook.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
do_action( 'generate_after_primary_content_area' );
|
||||
|
||||
generate_construct_sidebars();
|
||||
|
||||
get_footer();
|
||||
|
@ -4,9 +4,9 @@ Donate link: https://generatepress.com/ongoing-development/
|
||||
License: GPLv2 or later
|
||||
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
|
||||
Requires at least: 4.5
|
||||
Requires at least: 5.2
|
||||
Tested up to: 5.8
|
||||
Stable tag: 3.0.4
|
||||
Stable tag: 3.1.0
|
||||
|
||||
GeneratePress is a lightweight WordPress theme built with a focus on speed and usability.
|
||||
|
||||
@ -14,15 +14,15 @@ GeneratePress is a lightweight WordPress theme built with a focus on speed and u
|
||||
|
||||
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.
|
||||
We take full advantage of the 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.
|
||||
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.
|
||||
A few of our many features include 60+ color controls, powerful dynamic typography, 5 navigation locations, 5 sidebar layouts, dropdown menus (click or hover), and 9 widget areas.
|
||||
|
||||
Learn more and check out our [powerful premium version](https://generatepress.com).
|
||||
|
||||
@ -93,8 +93,48 @@ MIT License: https://github.com/woocommerce/selectWoo/blob/master/LICENSE.md
|
||||
By Brian Grinstead, http://briangrinstead.com
|
||||
MIT License: https://github.com/bgrins/TinyColor/blob/master/LICENSE
|
||||
|
||||
= React Select =
|
||||
By Jed Watson
|
||||
MIT License: https://github.com/JedWatson/react-select/blob/master/LICENSE
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 3.1.0 =
|
||||
|
||||
Release date: October 26, 2021
|
||||
|
||||
* New: Global color system
|
||||
* New: Add all theme color options to free theme
|
||||
* New: Re-build color options in the Customizer
|
||||
* New: Dynamic typography system
|
||||
* New: Underline links option
|
||||
* New: Only load menu.js when needed
|
||||
* New: generate_has_active_menu filter
|
||||
* New: generate_before_loop hook
|
||||
* New: Dynamic HTML attribute system
|
||||
* New: React-based Dashboard
|
||||
* New: generate_search_title_output filter
|
||||
* New: generate_after_comment_author_name hook
|
||||
* New: generate_show_comment_entry_meta filter
|
||||
* Tweak: Only allow vertical comment form resizing
|
||||
* Tweak: Move a11y javascript inline to the footer
|
||||
* Tweak: Add aria-label attributes to elements that need them
|
||||
* Tweak: Remove theme structure option for people using flexbox
|
||||
* Tweak: Remove search result title from template
|
||||
* Tweak: Add search result title using generate_before_loop hook
|
||||
* Tweak: Remove aria-required attribute from comment form
|
||||
* Tweak: Add required attribute to comment author/email fields if required
|
||||
* Tweak: Move viewport head meta below the title meta
|
||||
* Tweak: Optimize SVG icon HTML
|
||||
* Tweak: Move generate_svg_icon_element before the "replace" icon definition
|
||||
* Tweak: Change sub-menu box-shadow direction when sub-menu opens left
|
||||
* Tweak: Replace sub-menu box-shadow with border when opening down
|
||||
* Tweak: Remove query loop block margin
|
||||
* Tweak: Use get_the_archive_description() instead of term_description()
|
||||
* Fix: Missing search form button icon when using font icons
|
||||
* Fix: Load comments CSS if comments exists even if new comments are disabled
|
||||
* Fix: Sub-menu overlap using dropdown click
|
||||
|
||||
= 3.0.4 =
|
||||
|
||||
Release date: July 12, 2021
|
||||
|
@ -1,83 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying Search Results pages.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
get_header(); ?>
|
||||
|
||||
<div id="primary" <?php generate_do_element_classes( 'content' ); ?>>
|
||||
<main id="main" <?php generate_do_element_classes( 'main' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_main_content' );
|
||||
|
||||
if ( generate_has_default_loop() ) {
|
||||
if ( have_posts() ) :
|
||||
?>
|
||||
|
||||
<header class="page-header">
|
||||
<h1 class="page-title">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: 1: Search query name */
|
||||
__( 'Search Results for: %s', 'generatepress' ),
|
||||
'<span>' . get_search_query() . '</span>'
|
||||
);
|
||||
?>
|
||||
</h1>
|
||||
</header>
|
||||
|
||||
<?php
|
||||
while ( have_posts() ) :
|
||||
|
||||
the_post();
|
||||
|
||||
generate_do_template_part( 'search' );
|
||||
|
||||
endwhile;
|
||||
|
||||
/**
|
||||
* generate_after_loop hook.
|
||||
*
|
||||
* @since 2.3
|
||||
*/
|
||||
do_action( 'generate_after_loop', 'search' );
|
||||
|
||||
else :
|
||||
|
||||
generate_do_template_part( 'none' );
|
||||
|
||||
endif;
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_main_content' );
|
||||
?>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_primary_content_area hook.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
do_action( 'generate_after_primary_content_area' );
|
||||
|
||||
generate_construct_sidebars();
|
||||
|
||||
get_footer();
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying Search Results pages.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
get_header(); ?>
|
||||
|
||||
<div <?php generate_do_attr( 'content' ); ?>>
|
||||
<main <?php generate_do_attr( 'main' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_main_content' );
|
||||
|
||||
if ( generate_has_default_loop() ) {
|
||||
if ( have_posts() ) :
|
||||
/**
|
||||
* generate_before_loop hook.
|
||||
*
|
||||
* @since 3.1.0
|
||||
*/
|
||||
do_action( 'generate_before_loop', 'search' );
|
||||
|
||||
while ( have_posts() ) :
|
||||
|
||||
the_post();
|
||||
|
||||
generate_do_template_part( 'search' );
|
||||
|
||||
endwhile;
|
||||
|
||||
/**
|
||||
* generate_after_loop hook.
|
||||
*
|
||||
* @since 2.3
|
||||
*/
|
||||
do_action( 'generate_after_loop', 'search' );
|
||||
|
||||
else :
|
||||
|
||||
generate_do_template_part( 'none' );
|
||||
|
||||
endif;
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_main_content' );
|
||||
?>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_primary_content_area hook.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
do_action( 'generate_after_primary_content_area' );
|
||||
|
||||
generate_construct_sidebars();
|
||||
|
||||
get_footer();
|
||||
|
@ -1,34 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* The Sidebar containing the main widget areas.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
<div id="left-sidebar" <?php generate_do_element_classes( 'left_sidebar' ); ?>>
|
||||
<div class="inside-left-sidebar">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_left_sidebar_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_left_sidebar_content' );
|
||||
|
||||
if ( ! dynamic_sidebar( 'sidebar-2' ) ) {
|
||||
generate_do_default_sidebar_widgets( 'left-sidebar' );
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_left_sidebar_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_left_sidebar_content' );
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
/**
|
||||
* The Sidebar containing the main widget areas.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
<div <?php generate_do_attr( 'left-sidebar' ); ?>>
|
||||
<div class="inside-left-sidebar">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_left_sidebar_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_left_sidebar_content' );
|
||||
|
||||
if ( ! dynamic_sidebar( 'sidebar-2' ) ) {
|
||||
generate_do_default_sidebar_widgets( 'left-sidebar' );
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_left_sidebar_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_left_sidebar_content' );
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,34 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* The Sidebar containing the main widget areas.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
<div id="right-sidebar" <?php generate_do_element_classes( 'right_sidebar' ); ?>>
|
||||
<div class="inside-right-sidebar">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_right_sidebar_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_right_sidebar_content' );
|
||||
|
||||
if ( ! dynamic_sidebar( 'sidebar-1' ) ) {
|
||||
generate_do_default_sidebar_widgets( 'right-sidebar' );
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_right_sidebar_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_right_sidebar_content' );
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
/**
|
||||
* The Sidebar containing the main widget areas.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
<div <?php generate_do_attr( 'right-sidebar' ); ?>>
|
||||
<div class="inside-right-sidebar">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_right_sidebar_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_right_sidebar_content' );
|
||||
|
||||
if ( ! dynamic_sidebar( 'sidebar-1' ) ) {
|
||||
generate_do_default_sidebar_widgets( 'right-sidebar' );
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_right_sidebar_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_right_sidebar_content' );
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,54 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* The Template for displaying all single posts.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
get_header(); ?>
|
||||
|
||||
<div id="primary" <?php generate_do_element_classes( 'content' ); ?>>
|
||||
<main id="main" <?php generate_do_element_classes( 'main' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_main_content' );
|
||||
|
||||
if ( generate_has_default_loop() ) {
|
||||
while ( have_posts() ) :
|
||||
|
||||
the_post();
|
||||
|
||||
generate_do_template_part( 'single' );
|
||||
|
||||
endwhile;
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_main_content' );
|
||||
?>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_primary_content_area hook.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
do_action( 'generate_after_primary_content_area' );
|
||||
|
||||
generate_construct_sidebars();
|
||||
|
||||
get_footer();
|
||||
<?php
|
||||
/**
|
||||
* The Template for displaying all single posts.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
get_header(); ?>
|
||||
|
||||
<div <?php generate_do_attr( 'content' ); ?>>
|
||||
<main <?php generate_do_attr( 'main' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_before_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_before_main_content' );
|
||||
|
||||
if ( generate_has_default_loop() ) {
|
||||
while ( have_posts() ) :
|
||||
|
||||
the_post();
|
||||
|
||||
generate_do_template_part( 'single' );
|
||||
|
||||
endwhile;
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_main_content hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_after_main_content' );
|
||||
?>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* generate_after_primary_content_area hook.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
do_action( 'generate_after_primary_content_area' );
|
||||
|
||||
generate_construct_sidebars();
|
||||
|
||||
get_footer();
|
||||
|
@ -1,22 +1,22 @@
|
||||
/*
|
||||
Theme Name: GeneratePress
|
||||
Theme URI: https://generatepress.com
|
||||
Author: Tom Usborne
|
||||
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
|
||||
Version: 3.0.4
|
||||
Requires at least: 4.5.0
|
||||
Tested up to: 5.8
|
||||
Requires PHP: 5.4.0
|
||||
License: GNU General Public License v2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
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
|
||||
|
||||
GeneratePress, Copyright 2014-2021 EDGE22 Studios LTD.
|
||||
GeneratePress is distributed under the terms of the GNU GPL
|
||||
|
||||
GeneratePress is based on Underscores http://underscores.me/, (C) 2012-2021 Automattic, Inc.
|
||||
|
||||
Actual CSS can be found in /assets/css/ folder.
|
||||
*/
|
||||
/*
|
||||
Theme Name: GeneratePress
|
||||
Theme URI: https://generatepress.com
|
||||
Author: Tom Usborne
|
||||
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 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 60+ color controls, powerful dynamic typography, 5 navigation locations, 5 sidebar layouts, dropdown menus (click or hover), and 9 widget areas. Learn more and check out our powerful premium version at https://generatepress.com
|
||||
Version: 3.1.0
|
||||
Requires at least: 5.2
|
||||
Tested up to: 5.8
|
||||
Requires PHP: 5.6
|
||||
License: GNU General Public License v2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
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
|
||||
|
||||
GeneratePress, Copyright 2014-2021 EDGE22 Studios LTD.
|
||||
GeneratePress is distributed under the terms of the GNU GPL
|
||||
|
||||
GeneratePress is based on Underscores http://underscores.me/, (C) 2012-2021 Automattic, Inc.
|
||||
|
||||
Actual CSS can be found in /assets/css/ folder.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user