updated theme `GeneratePress` version 3.0.2

This commit is contained in:
KawaiiPunk 2020-10-20 15:16:18 +00:00 committed by Gitium
parent dcc1a6ca18
commit 1047e0b29f
129 changed files with 16624 additions and 8924 deletions

View File

@ -20,56 +20,9 @@ get_header(); ?>
* @since 0.1
*/
do_action( 'generate_before_main_content' );
?>
<div class="inside-article">
generate_do_template_part( '404' );
<?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" itemprop="headline"><?php echo apply_filters( 'generate_404_title', __( 'Oops! That page can&rsquo;t be found.', 'generatepress' ) ); // WPCS: XSS OK. ?></h1>
</header><!-- .entry-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" itemprop="text">
<?php
echo '<p>' . apply_filters( 'generate_404_text', __( 'It looks like nothing was found at this location. Maybe try searching?', 'generatepress' ) ) . '</p>'; // WPCS: XSS OK.
get_search_form();
?>
</div><!-- .entry-content -->
<?php
/**
* generate_after_content hook.
*
* @since 0.1
*/
do_action( 'generate_after_content' );
?>
</div><!-- .inside-article -->
<?php
/**
* generate_after_main_content hook.
*
@ -77,8 +30,8 @@ get_header(); ?>
*/
do_action( 'generate_after_main_content' );
?>
</main><!-- #main -->
</div><!-- #primary -->
</main>
</div>
<?php
/**
@ -90,4 +43,4 @@ get_header(); ?>
generate_construct_sidebars();
get_footer();
get_footer();

View File

@ -21,42 +21,39 @@ get_header(); ?>
*/
do_action( 'generate_before_main_content' );
if ( have_posts() ) :
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();
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
/**
* generate_archive_title hook.
*
* @since 0.1
*
* @hooked generate_archive_title - 10
*/
get_template_part( 'content', get_post_format() );
do_action( 'generate_archive_title' );
endwhile;
while ( have_posts() ) :
/**
* generate_after_loop hook.
*
* @since 2.3
*/
do_action( 'generate_after_loop' );
the_post();
generate_content_nav( 'nav-below' );
generate_do_template_part( 'archive' );
else :
endwhile;
get_template_part( 'no-results', 'archive' );
/**
* generate_after_loop hook.
*
* @since 2.3
*/
do_action( 'generate_after_loop', 'archive' );
endif;
else :
generate_do_template_part( 'none' );
endif;
}
/**
* generate_after_main_content hook.
@ -65,8 +62,8 @@ get_header(); ?>
*/
do_action( 'generate_after_main_content' );
?>
</main><!-- #main -->
</div><!-- #primary -->
</main>
</div>
<?php
/**
@ -78,4 +75,4 @@ get_header(); ?>
generate_construct_sidebars();
get_footer();
get_footer();

View File

@ -78,3 +78,21 @@
margin: 0;
border: 0;
}
.edit-post-meta-boxes-area.is-side .generate-meta-box-content > div {
display: block !important;
}
.edit-post-meta-boxes-area.is-side .generate-meta-box-menu {
display: none;
}
#generate-meta-box-container label {
display: none;
}
.edit-post-meta-boxes-area.is-side #generate-meta-box-container label.generate-layout-metabox-section-title {
display: block;
font-weight: 500;
margin-bottom: 5px;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,125 @@
.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;
}

View File

@ -0,0 +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}

View File

@ -6,8 +6,8 @@
* -------------------------- */
@font-face {
font-family: 'FontAwesome';
src: url('../fonts/fontawesome-webfont.eot');
src: url('../fonts/fontawesome-webfont.eot?#iefix') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff2') format('woff2'), url('../fonts/fontawesome-webfont.woff') format('woff'), url('../fonts/fontawesome-webfont.ttf') format('truetype'), url('../fonts/fontawesome-webfont.svg#fontawesomeregular') format('svg');
src: url('../../fonts/fontawesome-webfont.eot');
src: url('../../fonts/fontawesome-webfont.eot?#iefix') format('embedded-opentype'), url('../../fonts/fontawesome-webfont.woff2') format('woff2'), url('../../fonts/fontawesome-webfont.woff') format('woff'), url('../../fonts/fontawesome-webfont.ttf') format('truetype'), url('../../fonts/fontawesome-webfont.svg#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal;
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,162 @@
@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;
}

View File

@ -0,0 +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}

View File

@ -0,0 +1,256 @@
/*--------------------------------------------------------------
## Footer Widgets
--------------------------------------------------------------*/
.footer-widgets-container {
padding: 40px;
}
.inside-footer-widgets {
display: flex;
}
.inside-footer-widgets > div {
flex: 1 1 0;
}
.site-footer .footer-widgets-container .inner-padding {
padding: 0px 0px 0px 40px;
}
.site-footer .footer-widgets-container .inside-footer-widgets {
margin-left: -40px;
}
/*--------------------------------------------------------------
## Top Bar
--------------------------------------------------------------*/
.top-bar {
font-weight: normal;
text-transform: none;
font-size: 13px;
}
.top-bar .inside-top-bar {
display: flex;
align-items: center;
flex-wrap: wrap;
}
.top-bar .inside-top-bar .widget {
padding: 0;
display: inline-block;
margin-bottom: 0;
}
.top-bar .inside-top-bar .textwidget p:last-child {
margin: 0;
}
.top-bar .widget-title {
display: none;
}
.top-bar .widget {
margin: 0 10px;
}
.top-bar .widget_nav_menu > div > ul {
display: flex;
align-items: center;
}
.top-bar .widget_nav_menu li {
margin: 0 10px;
padding: 0;
}
.top-bar .widget_nav_menu li:first-child {
margin-left: 0;
}
.top-bar .widget_nav_menu li:last-child {
margin-right: 0;
}
.top-bar .widget_nav_menu li ul {
display: none;
}
.inside-top-bar {
padding: 10px 40px;
}
div.top-bar .widget {
margin-bottom: 0;
}
.top-bar-align-right .widget {
margin-right: 0;
}
.top-bar-align-right .widget:first-child {
margin-left: auto;
}
.top-bar-align-right .widget:nth-child(even) {
order: -20;
}
.top-bar-align-right .widget:nth-child(2) {
margin-left: 0;
}
.top-bar-align-left .widget {
margin-left: 0;
}
.top-bar-align-left .widget:nth-child(odd) {
order: -20;
}
.top-bar-align-left .widget:nth-child(2) {
margin-left: auto;
}
.top-bar-align-left .widget:last-child {
margin-right: 0;
}
.top-bar-align-center .widget:first-child {
margin-left: auto;
}
.top-bar-align-center .widget:last-child {
margin-right: auto;
}
.top-bar-align-center .widget:not(:first-child):not(:last-child) {
margin: 0 5px;
}
/*--------------------------------------------------------------
## Footer Bar
--------------------------------------------------------------*/
.footer-bar-active .footer-bar .widget {
padding: 0;
}
.footer-bar .widget_nav_menu > div > ul {
display: flex;
align-items: center;
flex-wrap: wrap;
}
.footer-bar .widget_nav_menu li {
margin: 0 10px;
padding: 0;
}
.footer-bar .widget_nav_menu li:first-child {
margin-left: 0;
}
.footer-bar .widget_nav_menu li:last-child {
margin-right: 0;
}
.footer-bar .widget_nav_menu li ul {
display: none;
}
.footer-bar .textwidget p:last-child {
margin: 0;
}
.footer-bar .widget-title {
display: none;
}
.footer-bar-align-right .copyright-bar {
order: -20;
margin-right: auto;
}
.footer-bar-align-left .copyright-bar {
margin-left: auto;
}
.footer-bar-align-center .inside-site-info {
flex-direction: column;
}
.footer-bar-align-center .footer-bar {
margin-bottom: 10px;
}
.site-footer:not(.footer-bar-active) .copyright-bar {
margin: 0 auto;
}
/*--------------------------------------------------------------
## Breakpoint (768px)
--------------------------------------------------------------*/
@media (max-width: 768px) {
/*--------------------------------------------------------------
## Top Bar
--------------------------------------------------------------*/
.top-bar .inside-top-bar {
justify-content: center;
}
.top-bar .inside-top-bar > .widget {
order: 1;
margin: 0 10px;
}
.top-bar .inside-top-bar:first-child {
margin-left: auto;
}
.top-bar .inside-top-bar:last-child {
margin-right: auto;
}
.top-bar .widget_nav_menu li {
padding: 5px 0;
}
.top-bar-align-center {
text-align: center;
}
/*--------------------------------------------------------------
## Footer
--------------------------------------------------------------*/
.inside-footer-widgets {
flex-direction: column;
}
.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;
}
.footer-bar-active .inside-site-info {
flex-direction: column;
}
.footer-bar-active .footer-bar {
margin-bottom: 10px;
}
.footer-bar .widget_nav_menu > div > ul {
justify-content: center;
}
.footer-bar .widget_nav_menu li {
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;
}
.footer-bar-align-left .copyright-bar {
margin-left: 0;
}
.footer-bar-align-right .copyright-bar {
order: unset;
margin-right: 0;
}
}

View File

@ -0,0 +1 @@
.footer-widgets-container{padding:40px}.inside-footer-widgets{display:flex}.inside-footer-widgets>div{flex:1 1 0}.site-footer .footer-widgets-container .inner-padding{padding:0 0 0 40px}.site-footer .footer-widgets-container .inside-footer-widgets{margin-left:-40px}.top-bar{font-weight:400;text-transform:none;font-size:13px}.top-bar .inside-top-bar{display:flex;align-items:center;flex-wrap:wrap}.top-bar .inside-top-bar .widget{padding:0;display:inline-block;margin-bottom:0}.top-bar .inside-top-bar .textwidget p:last-child{margin:0}.top-bar .widget-title{display:none}.top-bar .widget{margin:0 10px}.top-bar .widget_nav_menu>div>ul{display:flex;align-items:center}.top-bar .widget_nav_menu li{margin:0 10px;padding:0}.top-bar .widget_nav_menu li:first-child{margin-left:0}.top-bar .widget_nav_menu li:last-child{margin-right:0}.top-bar .widget_nav_menu li ul{display:none}.inside-top-bar{padding:10px 40px}div.top-bar .widget{margin-bottom:0}.top-bar-align-right .widget{margin-right:0}.top-bar-align-right .widget:first-child{margin-left:auto}.top-bar-align-right .widget:nth-child(even){order:-20}.top-bar-align-right .widget:nth-child(2){margin-left:0}.top-bar-align-left .widget{margin-left:0}.top-bar-align-left .widget:nth-child(odd){order:-20}.top-bar-align-left .widget:nth-child(2){margin-left:auto}.top-bar-align-left .widget:last-child{margin-right:0}.top-bar-align-center .widget:first-child{margin-left:auto}.top-bar-align-center .widget:last-child{margin-right:auto}.top-bar-align-center .widget:not(:first-child):not(:last-child){margin:0 5px}.footer-bar-active .footer-bar .widget{padding:0}.footer-bar .widget_nav_menu>div>ul{display:flex;align-items:center;flex-wrap:wrap}.footer-bar .widget_nav_menu li{margin:0 10px;padding:0}.footer-bar .widget_nav_menu li:first-child{margin-left:0}.footer-bar .widget_nav_menu li:last-child{margin-right:0}.footer-bar .widget_nav_menu li ul{display:none}.footer-bar .textwidget p:last-child{margin:0}.footer-bar .widget-title{display:none}.footer-bar-align-right .copyright-bar{order:-20;margin-right:auto}.footer-bar-align-left .copyright-bar{margin-left:auto}.footer-bar-align-center .inside-site-info{flex-direction:column}.footer-bar-align-center .footer-bar{margin-bottom:10px}.site-footer:not(.footer-bar-active) .copyright-bar{margin:0 auto}@media (max-width:768px){.top-bar .inside-top-bar{justify-content:center}.top-bar .inside-top-bar>.widget{order:1;margin:0 10px}.top-bar .inside-top-bar:first-child{margin-left:auto}.top-bar .inside-top-bar:last-child{margin-right:auto}.top-bar .widget_nav_menu li{padding:5px 0}.top-bar-align-center{text-align:center}.inside-footer-widgets{flex-direction:column}.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}.footer-bar-active .inside-site-info{flex-direction:column}.footer-bar-active .footer-bar{margin-bottom:10px}.footer-bar .widget_nav_menu>div>ul{justify-content:center}.footer-bar .widget_nav_menu li{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}.footer-bar-align-left .copyright-bar{margin-left:0}.footer-bar-align-right .copyright-bar{order:unset;margin-right:0}}

View File

@ -0,0 +1,195 @@
caption,
td,
th {
text-align: right;
}
.header-aligned-right:not([class*="nav-float-"]) .inside-header {
justify-content: flex-start;
}
.header-aligned-left:not([class*="nav-float-"]) .inside-header {
justify-content: flex-end;
}
.header-aligned-right:not([class*="nav-float-"]) .header-widget {
order: 10;
}
.header-aligned-left:not([class*="nav-float-"]) .header-widget {
order: -10;
}
.site-logo + .site-branding {
order: -1;
}
.nav-float-right #site-navigation {
order: -5;
}
.nav-float-right #site-navigation.toggled, .nav-float-right #site-navigation.has-active-search {
order: 10;
}
.nav-float-right .header-widget {
order: -10;
}
.nav-float-left #site-navigation {
order: 5;
}
.nav-float-left .header-widget,
.nav-float-left .mobile-menu-control-wrapper {
order: 10;
}
.mobile-menu-control-wrapper {
margin-right: auto;
margin-left: 0;
}
.nav-align-right .inside-navigation {
justify-content: flex-start;
}
.nav-align-left .inside-navigation {
justify-content: flex-end;
}
.menu-item-has-children .dropdown-menu-toggle {
float: left !important;
}
.main-navigation ul ul {
text-align: right;
}
.sidebar .menu-item-has-children .dropdown-menu-toggle,
nav ul ul .menu-item-has-children .dropdown-menu-toggle {
float: left;
}
.comment-meta .avatar {
float: right;
margin-left: 10px;
}
.page-header .avatar {
float: right;
margin-left: 1.5em;
}
.slideout-navigation .menu-item-has-children .dropdown-menu-toggle {
float: left;
}
.dropdown-click #generate-slideout-menu .slideout-menu .menu-item-has-children > a:first-child,
.slideout-desktop.dropdown-hover #generate-slideout-menu .slideout-menu .menu-item-has-children > a:first-child {
padding-left: 0;
}
.comment .children {
padding-right: 30px;
border-right: 1px solid rgba(0, 0, 0, 0.05);
}
.main-navigation .main-nav ul li.menu-item-has-children > a,
.secondary-navigation .main-nav ul li.menu-item-has-children > a {
padding-left: 0;
}
nav:not(.toggled) ul ul .menu-item-has-children .dropdown-menu-toggle {
padding-left: 15px;
}
nav:not(.toggled) .menu-item-has-children .dropdown-menu-toggle {
padding-right: 10px;
}
.main-navigation {
padding-right: 0;
}
ol,
ul {
margin: 0 3em 1.5em 0;
}
li > ol,
li > ul {
margin-right: 1.5em;
}
.menu-toggle .mobile-menu {
margin-right: 5px;
margin-left: 0;
}
.widget_categories .children {
margin-right: 1.5em;
}
.widget_nav_menu ul ul,
.widget_pages ul ul {
margin-right: 1em;
}
.cat-links:before,
.comments-link:before,
.nav-next .next:before,
.nav-previous .prev:before,
.tags-links:before {
margin-left: 0.6em;
margin-right: 0;
}
.entry-meta .gp-icon {
margin-right: 0;
margin-left: 0.6em;
}
.menu-toggle,
.nav-search-enabled .main-navigation .menu-toggle {
text-align: right;
}
.rtl .navigation-search {
left: auto;
right: -99999px;
}
.rtl .navigation-search.nav-search-active {
right: 0;
}
.main-navigation.toggled .main-nav li {
text-align: right;
}
.left-sidebar .sidebar,
.both-left #left-sidebar,
.both-sidebars #left-sidebar {
order: 10;
}
.both-left #right-sidebar {
order: 5;
}
.both-right #left-sidebar {
order: -5;
}
.both-right #right-sidebar,
.both-sidebars #right-sidebar,
.right-sidebar #right-sidebar {
order: -10;
}
@media (max-width: 768px) {
.site-content .content-area {
order: -20;
}
}

View File

@ -0,0 +1 @@
caption,td,th{text-align:right}.header-aligned-right:not([class*=nav-float-]) .inside-header{justify-content:flex-start}.header-aligned-left:not([class*=nav-float-]) .inside-header{justify-content:flex-end}.header-aligned-right:not([class*=nav-float-]) .header-widget{order:10}.header-aligned-left:not([class*=nav-float-]) .header-widget{order:-10}.site-logo+.site-branding{order:-1}.nav-float-right #site-navigation{order:-5}.nav-float-right #site-navigation.has-active-search,.nav-float-right #site-navigation.toggled{order:10}.nav-float-right .header-widget{order:-10}.nav-float-left #site-navigation{order:5}.nav-float-left .header-widget,.nav-float-left .mobile-menu-control-wrapper{order:10}.mobile-menu-control-wrapper{margin-right:auto;margin-left:0}.nav-align-right .inside-navigation{justify-content:flex-start}.nav-align-left .inside-navigation{justify-content:flex-end}.menu-item-has-children .dropdown-menu-toggle{float:left!important}.main-navigation ul ul{text-align:right}.sidebar .menu-item-has-children .dropdown-menu-toggle,nav ul ul .menu-item-has-children .dropdown-menu-toggle{float:left}.comment-meta .avatar{float:right;margin-left:10px}.page-header .avatar{float:right;margin-left:1.5em}.slideout-navigation .menu-item-has-children .dropdown-menu-toggle{float:left}.dropdown-click #generate-slideout-menu .slideout-menu .menu-item-has-children>a:first-child,.slideout-desktop.dropdown-hover #generate-slideout-menu .slideout-menu .menu-item-has-children>a:first-child{padding-left:0}.comment .children{padding-right:30px;border-right:1px solid rgba(0,0,0,.05)}.main-navigation .main-nav ul li.menu-item-has-children>a,.secondary-navigation .main-nav ul li.menu-item-has-children>a{padding-left:0}nav:not(.toggled) ul ul .menu-item-has-children .dropdown-menu-toggle{padding-left:15px}nav:not(.toggled) .menu-item-has-children .dropdown-menu-toggle{padding-right:10px}.main-navigation{padding-right:0}ol,ul{margin:0 3em 1.5em 0}li>ol,li>ul{margin-right:1.5em}.menu-toggle .mobile-menu{margin-right:5px;margin-left:0}.widget_categories .children{margin-right:1.5em}.widget_nav_menu ul ul,.widget_pages ul ul{margin-right:1em}.cat-links:before,.comments-link:before,.nav-next .next:before,.nav-previous .prev:before,.tags-links:before{margin-left:.6em;margin-right:0}.entry-meta .gp-icon{margin-right:0;margin-left:.6em}.menu-toggle,.nav-search-enabled .main-navigation .menu-toggle{text-align:right}.rtl .navigation-search{left:auto;right:-99999px}.rtl .navigation-search.nav-search-active{right:0}.main-navigation.toggled .main-nav li{text-align:right}.both-left #left-sidebar,.both-sidebars #left-sidebar,.left-sidebar .sidebar{order:10}.both-left #right-sidebar{order:5}.both-right #left-sidebar{order:-5}.both-right #right-sidebar,.both-sidebars #right-sidebar,.right-sidebar #right-sidebar{order:-10}@media (max-width:768px){.site-content .content-area{order:-20}}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,18 +1,21 @@
/*--------------------------------------------------------------
>>> TABLE OF CONTENTS:
----------------------------------------------------------------
# Mobile Menu
# Breakpoint (768px)
# Links
# Top Bar
# Content Area
# Header
# Footer
--------------------------------------------------------------*/
.menu-toggle,
.mobile-bar-items,
.sidebar-nav-mobile {
display: none;
}
/*--------------------------------------------------------------
## Mobile Menu
--------------------------------------------------------------*/
.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;
@ -27,25 +30,12 @@ button.menu-toggle:focus {
background-color: transparent;
}
.menu-toggle:before {
content: "\f0c9";
font-family: GeneratePress;
width: 1.28571429em;
text-align: center;
display: inline-block;
}
.toggled .menu-toggle:before {
content: "\f00d";
}
.menu-toggle .mobile-menu {
padding-left: 3px;
}
.menu-toggle .gp-icon + .mobile-menu {
padding-left: 9px;
padding-left: 9px;
}
.menu-toggle .mobile-menu:empty {
@ -102,23 +92,20 @@ nav.toggled ul ul.sub-menu {
opacity: 1;
display: block;
visibility: visible;
float: none;
}
.main-navigation.toggled .main-nav li {
float: none;
clear: both;
display: block !important;
text-align: left !important;
display: block;
text-align: left;
}
.main-navigation.toggled .main-nav li.hide-on-mobile {
display: none !important;
}
.main-navigation.toggled .sfHover > a .dropdown-menu-toggle:before {
content: "\f106";
}
.main-navigation.toggled .menu-item-has-children .dropdown-menu-toggle {
float: right;
}
@ -128,69 +115,60 @@ nav.toggled ul ul.sub-menu {
}
.main-navigation.toggled .sf-menu > li.menu-item-float-right {
float: none !important;
display: inline-block !important;
float: none;
display: inline-block;
}
/*--------------------------------------------------------------
# Breakpoint (768px)
--------------------------------------------------------------*/
@media (max-width: 768px) {
/*--------------------------------------------------------------
## Links
--------------------------------------------------------------*/
a, body, button, input, select, textarea {
-webkit-transition: all 0s ease-in-out;
-moz-transition: all 0s ease-in-out;
-o-transition: all 0s ease-in-out;
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 {
@ -199,24 +177,19 @@ nav.toggled ul ul.sub-menu {
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,
@ -224,7 +197,6 @@ nav.toggled ul ul.sub-menu {
margin-right: 0;
margin-left: 0;
}
.alignleft,
.alignright {
float: none;
@ -232,72 +204,54 @@ nav.toggled ul ul.sub-menu {
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 {
padding-left: 10px;
padding-right: 10px;
}
.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;
}

View File

@ -0,0 +1 @@
.menu-toggle,.mobile-bar-items,.sidebar-nav-mobile{display:none}.menu-toggle{padding:0 20px;line-height:60px;margin:0;font-weight:400;text-transform:none;font-size:15px;cursor:pointer}button.menu-toggle{background-color:transparent;width:100%;border:0;text-align:center}button.menu-toggle:active,button.menu-toggle:focus,button.menu-toggle:hover{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.sfHover>ul,.dropdown-hover .main-navigation.toggled ul li:hover>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}@media (max-width:768px){a,body,button,input,select,textarea{transition:all 0s ease-in-out}.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}.inside-header>:not(:last-child):not(.main-navigation){margin-bottom:20px}.header-aligned-right .site-header,.site-header{text-align:center}.header-widget{float:none;max-width:100%;text-align:center}.content-area,.inside-footer-widgets>div,.sidebar{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-left.separate-containers .inside-left-sidebar,.both-left.separate-containers .inside-right-sidebar,.both-right.separate-containers .inside-left-sidebar,.both-right.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}.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}}

View File

@ -0,0 +1,178 @@
caption,
td,
th {
text-align: right;
}
.menu-item-has-children .dropdown-menu-toggle {
float: left !important;
}
.main-navigation li {
float: right;
text-align: right;
}
.main-navigation li.search-item,
.nav-aligned-right.nav-below-header .main-navigation .menu > li.search-item {
float: left;
}
.nav-left-sidebar .main-navigation li.search-item.current-menu-item,
.nav-right-sidebar .main-navigation li.search-item.current-menu-item {
float: left;
}
.rtl.nav-aligned-left .main-navigation .menu > li {
float: none;
display: inline-block;
}
.rtl.nav-aligned-left .main-navigation ul {
letter-spacing: -0.31em;
font-size: 1em;
}
.rtl.nav-aligned-left .main-navigation ul li {
letter-spacing: normal;
}
.rtl.nav-aligned-left .main-navigation {
text-align: left;
}
.sidebar .menu-item-has-children .dropdown-menu-toggle,
nav ul ul .menu-item-has-children .dropdown-menu-toggle {
float: left;
}
.comment-meta .avatar {
float: right;
margin-left: 10px;
}
.page-header .avatar {
float: right;
margin-left: 1.5em;
}
.header-widget {
float: left;
}
.sf-menu > li.menu-item-float-right {
float: left !important;
}
.slideout-navigation .menu-item-has-children .dropdown-menu-toggle {
float: left;
}
.dropdown-click #generate-slideout-menu .slideout-menu .menu-item-has-children > a:first-child,
.slideout-desktop.dropdown-hover #generate-slideout-menu .slideout-menu .menu-item-has-children > a:first-child {
padding-left: 0;
}
.comment .children {
padding-right: 30px;
border-right: 1px solid rgba(0, 0, 0, 0.05);
}
.main-navigation .main-nav ul li.menu-item-has-children > a,
.secondary-navigation .main-nav ul li.menu-item-has-children > a {
padding-left: 0;
}
nav:not(.toggled) ul ul .menu-item-has-children .dropdown-menu-toggle {
padding-left: 15px;
}
nav:not(.toggled) .menu-item-has-children .dropdown-menu-toggle {
padding-right: 10px;
}
.main-navigation ul,
.menu-toggle li.search-item {
padding-right: 0;
}
ol,
ul {
margin: 0 3em 1.5em 0;
}
li > ol,
li > ul {
margin-right: 1.5em;
}
.menu-toggle .mobile-menu {
margin-right: 5px;
margin-left: 0;
}
.widget_categories .children {
margin-right: 1.5em;
}
.widget_nav_menu ul ul,
.widget_pages ul ul {
margin-right: 1em;
}
.cat-links:before,
.comments-link:before,
.nav-next .next:before,
.nav-previous .prev:before,
.tags-links:before {
margin-left: 0.6em;
margin-right: 0;
}
.menu-toggle,
.nav-search-enabled .main-navigation .menu-toggle {
text-align: right;
}
.main-navigation .mobile-bar-items {
float: left;
left: 0;
right: auto;
}
.rtl .navigation-search {
left: auto;
right: -999999px;
}
.rtl .navigation-search.nav-search-active {
right: 0;
}
.rtl .footer-bar .widget_nav_menu li {
direction: rtl;
float: right;
}
.main-navigation.toggled .main-nav li {
text-align: right !important;
}
.entry-meta .gp-icon {
margin-right: 0;
margin-left: 0.6em;
}
@media (max-width: 768px) {
.rtl .mobile-bar-items {
position: absolute;
left: 0;
top: 0;
}
}
@media (min-width: 768px) {
.inside-footer-widgets > div {
float: right;
}
}

View File

@ -0,0 +1 @@
caption,td,th{text-align:right}.menu-item-has-children .dropdown-menu-toggle{float:left!important}.main-navigation li{float:right;text-align:right}.main-navigation li.search-item,.nav-aligned-right.nav-below-header .main-navigation .menu>li.search-item{float:left}.nav-left-sidebar .main-navigation li.search-item.current-menu-item,.nav-right-sidebar .main-navigation li.search-item.current-menu-item{float:left}.rtl.nav-aligned-left .main-navigation .menu>li{float:none;display:inline-block}.rtl.nav-aligned-left .main-navigation ul{letter-spacing:-.31em;font-size:1em}.rtl.nav-aligned-left .main-navigation ul li{letter-spacing:normal}.rtl.nav-aligned-left .main-navigation{text-align:left}.sidebar .menu-item-has-children .dropdown-menu-toggle,nav ul ul .menu-item-has-children .dropdown-menu-toggle{float:left}.comment-meta .avatar{float:right;margin-left:10px}.page-header .avatar{float:right;margin-left:1.5em}.header-widget{float:left}.sf-menu>li.menu-item-float-right{float:left!important}.slideout-navigation .menu-item-has-children .dropdown-menu-toggle{float:left}.dropdown-click #generate-slideout-menu .slideout-menu .menu-item-has-children>a:first-child,.slideout-desktop.dropdown-hover #generate-slideout-menu .slideout-menu .menu-item-has-children>a:first-child{padding-left:0}.comment .children{padding-right:30px;border-right:1px solid rgba(0,0,0,.05)}.main-navigation .main-nav ul li.menu-item-has-children>a,.secondary-navigation .main-nav ul li.menu-item-has-children>a{padding-left:0}nav:not(.toggled) ul ul .menu-item-has-children .dropdown-menu-toggle{padding-left:15px}nav:not(.toggled) .menu-item-has-children .dropdown-menu-toggle{padding-right:10px}.main-navigation ul,.menu-toggle li.search-item{padding-right:0}ol,ul{margin:0 3em 1.5em 0}li>ol,li>ul{margin-right:1.5em}.menu-toggle .mobile-menu{margin-right:5px;margin-left:0}.widget_categories .children{margin-right:1.5em}.widget_nav_menu ul ul,.widget_pages ul ul{margin-right:1em}.cat-links:before,.comments-link:before,.nav-next .next:before,.nav-previous .prev:before,.tags-links:before{margin-left:.6em;margin-right:0}.menu-toggle,.nav-search-enabled .main-navigation .menu-toggle{text-align:right}.main-navigation .mobile-bar-items{float:left;left:0;right:auto}.rtl .navigation-search{left:auto;right:-999999px}.rtl .navigation-search.nav-search-active{right:0}.rtl .footer-bar .widget_nav_menu li{direction:rtl;float:right}.main-navigation.toggled .main-nav li{text-align:right!important}.entry-meta .gp-icon{margin-right:0;margin-left:.6em}@media (max-width:768px){.rtl .mobile-bar-items{position:absolute;left:0;top:0}}@media (min-width:768px){.inside-footer-widgets>div{float:right}}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -64,8 +64,6 @@
}
.grid-5, .grid-10, .grid-15, .grid-20, .grid-25, .grid-30, .grid-35, .grid-40, .grid-45, .grid-50, .grid-55, .grid-60, .grid-65, .grid-70, .grid-75, .grid-80, .grid-85, .grid-90, .grid-95, .grid-100, .grid-33, .grid-66, [class*="mobile-grid-"], [class*="tablet-grid-"] {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding-left: 10px;
padding-right: 10px;

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 434 KiB

After

Width:  |  Height:  |  Size: 437 KiB

View File

@ -1,20 +1,20 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Generated by IcoMoon</metadata>
<defs>
<font id="GeneratePress" horiz-adv-x="1024">
<font-face units-per-em="1024" ascent="896" descent="-128" />
<missing-glyph horiz-adv-x="1024" />
<glyph unicode="&#x20;" horiz-adv-x="512" d="" />
<glyph unicode="&#xf002;" glyph-name="search" d="M416 800c-176.732 0-320-143.268-320-320s143.268-320 320-320c176.732 0 320 143.268 320 320s-143.268 320-320 320zM0 480c0 229.75 186.25 416 416 416s416-186.25 416-416c0-97.482-33.53-187.132-89.686-258.048l267.652-268.036c18.732-18.758 18.71-49.15-0.050-67.882-18.758-18.732-49.15-18.71-67.882 0.050l-267.558 267.942c-70.982-56.36-160.798-90.026-258.476-90.026-229.75 0-416 186.25-416 416z" />
<glyph unicode="&#xf00d;" glyph-name="times" d="M142.058 753.942c18.746 18.744 49.138 18.744 67.884 0l302.058-302.060 302.058 302.060c18.746 18.744 49.138 18.744 67.884 0 18.744-18.746 18.744-49.138 0-67.884l-302.060-302.058 302.060-302.058c18.744-18.746 18.744-49.138 0-67.884-18.746-18.744-49.138-18.744-67.884 0l-302.058 302.060-302.058-302.060c-18.746-18.744-49.138-18.744-67.884 0-18.744 18.746-18.744 49.138 0 67.884l302.060 302.058-302.060 302.058c-18.744 18.746-18.744 49.138 0 67.884z" />
<glyph unicode="&#xf02c;" glyph-name="tags" d="M40 817c-17.672 0-32-14.326-32-32v-352c0-8.486 3.372-16.626 9.374-22.628l448-448c12.496-12.496 32.756-12.496 45.252 0l352 352c12.488 12.488 12.5 32.728 0.026 45.23l-447 448c-6.002 6.016-14.152 9.398-22.652 9.398h-353zM152 625c0 26.51 21.49 48 48 48s48-21.49 48-48c0-26.51-21.49-48-48-48s-48 21.49-48 48zM519.030 809.97c9.372 9.374 24.568 9.374 33.94 0l456-456c9.372-9.372 9.372-24.568 0-33.94l-360-360c-9.372-9.374-24.568-9.374-33.94 0-9.372 9.372-9.372 24.568 0 33.94l343.028 343.030-439.028 439.030c-9.372 9.372-9.372 24.568 0 33.94z" />
<glyph unicode="&#xf07b;" glyph-name="folder" d="M0 672c0 53.020 42.98 96 96 96h220.028c37.462 0 71.502-21.792 87.184-55.814l24.698-53.582c5.228-11.34 16.574-18.604 29.062-18.604h471.028c53.020 0 96-42.98 96-96v-448c0-53.020-42.98-96-96-96h-832c-53.020 0-96 42.98-96 96v576z" />
<glyph unicode="&#xf086;" glyph-name="comments" d="M265.676 236.054c11.374 5.805 22.622 11.82 33.537 18.008 26.727 15.149 53.176 32.285 74.839 51.015 15.088-1.193 30.54-1.851 46.197-1.851 109.809 0 211.267 30.622 286.571 82.561 47.454 32.73 86.229 75.384 108.309 125.29 109.478-44.412 182.996-126.545 182.996-220.573 0-84.371-59.116-158.995-150.179-205.655 46.921-98.432 150.179-203.418 150.179-203.418s-231.674 76.701-308.848 156.918c-19.911-2.238-40.594-3.515-61.584-3.515-177.454 0-325.855 86.143-362.015 201.221zM766.742 630.996c0-141.206-165.922-255.575-370.433-255.575-20.991 0-41.674 1.278-61.584 3.515-77.174-80.187-308.848-156.859-308.848-156.859s103.258 104.944 150.179 203.341c-91.063 46.641-150.179 121.237-150.179 205.577 0 141.204 165.922 255.573 370.433 255.573s370.433-114.369 370.433-255.573z" />
<glyph unicode="&#xf0c9;" glyph-name="bars" d="M0 704c0 26.51 21.49 48 48 48h928c26.51 0 48-21.49 48-48s-21.49-48-48-48h-928c-26.51 0-48 21.49-48 48zM0 384c0 26.51 21.49 48 48 48h928c26.51 0 48-21.49 48-48s-21.49-48-48-48h-928c-26.51 0-48 21.49-48 48zM0 64c0 26.51 21.49 48 48 48h928c26.51 0 48-21.49 48-48s-21.49-48-48-48h-928c-26.51 0-48 21.49-48 48z" />
<glyph unicode="&#xf104;" glyph-name="angle-left" horiz-adv-x="384" d="M356.85 619.576c0-4.53-2.266-9.627-5.665-13.025l-222.633-222.554 222.633-222.554c3.399-3.398 5.665-8.494 5.665-13.025s-2.266-9.627-5.665-13.025l-28.325-28.315c-3.399-3.398-8.497-5.663-13.029-5.663s-9.63 2.265-13.029 5.663l-263.987 263.893c-3.399 3.398-5.665 8.494-5.665 13.025s2.266 9.627 5.665 13.025l263.987 263.893c3.399 3.398 8.497 5.663 13.029 5.663s9.63-2.265 13.029-5.663l28.325-28.315c3.399-3.398 5.665-7.928 5.665-13.025z" />
<glyph unicode="&#xf105;" glyph-name="angle-right" horiz-adv-x="384" d="M356.85 383.998c0-4.532-2.266-9.63-5.665-13.029l-263.987-263.987c-3.399-3.399-8.497-5.665-13.029-5.665s-9.63 2.266-13.029 5.665l-28.325 28.325c-3.399 3.399-5.665 7.931-5.665 13.029 0 4.532 2.266 9.63 5.665 13.029l222.633 222.633-222.633 222.633c-3.399 3.399-5.665 8.497-5.665 13.029s2.266 9.63 5.665 13.029l28.325 28.325c3.399 3.399 8.497 5.665 13.029 5.665s9.63-2.266 13.029-5.665l263.987-263.987c3.399-3.399 5.665-8.497 5.665-13.029z" />
<glyph unicode="&#xf106;" glyph-name="angle-up" horiz-adv-x="660" d="M611.725 266.169c0-4.532-2.265-9.63-5.663-13.029l-28.315-28.325c-3.398-3.399-7.928-5.665-13.025-5.665-4.53 0-9.627 2.266-13.025 5.665l-222.554 222.633-222.554-222.633c-3.398-3.399-8.494-5.665-13.025-5.665s-9.627 2.266-13.025 5.665l-28.315 28.325c-3.398 3.399-5.663 8.497-5.663 13.029s2.265 9.63 5.663 13.029l263.893 263.987c3.398 3.399 8.494 5.665 13.025 5.665s9.627-2.266 13.025-5.665l263.893-263.987c3.398-3.399 5.663-8.497 5.663-13.029z" />
<glyph unicode="&#xf107;" glyph-name="angle-down" horiz-adv-x="660" d="M611.825 501.831c0-4.532-2.266-9.63-5.665-13.029l-263.987-263.987c-3.399-3.399-8.497-5.665-13.029-5.665s-9.63 2.266-13.029 5.665l-263.987 263.987c-3.399 3.399-5.665 8.497-5.665 13.029s2.266 9.63 5.665 13.029l28.325 28.325c3.399 3.399 7.931 5.665 13.029 5.665 4.532 0 9.63-2.266 13.029-5.665l222.633-222.633 222.633 222.633c3.399 3.399 8.497 5.665 13.029 5.665s9.63-2.266 13.029-5.665l28.325-28.325c3.399-3.399 5.665-8.497 5.665-13.029z" />
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Generated by IcoMoon</metadata>
<defs>
<font id="GeneratePress" horiz-adv-x="1024">
<font-face units-per-em="1024" ascent="896" descent="-128" />
<missing-glyph horiz-adv-x="1024" />
<glyph unicode="&#x20;" horiz-adv-x="512" d="" />
<glyph unicode="&#xf002;" glyph-name="search" d="M416 800c-176.732 0-320-143.268-320-320s143.268-320 320-320c176.732 0 320 143.268 320 320s-143.268 320-320 320zM0 480c0 229.75 186.25 416 416 416s416-186.25 416-416c0-97.482-33.53-187.132-89.686-258.048l267.652-268.036c18.732-18.758 18.71-49.15-0.050-67.882-18.758-18.732-49.15-18.71-67.882 0.050l-267.558 267.942c-70.982-56.36-160.798-90.026-258.476-90.026-229.75 0-416 186.25-416 416z" />
<glyph unicode="&#xf00d;" glyph-name="times" d="M142.058 753.942c18.746 18.744 49.138 18.744 67.884 0l302.058-302.060 302.058 302.060c18.746 18.744 49.138 18.744 67.884 0 18.744-18.746 18.744-49.138 0-67.884l-302.060-302.058 302.060-302.058c18.744-18.746 18.744-49.138 0-67.884-18.746-18.744-49.138-18.744-67.884 0l-302.058 302.060-302.058-302.060c-18.746-18.744-49.138-18.744-67.884 0-18.744 18.746-18.744 49.138 0 67.884l302.060 302.058-302.060 302.058c-18.744 18.746-18.744 49.138 0 67.884z" />
<glyph unicode="&#xf02c;" glyph-name="tags" d="M40 817c-17.672 0-32-14.326-32-32v-352c0-8.486 3.372-16.626 9.374-22.628l448-448c12.496-12.496 32.756-12.496 45.252 0l352 352c12.488 12.488 12.5 32.728 0.026 45.23l-447 448c-6.002 6.016-14.152 9.398-22.652 9.398h-353zM152 625c0 26.51 21.49 48 48 48s48-21.49 48-48c0-26.51-21.49-48-48-48s-48 21.49-48 48zM519.030 809.97c9.372 9.374 24.568 9.374 33.94 0l456-456c9.372-9.372 9.372-24.568 0-33.94l-360-360c-9.372-9.374-24.568-9.374-33.94 0-9.372 9.372-9.372 24.568 0 33.94l343.028 343.030-439.028 439.030c-9.372 9.372-9.372 24.568 0 33.94z" />
<glyph unicode="&#xf07b;" glyph-name="folder" d="M0 672c0 53.020 42.98 96 96 96h220.028c37.462 0 71.502-21.792 87.184-55.814l24.698-53.582c5.228-11.34 16.574-18.604 29.062-18.604h471.028c53.020 0 96-42.98 96-96v-448c0-53.020-42.98-96-96-96h-832c-53.020 0-96 42.98-96 96v576z" />
<glyph unicode="&#xf086;" glyph-name="comments" d="M265.676 236.054c11.374 5.805 22.622 11.82 33.537 18.008 26.727 15.149 53.176 32.285 74.839 51.015 15.088-1.193 30.54-1.851 46.197-1.851 109.809 0 211.267 30.622 286.571 82.561 47.454 32.73 86.229 75.384 108.309 125.29 109.478-44.412 182.996-126.545 182.996-220.573 0-84.371-59.116-158.995-150.179-205.655 46.921-98.432 150.179-203.418 150.179-203.418s-231.674 76.701-308.848 156.918c-19.911-2.238-40.594-3.515-61.584-3.515-177.454 0-325.855 86.143-362.015 201.221zM766.742 630.996c0-141.206-165.922-255.575-370.433-255.575-20.991 0-41.674 1.278-61.584 3.515-77.174-80.187-308.848-156.859-308.848-156.859s103.258 104.944 150.179 203.341c-91.063 46.641-150.179 121.237-150.179 205.577 0 141.204 165.922 255.573 370.433 255.573s370.433-114.369 370.433-255.573z" />
<glyph unicode="&#xf0c9;" glyph-name="bars" d="M0 704c0 26.51 21.49 48 48 48h928c26.51 0 48-21.49 48-48s-21.49-48-48-48h-928c-26.51 0-48 21.49-48 48zM0 384c0 26.51 21.49 48 48 48h928c26.51 0 48-21.49 48-48s-21.49-48-48-48h-928c-26.51 0-48 21.49-48 48zM0 64c0 26.51 21.49 48 48 48h928c26.51 0 48-21.49 48-48s-21.49-48-48-48h-928c-26.51 0-48 21.49-48 48z" />
<glyph unicode="&#xf104;" glyph-name="angle-left" horiz-adv-x="384" d="M356.85 619.576c0-4.53-2.266-9.627-5.665-13.025l-222.633-222.554 222.633-222.554c3.399-3.398 5.665-8.494 5.665-13.025s-2.266-9.627-5.665-13.025l-28.325-28.315c-3.399-3.398-8.497-5.663-13.029-5.663s-9.63 2.265-13.029 5.663l-263.987 263.893c-3.399 3.398-5.665 8.494-5.665 13.025s2.266 9.627 5.665 13.025l263.987 263.893c3.399 3.398 8.497 5.663 13.029 5.663s9.63-2.265 13.029-5.663l28.325-28.315c3.399-3.398 5.665-7.928 5.665-13.025z" />
<glyph unicode="&#xf105;" glyph-name="angle-right" horiz-adv-x="384" d="M356.85 383.998c0-4.532-2.266-9.63-5.665-13.029l-263.987-263.987c-3.399-3.399-8.497-5.665-13.029-5.665s-9.63 2.266-13.029 5.665l-28.325 28.325c-3.399 3.399-5.665 7.931-5.665 13.029 0 4.532 2.266 9.63 5.665 13.029l222.633 222.633-222.633 222.633c-3.399 3.399-5.665 8.497-5.665 13.029s2.266 9.63 5.665 13.029l28.325 28.325c3.399 3.399 8.497 5.665 13.029 5.665s9.63-2.266 13.029-5.665l263.987-263.987c3.399-3.399 5.665-8.497 5.665-13.029z" />
<glyph unicode="&#xf106;" glyph-name="angle-up" horiz-adv-x="660" d="M611.725 266.169c0-4.532-2.265-9.63-5.663-13.029l-28.315-28.325c-3.398-3.399-7.928-5.665-13.025-5.665-4.53 0-9.627 2.266-13.025 5.665l-222.554 222.633-222.554-222.633c-3.398-3.399-8.494-5.665-13.025-5.665s-9.627 2.266-13.025 5.665l-28.315 28.325c-3.398 3.399-5.663 8.497-5.663 13.029s2.265 9.63 5.663 13.029l263.893 263.987c3.398 3.399 8.494 5.665 13.025 5.665s9.627-2.266 13.025-5.665l263.893-263.987c3.398-3.399 5.663-8.497 5.663-13.029z" />
<glyph unicode="&#xf107;" glyph-name="angle-down" horiz-adv-x="660" d="M611.825 501.831c0-4.532-2.266-9.63-5.665-13.029l-263.987-263.987c-3.399-3.399-8.497-5.665-13.029-5.665s-9.63 2.266-13.029 5.665l-263.987 263.987c-3.399 3.399-5.665 8.497-5.665 13.029s2.266 9.63 5.665 13.029l28.325 28.325c3.399 3.399 7.931 5.665 13.029 5.665 4.532 0 9.63-2.266 13.029-5.665l222.633-222.633 222.633 222.633c3.399 3.399 8.497 5.665 13.029 5.665s9.63-2.266 13.029-5.665l28.325-28.325c3.399-3.399 5.665-8.497 5.665-13.029z" />
</font></defs></svg>

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -0,0 +1,127 @@
( 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 );
} );
}
}
} );
}
}
} )();

View File

@ -0,0 +1 @@
!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)})}})}();

View File

@ -5,7 +5,7 @@ jQuery( document ).ready( function( $ ) {
html body.gutenberg-editor-page .editor-block-list__block,\
.edit-post-visual-editor .editor-block-list__block[data-align=wide]';
$( 'input[name="_generate-full-width-content"]' ).on( 'change', function() {
$( 'select[name="_generate-full-width-content"]' ).on( 'change', function() {
if ( 'true' === this.value ) {
$( 'style#container_width' ).remove();
$( 'head' ).append( '<style id="container_width">' + container_width_elements + '{max-width: 100%;}</style>' );
@ -14,8 +14,8 @@ jQuery( document ).ready( function( $ ) {
}
} );
$( 'input[name="_generate-sidebar-layout-meta"]' ).on( 'change', function() {
if ( 'true' !== $( 'input[name="_generate-full-width-content"]:checked' ).val() ) {
$( 'select[name="_generate-sidebar-layout-meta"]' ).on( 'change', function() {
if ( 'true' !== $( this ).val() ) {
var this_value = this.value,
content_width = '',
calc = '',
@ -87,10 +87,11 @@ jQuery( document ).ready( function( $ ) {
}
} );
jQuery( window ).load( function() {
var post_title_block = jQuery( '.editor-post-title__block' );
jQuery( window ).on( 'load', function() {
var post_title_block = jQuery( '.editor-post-title__block' ),
disable_title_option = jQuery( '#meta-generate-disable-headline' );
if ( post_title_block ) {
if ( post_title_block && disable_title_option.length > 0 ) {
post_title_block.append( '<button class="content-title-visibility disable-content-title" title="' + generate_block_editor.disable_content_title + '" aria-hidden="true"></button>' );
post_title_block.append( '<button class="content-title-visibility show-content-title" title="' + generate_block_editor.show_content_title + '" aria-hidden="true"></button>' );
}

View File

@ -41,6 +41,7 @@
var travelled = window.pageYOffset;
if ( travelled <= (endLocation || 0) ) {
clearInterval(runAnimation);
document.activeElement.blur();
}
};

View File

@ -0,0 +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)))}();

View File

@ -0,0 +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)}}();

View File

@ -0,0 +1,430 @@
( 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

View File

@ -0,0 +1,302 @@
( 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 );
}
}
}
})();

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,128 @@
( 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 );
}
}
})();

View File

@ -0,0 +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)}}}();

View File

@ -40,28 +40,37 @@ do_action( 'generate_before_comments' );
*/
do_action( 'generate_inside_comments' );
if ( have_comments() ) : ?>
<h3 class="comments-title">
<?php
$comments_number = get_comments_number();
$comments_title = apply_filters( 'generate_comment_form_title', sprintf( // WPCS: XSS OK.
/* translators: 1: number of comments, 2: post title */
esc_html( _nx(
'%1$s thought on &ldquo;%2$s&rdquo;',
'%1$s thoughts on &ldquo;%2$s&rdquo;',
$comments_number,
'comments title',
'generatepress'
) ),
if ( have_comments() ) :
$comments_number = get_comments_number();
$comments_title = apply_filters(
'generate_comment_form_title',
sprintf(
esc_html(
/* translators: 1: number of comments, 2: post title */
_nx(
'%1$s thought on &ldquo;%2$s&rdquo;',
'%1$s thoughts on &ldquo;%2$s&rdquo;',
$comments_number,
'comments title',
'generatepress'
)
),
number_format_i18n( $comments_number ),
get_the_title()
) );
)
);
echo esc_html( $comments_title );
?>
</h3>
// phpcs:ignore -- Title escaped in output.
echo apply_filters(
'generate_comments_title_output',
sprintf(
'<h3 class="comments-title">%s</h3>',
esc_html( $comments_title )
),
$comments_title,
$comments_number
);
<?php
/**
* generate_below_comments_title hook.
*
@ -69,7 +78,8 @@ do_action( 'generate_before_comments' );
*/
do_action( 'generate_below_comments_title' );
if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) :
?>
<nav id="comment-nav-above" class="comment-navigation" role="navigation">
<h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'generatepress' ); ?></h2>
<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'generatepress' ) ); ?></div>
@ -86,26 +96,33 @@ do_action( 'generate_before_comments' );
* define generate_comment() and that will be used instead.
* See generate_comment() in inc/template-tags.php for more.
*/
wp_list_comments( array(
'callback' => 'generate_comment',
) );
wp_list_comments(
array(
'callback' => 'generate_comment',
)
);
?>
</ol><!-- .comment-list -->
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
<?php
if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) :
?>
<nav id="comment-nav-below" class="comment-navigation" role="navigation">
<h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'generatepress' ); ?></h2>
<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'generatepress' ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'generatepress' ) ); ?></div>
</nav><!-- #comment-nav-below -->
<?php endif;
<?php
endif;
endif;
// If comments are closed and there are comments, let's leave a little note, shall we?
if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
<p class="no-comments"><?php _e( 'Comments are closed.', 'generatepress' ); // WPCS: XSS OK. ?></p>
<?php endif;
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
?>
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'generatepress' ); ?></p>
<?php
endif;
comment_form();
?>

View File

@ -0,0 +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&rsquo;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>

View File

@ -9,7 +9,6 @@ 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
@ -21,31 +20,37 @@ if ( ! defined( 'ABSPATH' ) ) {
* @hooked generate_featured_page_header_inside_single - 10
*/
do_action( 'generate_before_content' );
?>
<header class="entry-header">
<?php
/**
* generate_before_entry_title hook.
*
* @since 0.1
*/
do_action( 'generate_before_entry_title' );
the_title( sprintf( '<h2 class="entry-title" itemprop="headline"><a href="%s" rel="bookmark">', esc_url( generate_get_link_url() ) ), '</a></h2>' );
/**
* generate_after_entry_title hook.
*
* @since 0.1
*
* @hooked generate_post_meta - 10
*/
do_action( 'generate_after_entry_title' );
if ( generate_show_entry_header() ) :
?>
</header><!-- .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;
<?php
/**
* generate_after_entry_header hook.
*
@ -55,26 +60,36 @@ if ( ! defined( 'ABSPATH' ) ) {
*/
do_action( 'generate_after_entry_header' );
if ( generate_show_excerpt() ) : ?>
$itemprop = '';
<div class="entry-summary" itemprop="text">
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><!-- .entry-summary -->
</div>
<?php else : ?>
<div class="entry-content" 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>',
) );
wp_link_pages(
array(
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
'after' => '</div>',
)
);
?>
</div><!-- .entry-content -->
</div>
<?php endif;
<?php
endif;
/**
* generate_after_entry_content hook.
@ -92,5 +107,5 @@ if ( ! defined( 'ABSPATH' ) ) {
*/
do_action( 'generate_after_content' );
?>
</div><!-- .inside-article -->
</article><!-- #post-## -->
</div>
</article>

View File

@ -22,7 +22,8 @@ if ( ! defined( 'ABSPATH' ) ) {
*/
do_action( 'generate_before_content' );
if ( generate_show_title() ) : ?>
if ( generate_show_entry_header() ) :
?>
<header class="entry-header">
<?php
@ -33,7 +34,11 @@ if ( ! defined( 'ABSPATH' ) ) {
*/
do_action( 'generate_before_page_title' );
the_title( '<h1 class="entry-title" itemprop="headline">', '</h1>' );
if ( generate_show_title() ) {
$params = generate_get_the_title_parameters();
the_title( $params['before'], $params['after'] );
}
/**
* generate_after_page_title hook.
@ -42,9 +47,10 @@ if ( ! defined( 'ABSPATH' ) ) {
*/
do_action( 'generate_after_page_title' );
?>
</header><!-- .entry-header -->
</header>
<?php endif;
<?php
endif;
/**
* generate_after_entry_header hook.
@ -54,18 +60,26 @@ if ( ! defined( 'ABSPATH' ) ) {
* @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" 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>',
) );
wp_link_pages(
array(
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
'after' => '</div>',
)
);
?>
</div><!-- .entry-content -->
</div>
<?php
/**
@ -75,5 +89,5 @@ if ( ! defined( 'ABSPATH' ) ) {
*/
do_action( 'generate_after_content' );
?>
</div><!-- .inside-article -->
</article><!-- #post-## -->
</div>
</article>

View File

@ -21,33 +21,37 @@ if ( ! defined( 'ABSPATH' ) ) {
* @hooked generate_featured_page_header_inside_single - 10
*/
do_action( 'generate_before_content' );
?>
<header class="entry-header">
<?php
/**
* generate_before_entry_title hook.
*
* @since 0.1
*/
do_action( 'generate_before_entry_title' );
if ( generate_show_title() ) {
the_title( '<h1 class="entry-title" itemprop="headline">', '</h1>' );
}
/**
* generate_after_entry_title hook.
*
* @since 0.1
*
* @hooked generate_post_meta - 10
*/
do_action( 'generate_after_entry_title' );
if ( generate_show_entry_header() ) :
?>
</header><!-- .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;
<?php
/**
* generate_after_entry_header hook.
*
@ -56,18 +60,26 @@ if ( ! defined( 'ABSPATH' ) ) {
* @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" 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>',
) );
wp_link_pages(
array(
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
'after' => '</div>',
)
);
?>
</div><!-- .entry-content -->
</div>
<?php
/**
@ -86,5 +98,5 @@ if ( ! defined( 'ABSPATH' ) ) {
*/
do_action( 'generate_after_content' );
?>
</div><!-- .inside-article -->
</article><!-- #post-## -->
</div>
</article>

View File

@ -20,31 +20,37 @@ if ( ! defined( 'ABSPATH' ) ) {
* @hooked generate_featured_page_header_inside_single - 10
*/
do_action( 'generate_before_content' );
?>
<header class="entry-header">
<?php
/**
* generate_before_entry_title hook.
*
* @since 0.1
*/
do_action( 'generate_before_entry_title' );
the_title( sprintf( '<h2 class="entry-title" itemprop="headline"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' );
/**
* generate_after_entry_title hook.
*
* @since 0.1
*
* @hooked generate_post_meta - 10
*/
do_action( 'generate_after_entry_title' );
if ( generate_show_entry_header() ) :
?>
</header><!-- .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;
<?php
/**
* generate_after_entry_header hook.
*
@ -54,26 +60,36 @@ if ( ! defined( 'ABSPATH' ) ) {
*/
do_action( 'generate_after_entry_header' );
if ( generate_show_excerpt() ) : ?>
$itemprop = '';
<div class="entry-summary" itemprop="text">
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><!-- .entry-summary -->
</div>
<?php else : ?>
<div class="entry-content" 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>',
) );
wp_link_pages(
array(
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
'after' => '</div>',
)
);
?>
</div><!-- .entry-content -->
</div>
<?php endif;
<?php
endif;
/**
* generate_after_entry_content hook.
@ -91,5 +107,5 @@ if ( ! defined( 'ABSPATH' ) ) {
*/
do_action( 'generate_after_content' );
?>
</div><!-- .inside-article -->
</article><!-- #post-## -->
</div>
</article>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
button.menu-toggle{background-color:transparent;width:100%;border:0;text-align:center}button.menu-toggle:active,button.menu-toggle:focus,button.menu-toggle:hover{background-color:transparent}.menu-toggle:before{content:"\f0c9";font-family:GeneratePress;width:1.28571429em;text-align:center;display:inline-block}.toggled .menu-toggle:before{content:"\f00d"}.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.sfHover>ul,.dropdown-hover .main-navigation.toggled ul li:hover>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}.main-navigation.toggled .main-nav li{float:none;clear:both;display:block!important;text-align:left!important}.main-navigation.toggled .main-nav li.hide-on-mobile,.main-navigation.toggled .menu li.search-item{display:none!important}.main-navigation.toggled .sfHover>a .dropdown-menu-toggle:before{content:"\f106"}.main-navigation.toggled .menu-item-has-children .dropdown-menu-toggle{float:right}.main-navigation.toggled .sf-menu>li.menu-item-float-right{float:none!important;display:inline-block!important}@media (max-width:768px){a,body,button,input,select,textarea{-webkit-transition:all 0s ease-in-out;-moz-transition:all 0s ease-in-out;-o-transition:all 0s ease-in-out;transition:all 0s ease-in-out}.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}.footer-bar .widget_nav_menu li,.top-bar .widget_nav_menu li{float:none;display:inline-block;padding:5px 0}.inside-header>:not(:last-child):not(.main-navigation){margin-bottom:20px}.header-aligned-right .site-header,.header-widget,.site-header{text-align:center}.header-widget{float:none;max-width:100%}.content-area,.inside-footer-widgets>div,.sidebar{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-left.separate-containers .inside-left-sidebar,.both-left.separate-containers .inside-right-sidebar,.both-right.separate-containers .inside-left-sidebar,.both-right.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}.site-info{padding-left:10px;padding-right:10px;text-align:center}.copyright-bar,.footer-bar{float:none!important;text-align:center!important}.footer-bar{margin-bottom:20px}.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}}

View File

@ -1,567 +0,0 @@
.grid-container:before, .grid-15:before, .grid-20:before, .grid-25:before, .grid-30:before, .grid-35:before, .grid-40:before, .grid-45:before, .grid-50:before, .grid-55:before, .grid-60:before, .grid-65:before, .grid-70:before, .grid-75:before, .grid-80:before, .grid-85:before, .grid-100:before, .grid-33:before, .grid-66:before, [class*="mobile-grid-"]:before,[class*="tablet-grid-"]:before, .clearfix:before,
.grid-container:after,
.grid-15:after,
.grid-20:after,
.grid-25:after,
.grid-30:after,
.grid-35:after,
.grid-40:after,
.grid-45:after,
.grid-50:after,
.grid-55:after,
.grid-60:after,
.grid-65:after,
.grid-70:after,
.grid-75:after,
.grid-80:after,
.grid-85:after,
.grid-100:after,
.grid-33:after,
.grid-66:after,
[class*="mobile-grid-"]:after,
[class*="tablet-grid-"]:after,
.clearfix:after {
content: ".";
display: block;
overflow: hidden;
visibility: hidden;
font-size: 0;
line-height: 0;
width: 0;
height: 0;
}
.grid-container:after, .grid-15:after, .grid-20:after, .grid-25:after, .grid-30:after, .grid-35:after, .grid-40:after, .grid-45:after, .grid-50:after, .grid-55:after, .grid-60:after, .grid-65:after, .grid-70:after, .grid-75:after, .grid-80:after, .grid-85:after, .grid-90:after, .grid-95:after, .grid-100:after, .grid-33:after, .grid-66:after, [class*="mobile-grid-"]:after, [class*="tablet-grid-"]:after, .clearfix:after {
clear: both;
}
.grid-container {
margin-left: auto;
margin-right: auto;
max-width: 1200px;
padding-left: 10px;
padding-right: 10px;
}
.grid-15, .grid-20, .grid-25, .grid-30, .grid-35, .grid-40, .grid-45, .grid-50, .grid-55, .grid-60, .grid-65, .grid-70, .grid-75, .grid-80, .grid-85, .grid-90, .grid-95, .grid-100, .grid-33, .grid-66, [class*="mobile-grid-"], [class*="tablet-grid-"] {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding-left: 10px;
padding-right: 10px;
}
.grid-parent {
padding-left: 0;
padding-right: 0;
}
@media (max-width: 767px) {
.hide-on-mobile {
display: none !important;
}
.mobile-grid-50 {
float: left;
width: 50%;
}
.mobile-grid-100 {
clear: both;
width: 100%;
}
}
@media (min-width: 768px) and (max-width: 1024px) {
[class*="tablet-push-"],
[class*="tablet-pull-"] {
position: relative;
}
.hide-on-tablet {
display: none !important;
}
.tablet-grid-15 {
float: left;
width: 15%;
}
.tablet-push-15 {
left: 15%;
}
.tablet-pull-15 {
left: -15%;
}
.tablet-grid-20 {
float: left;
width: 20%;
}
.tablet-push-20 {
left: 20%;
}
.tablet-pull-20 {
left: -20%;
}
.tablet-grid-25 {
float: left;
width: 25%;
}
.tablet-push-25 {
left: 25%;
}
.tablet-pull-25 {
left: -25%;
}
.tablet-grid-30 {
float: left;
width: 30%;
}
.tablet-push-30 {
left: 30%;
}
.tablet-pull-30 {
left: -30%;
}
.tablet-grid-35 {
float: left;
width: 35%;
}
.tablet-push-35 {
left: 35%;
}
.tablet-pull-35 {
left: -35%;
}
.tablet-grid-40 {
float: left;
width: 40%;
}
.tablet-push-40 {
left: 40%;
}
.tablet-pull-40 {
left: -40%;
}
.tablet-grid-45 {
float: left;
width: 45%;
}
.tablet-push-45 {
left: 45%;
}
.tablet-pull-45 {
left: -45%;
}
.tablet-grid-50 {
float: left;
width: 50%;
}
.tablet-push-50 {
left: 50%;
}
.tablet-pull-50 {
left: -50%;
}
.tablet-grid-55 {
float: left;
width: 55%;
}
.tablet-push-55 {
left: 55%;
}
.tablet-pull-55 {
left: -55%;
}
.tablet-grid-60 {
float: left;
width: 60%;
}
.tablet-push-60 {
left: 60%;
}
.tablet-pull-60 {
left: -60%;
}
.tablet-grid-65 {
float: left;
width: 65%;
}
.tablet-push-65 {
left: 65%;
}
.tablet-pull-65 {
left: -65%;
}
.tablet-grid-70 {
float: left;
width: 70%;
}
.tablet-push-70 {
left: 70%;
}
.tablet-pull-70 {
left: -70%;
}
.tablet-grid-75 {
float: left;
width: 75%;
}
.tablet-push-75 {
left: 75%;
}
.tablet-pull-75 {
left: -75%;
}
.tablet-grid-80 {
float: left;
width: 80%;
}
.tablet-push-80 {
left: 80%;
}
.tablet-pull-80 {
left: -80%;
}
.tablet-grid-85 {
float: left;
width: 85%;
}
.tablet-push-85 {
left: 85%;
}
.tablet-pull-85 {
left: -85%;
}
.tablet-suffix-33 {
margin-right: 33.33333%;
}
.tablet-push-33 {
left: 33.33333%;
}
.tablet-pull-33 {
left: -33.33333%;
}
.tablet-grid-66 {
float: left;
width: 66.66667%;
}
.tablet-push-66 {
left: 66.66667%;
}
.tablet-pull-66 {
left: -66.66667%;
}
.tablet-grid-100 {
clear: both;
width: 100%;
}
/* GP specific grid */
.inside-footer-widgets > div {
margin-bottom: 50px;
}
.inside-footer-widgets > div:nth-child(odd) {
clear: both;
}
.active-footer-widgets-1 .footer-widget-1,
.active-footer-widgets-3 .footer-widget-3,
.active-footer-widgets-5 .footer-widget-5 {
width: 100%;
margin-bottom: 0;
}
.active-footer-widgets-2 .inside-footer-widgets > div,
.active-footer-widgets-4 .footer-widget-3,
.active-footer-widgets-4 .footer-widget-4 {
margin-bottom: 0;
}
}
@media (min-width: 1025px) {
.push-15, .pull-15, .push-20, .pull-20, .push-25, .pull-25, .push-30, .pull-30, .push-35, .pull-35, .push-40, .pull-40, .push-45, .pull-45, .push-50, .pull-50, .push-55, .pull-55, .push-60, .pull-60, .push-65, .pull-65, .push-70, .pull-70, .push-75, .pull-75, .push-80, .pull-80, .push-85, .pull-85, .push-90, .pull-90, .push-95, .pull-95, .push-33, .pull-33, .push-66, .pull-66 {
position: relative;
}
.hide-on-desktop {
display: none !important;
}
.grid-15 {
float: left;
width: 15%;
}
.push-15 {
left: 15%;
}
.pull-15 {
left: -15%;
}
.grid-20 {
float: left;
width: 20%;
}
.push-20 {
left: 20%;
}
.pull-20 {
left: -20%;
}
.grid-25 {
float: left;
width: 25%;
}
.push-25 {
left: 25%;
}
.pull-25 {
left: -25%;
}
.grid-30 {
float: left;
width: 30%;
}
.push-30 {
left: 30%;
}
.pull-30 {
left: -30%;
}
.grid-35 {
float: left;
width: 35%;
}
.push-35 {
left: 35%;
}
.pull-35 {
left: -35%;
}
.grid-40 {
float: left;
width: 40%;
}
.push-40 {
left: 40%;
}
.pull-40 {
left: -40%;
}
.grid-45 {
float: left;
width: 45%;
}
.push-45 {
left: 45%;
}
.pull-45 {
left: -45%;
}
.grid-50 {
float: left;
width: 50%;
}
.push-50 {
left: 50%;
}
.pull-50 {
left: -50%;
}
.grid-55 {
float: left;
width: 55%;
}
.push-55 {
left: 55%;
}
.pull-55 {
left: -55%;
}
.grid-60 {
float: left;
width: 60%;
}
.push-60 {
left: 60%;
}
.pull-60 {
left: -60%;
}
.grid-65 {
float: left;
width: 65%;
}
.push-65 {
left: 65%;
}
.pull-65 {
left: -65%;
}
.grid-70 {
float: left;
width: 70%;
}
.push-70 {
left: 70%;
}
.pull-70 {
left: -70%;
}
.grid-75 {
float: left;
width: 75%;
}
.push-75 {
left: 75%;
}
.pull-75 {
left: -75%;
}
.grid-80 {
float: left;
width: 80%;
}
.push-80 {
left: 80%;
}
.pull-80 {
left: -80%;
}
.grid-85 {
float: left;
width: 85%;
}
.push-85 {
left: 85%;
}
.pull-85 {
left: -85%;
}
.grid-33 {
float: left;
width: 33.33333%;
}
.push-33 {
left: 33.33333%;
}
.pull-33 {
left: -33.33333%;
}
.grid-66 {
float: left;
width: 66.66667%;
}
.push-66 {
left: 66.66667%;
}
.pull-66 {
left: -66.66667%;
}
.grid-100 {
clear: both;
width: 100%;
}
}

File diff suppressed because one or more lines are too long

View File

@ -10,8 +10,8 @@ if ( ! defined( 'ABSPATH' ) ) {
}
?>
</div><!-- #content -->
</div><!-- #page -->
</div>
</div>
<?php
/**
@ -48,7 +48,7 @@ do_action( 'generate_before_footer' );
*/
do_action( 'generate_after_footer_content' );
?>
</div><!-- .site-footer -->
</div>
<?php
/**

View File

@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
// Set our theme version.
define( 'GENERATE_VERSION', '2.4.2' );
define( 'GENERATE_VERSION', '3.0.2' );
if ( ! function_exists( 'generate_setup' ) ) {
add_action( 'after_setup_theme', 'generate_setup' );
@ -31,22 +31,27 @@ if ( ! function_exists( 'generate_setup' ) ) {
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' ) );
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,
) );
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' ),
) );
register_nav_menus(
array(
'primary' => __( 'Primary Menu', 'generatepress' ),
)
);
/**
* Set the content width to something large
@ -58,7 +63,7 @@ if ( ! function_exists( 'generate_setup' ) ) {
}
// This theme styles the visual editor to resemble the theme style.
add_editor_style( 'css/admin/editor-style.css' );
add_editor_style( 'assets/css/admin/editor-style.css' );
}
}
@ -77,7 +82,7 @@ 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/migrate.php';
require $theme_dir . '/inc/class-theme-update.php';
require $theme_dir . '/inc/deprecated.php';
if ( is_admin() ) {

View File

@ -24,7 +24,7 @@ if ( ! defined( 'ABSPATH' ) ) {
*
* @since 2.3
*/
do_action( 'wp_body_open' );
do_action( 'wp_body_open' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- core WP hook.
/**
* generate_before_header hook.
@ -56,7 +56,7 @@ if ( ! defined( 'ABSPATH' ) ) {
do_action( 'generate_after_header' );
?>
<div id="page" class="hfeed site grid-container container grid-parent">
<div id="page" <?php generate_do_element_classes( 'page' ); ?>>
<?php
/**
* generate_inside_site_container hook.

View File

@ -79,11 +79,11 @@ function generate_get_block_editor_content_width() {
$layout = generate_get_block_editor_sidebar_layout();
if ( 'left-sidebar' == $layout ) {
if ( 'left-sidebar' === $layout ) {
$content_width = $container_width * ( ( 100 - $left_sidebar_width ) / 100 );
} elseif ( 'right-sidebar' == $layout ) {
} elseif ( 'right-sidebar' === $layout ) {
$content_width = $container_width * ( ( 100 - $right_sidebar_width ) / 100 );
} elseif ( 'no-sidebar' == $layout ) {
} elseif ( 'no-sidebar' === $layout ) {
$content_width = $container_width;
} else {
$content_width = $container_width * ( ( 100 - ( $left_sidebar_width + $right_sidebar_width ) ) / 100 );
@ -100,14 +100,14 @@ add_action( 'enqueue_block_editor_assets', 'generate_enqueue_backend_block_edito
* @since 2.2
*/
function generate_enqueue_backend_block_editor_assets() {
wp_enqueue_style( 'generate-block-editor-styles', get_template_directory_uri() . "/css/admin/block-editor.css", false, GENERATE_VERSION, 'all' );
wp_enqueue_script( 'generate-block-editor-tinycolor', get_template_directory_uri() . "/js/admin/tinycolor.js", false, GENERATE_VERSION, true );
wp_enqueue_script( 'generate-block-editor-scripts', get_template_directory_uri() . "/js/admin/block-editor.js", array( 'jquery', 'generate-block-editor-tinycolor' ), GENERATE_VERSION, true );
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', generate_do_inline_block_editor_css() );
wp_add_inline_style( 'generate-block-editor-styles', wp_strip_all_tags( generate_do_inline_block_editor_css() ) );
}
$color_settings = wp_parse_args(
@ -126,19 +126,23 @@ function generate_enqueue_backend_block_editor_assets() {
$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,
) );
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,
)
);
}
/**
@ -157,7 +161,7 @@ function generate_do_inline_block_editor_css() {
generate_get_default_fonts()
);
$css = new GeneratePress_CSS;
$css = new GeneratePress_CSS();
$content_width = generate_get_block_editor_content_width();
@ -184,7 +188,7 @@ function generate_do_inline_block_editor_css() {
$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( '.edit-post-visual-editor .block-editor-block-list__block[data-align=wide]' );
$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 ) ) {
@ -195,13 +199,13 @@ function generate_do_inline_block_editor_css() {
$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( '.wp-block-button__link:not(.has-background)' );
$css->add_property( 'color', esc_attr( $color_settings['form_button_text_color'] ) );
$css->add_property( 'background-color', esc_attr( $color_settings['form_button_background_color'] ) );
$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( '.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', esc_attr( $color_settings['form_button_text_color_hover'] ) );
$css->add_property( 'background-color', esc_attr( $color_settings['form_button_background_color_hover'] ) );
$css->set_selector( '.editor-styles-wrapper a.button:hover, .editor-styles-wrapper a.button:focus, .wp-block-button__link:not(.has-background):active, .wp-block-button__link:not(.has-background):focus, .wp-block-button__link:not(.has-background):hover' );
$css->add_property( 'color', $color_settings['form_button_text_color_hover'] );
$css->add_property( '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() );
@ -217,76 +221,88 @@ function generate_do_inline_block_editor_css() {
$css->add_property( 'font-size', absint( $font_settings['body_font_size'] ), false, 'px' );
if ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
$css->add_property( 'color', $color_settings['content_text_color'] );
} else {
$css->add_property( 'color', esc_attr( generate_get_option( 'text_color' ) ) );
$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', esc_attr( $color_settings['content_text_color'] ) );
$css->add_property( 'color', $color_settings['content_text_color'] );
} else {
$css->add_property( 'color', esc_attr( generate_get_option( 'text_color' ) ) );
$css->add_property( 'color', generate_get_option( 'text_color' ) );
}
$css->set_selector( 'body .editor-styles-wrapper, body .editor-styles-wrapper p, body .editor-styles-wrapper .mce-content-body' );
$css->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', esc_attr( $font_settings['heading_1_weight'] ) );
$css->add_property( 'text-transform', esc_attr( $font_settings['heading_1_transform'] ) );
$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', esc_attr( $color_settings['h1_color'] ) );
$css->add_property( 'color', $color_settings['h1_color'] );
} elseif ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
$css->add_property( 'color', $color_settings['content_text_color'] );
} else {
$css->add_property( 'color', esc_attr( generate_get_option( 'text_color' ) ) );
$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', esc_attr( $color_settings['content_title_color'] ) );
$css->add_property( 'color', $color_settings['content_title_color'] );
}
$css->set_selector( 'body .editor-styles-wrapper h2, .wp-block-heading h2.editor-rich-text__tinymce' );
$css->add_property( 'font-family', $h2_family );
$css->add_property( 'font-weight', esc_attr( $font_settings['heading_2_weight'] ) );
$css->add_property( 'text-transform', esc_attr( $font_settings['heading_2_transform'] ) );
$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', esc_attr( $color_settings['h2_color'] ) );
$css->add_property( 'color', $color_settings['h2_color'] );
} elseif ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
$css->add_property( 'color', $color_settings['content_text_color'] );
} else {
$css->add_property( 'color', esc_attr( generate_get_option( 'text_color' ) ) );
$css->add_property( 'color', generate_get_option( 'text_color' ) );
}
$css->set_selector( 'body .editor-styles-wrapper h3, .wp-block-heading h3.editor-rich-text__tinymce' );
$css->add_property( 'font-family', $h3_family );
$css->add_property( 'font-weight', esc_attr( $font_settings['heading_3_weight'] ) );
$css->add_property( 'text-transform', esc_attr( $font_settings['heading_3_transform'] ) );
$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', esc_attr( $color_settings['h3_color'] ) );
$css->add_property( 'color', $color_settings['h3_color'] );
} elseif ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
$css->add_property( 'color', $color_settings['content_text_color'] );
} else {
$css->add_property( 'color', esc_attr( generate_get_option( 'text_color' ) ) );
$css->add_property( 'color', generate_get_option( 'text_color' ) );
}
$css->set_selector( 'body .editor-styles-wrapper h4, .wp-block-heading h4.editor-rich-text__tinymce' );
$css->add_property( 'font-family', $h4_family );
$css->add_property( 'font-weight', esc_attr( $font_settings['heading_4_weight'] ) );
$css->add_property( 'text-transform', esc_attr( $font_settings['heading_4_transform'] ) );
$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' );
@ -299,17 +315,19 @@ function generate_do_inline_block_editor_css() {
}
if ( $color_settings['h4_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['h4_color'] ) );
$css->add_property( 'color', $color_settings['h4_color'] );
} elseif ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
$css->add_property( 'color', $color_settings['content_text_color'] );
} else {
$css->add_property( 'color', esc_attr( generate_get_option( 'text_color' ) ) );
$css->add_property( 'color', generate_get_option( 'text_color' ) );
}
$css->set_selector( 'body .editor-styles-wrapper h5, .wp-block-heading h5.editor-rich-text__tinymce' );
$css->add_property( 'font-family', $h5_family );
$css->add_property( 'font-weight', esc_attr( $font_settings['heading_5_weight'] ) );
$css->add_property( 'text-transform', esc_attr( $font_settings['heading_5_transform'] ) );
$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' );
@ -322,17 +340,19 @@ function generate_do_inline_block_editor_css() {
}
if ( $color_settings['h5_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['h5_color'] ) );
$css->add_property( 'color', $color_settings['h5_color'] );
} elseif ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
$css->add_property( 'color', $color_settings['content_text_color'] );
} else {
$css->add_property( 'color', esc_attr( generate_get_option( 'text_color' ) ) );
$css->add_property( 'color', generate_get_option( 'text_color' ) );
}
$css->set_selector( 'body .editor-styles-wrapper h6, .wp-block-heading h6.editor-rich-text__tinymce' );
$css->add_property( 'font-family', $h6_family );
$css->add_property( 'font-weight', esc_attr( $font_settings['heading_6_weight'] ) );
$css->add_property( 'text-transform', esc_attr( $font_settings['heading_6_transform'] ) );
$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' );
@ -345,45 +365,46 @@ function generate_do_inline_block_editor_css() {
}
if ( $color_settings['h6_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['h6_color'] ) );
$css->add_property( 'color', $color_settings['h6_color'] );
} elseif ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
$css->add_property( 'color', $color_settings['content_text_color'] );
} else {
$css->add_property( 'color', esc_attr( generate_get_option( 'text_color' ) ) );
$css->add_property( 'color', generate_get_option( 'text_color' ) );
}
$css->set_selector( '.block-editor-block-list__layout .wp-block-button .wp-block-button__link' );
$css->set_selector( '.editor-styles-wrapper a.button, .block-editor-block-list__layout .wp-block-button .wp-block-button__link' );
$css->add_property( 'font-family', $buttons_family );
$css->add_property( 'font-weight', esc_attr( $font_settings['buttons_font_weight'] ) );
$css->add_property( 'text-transform', esc_attr( $font_settings['buttons_font_transform'] ) );
$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' );
}
$css->set_selector( 'body .editor-styles-wrapper' );
$css->add_property( 'background-color', esc_attr( generate_get_option( 'background_color' ) ) );
$css->add_property( 'background-color', generate_get_option( 'background_color' ) );
if ( $color_settings['content_background_color'] ) {
$body_background = esc_attr( generate_get_option( 'background_color' ) );
$content_background = esc_attr( $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', esc_attr( $color_settings['content_link_color'] ) );
$css->add_property( 'color', $color_settings['content_link_color'] );
} else {
$css->add_property( 'color', esc_attr( generate_get_option( 'link_color' ) ) );
$css->add_property( 'color', generate_get_option( 'link_color' ) );
}
$css->set_selector( '.block-editor-block-list__block a:hover, .block-editor-block-list__block a:focus, .block-editor-block-list__block a:active' );
if ( $color_settings['content_link_hover_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['content_link_hover_color'] ) );
$css->add_property( 'color', $color_settings['content_link_hover_color'] );
} else {
$css->add_property( 'color', esc_attr( generate_get_option( 'link_color_hover' ) ) );
$css->add_property( 'color', generate_get_option( 'link_color_hover' ) );
}
return $css->css_output();

View File

@ -24,7 +24,7 @@ if ( ! class_exists( 'GeneratePress_CSS' ) ) {
* @access protected
* @var string
*/
protected $_selector = '';
protected $_selector = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
/**
* Stores the final css output with all of its rules for the current selector.
@ -32,7 +32,7 @@ if ( ! class_exists( 'GeneratePress_CSS' ) ) {
* @access protected
* @var string
*/
protected $_selector_output = '';
protected $_selector_output = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
/**
* Stores all of the rules that will be added to the selector
@ -40,7 +40,7 @@ if ( ! class_exists( 'GeneratePress_CSS' ) ) {
* @access protected
* @var string
*/
protected $_css = '';
protected $_css = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
/**
* The string that holds all of the css to output
@ -48,14 +48,14 @@ if ( ! class_exists( 'GeneratePress_CSS' ) ) {
* @access protected
* @var string
*/
protected $_output = '';
protected $_output = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
/**
* Stores media queries
*
* @var null
*/
protected $_media_query = null;
protected $_media_query = null; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
/**
* The string that holds all of the css to output inside of the media query
@ -63,7 +63,7 @@ if ( ! class_exists( 'GeneratePress_CSS' ) ) {
* @access protected
* @var string
*/
protected $_media_query_output = '';
protected $_media_query_output = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
/**
* Sets a selector to the object and changes the current selector to a new one
@ -71,12 +71,12 @@ if ( ! class_exists( 'GeneratePress_CSS' ) ) {
* @access public
* @since 1.0
*
* @param string $selector - the css identifier of the html that you wish to target
* @param string $selector - the css identifier of the html that you wish to target.
* @return $this
*/
public function set_selector( $selector = '' ) {
// Render the css in the output string everytime the selector changes.
if ( $this->_selector !== '' ) {
if ( '' !== $this->_selector ) {
$this->add_selector_rules_to_output();
}
@ -90,13 +90,18 @@ if ( ! class_exists( 'GeneratePress_CSS' ) ) {
* @access public
* @since 1.0
*
* @param string $property - the css property
* @param string $value - the value to be placed with the property
* @param string $og_default - check to see if the value matches the default
* @param string $unit - the unit for the value (px)
* @param string $property The css property.
* @param string $value The value to be placed with the property.
* @param string $og_default Check to see if the value matches the default.
* @param string $unit The unit for the value (px).
* @return $this
*/
public function add_property( $property, $value, $og_default = false, $unit = false ) {
// Setting font-size to 0 is rarely ever a good thing.
if ( 'font-size' === $property && 0 === $value ) {
return false;
}
// Add our unit to our value if it exists.
if ( $unit && '' !== $unit ) {
$value = $value . $unit;
@ -106,7 +111,7 @@ if ( ! class_exists( 'GeneratePress_CSS' ) ) {
}
// If we don't have a value or our value is the same as our og default, bail.
if ( empty( $value ) || $og_default == $value ) {
if ( ( empty( $value ) && ! is_numeric( $value ) ) || $og_default === $value ) {
return false;
}
@ -118,7 +123,7 @@ if ( ! class_exists( 'GeneratePress_CSS' ) ) {
* Sets a media query in the class
*
* @since 1.1
* @param string $value
* @param string $value The media query.
* @return $this
*/
public function start_media_query( $value ) {

View File

@ -0,0 +1,327 @@
<?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();

File diff suppressed because it is too large Load Diff

View File

@ -56,20 +56,28 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
}
if ( isset( $wp_customize->selective_refresh ) ) {
$wp_customize->selective_refresh->add_partial( 'blogname', array(
'selector' => '.main-title a',
'render_callback' => 'generate_customize_partial_blogname',
) );
$wp_customize->selective_refresh->add_partial(
'blogname',
array(
'selector' => '.main-title a',
'render_callback' => 'generate_customize_partial_blogname',
)
);
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
'selector' => '.site-description',
'render_callback' => 'generate_customize_partial_blogdescription',
) );
$wp_customize->selective_refresh->add_partial(
'blogdescription',
array(
'selector' => '.site-description',
'render_callback' => 'generate_customize_partial_blogdescription',
)
);
}
if ( ! defined( 'GP_PREMIUM_VERSION' ) ) {
$wp_customize->add_section(
new GeneratePress_Upsell_Section( $wp_customize, 'generatepress_upsell_section',
new GeneratePress_Upsell_Section(
$wp_customize,
'generatepress_upsell_section',
array(
'pro_text' => __( 'Premium Modules Available', 'generatepress' ),
'pro_url' => generate_get_premium_url( 'https://generatepress.com/premium' ),
@ -186,8 +194,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
),
'choices' => array(
'desktop' => array(
'min' => 30,
'max' => 800,
'min' => 20,
'max' => 1200,
'step' => 10,
'edit' => true,
'unit' => 'px',
@ -213,7 +221,7 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
'type' => 'checkbox',
'label' => esc_html__( 'Place logo next to title', 'generatepress' ),
'section' => 'title_tagline',
'active_callback' => 'generate_has_logo_site_branding',
'active_callback' => 'generate_show_inline_logo_callback',
)
);
@ -228,7 +236,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
);
$wp_customize->add_setting(
'generate_settings[background_color]', array(
'generate_settings[background_color]',
array(
'default' => $defaults['background_color'],
'type' => 'option',
'sanitize_callback' => 'generate_sanitize_hex_color',
@ -249,7 +258,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
);
$wp_customize->add_setting(
'generate_settings[text_color]', array(
'generate_settings[text_color]',
array(
'default' => $defaults['text_color'],
'type' => 'option',
'sanitize_callback' => 'generate_sanitize_hex_color',
@ -270,7 +280,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
);
$wp_customize->add_setting(
'generate_settings[link_color]', array(
'generate_settings[link_color]',
array(
'default' => $defaults['link_color'],
'type' => 'option',
'sanitize_callback' => 'generate_sanitize_hex_color',
@ -291,7 +302,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
);
$wp_customize->add_setting(
'generate_settings[link_color_hover]', array(
'generate_settings[link_color_hover]',
array(
'default' => $defaults['link_color_hover'],
'type' => 'option',
'sanitize_callback' => 'generate_sanitize_hex_color',
@ -311,32 +323,36 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
)
);
$wp_customize->add_setting(
'generate_settings[link_color_visited]', array(
'default' => $defaults['link_color_visited'],
'type' => 'option',
'sanitize_callback' => 'generate_sanitize_hex_color',
'transport' => 'refresh',
)
);
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
if ( '' !== generate_get_option( 'link_color_visited' ) ) {
$wp_customize->add_setting(
'generate_settings[link_color_visited]',
array(
'label' => __( 'Link Color Visited', 'generatepress' ),
'section' => 'body_section',
'settings' => 'generate_settings[link_color_visited]',
'default' => $defaults['link_color_visited'],
'type' => 'option',
'sanitize_callback' => 'generate_sanitize_hex_color',
'transport' => 'refresh',
)
)
);
);
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'generate_settings[link_color_visited]',
array(
'label' => __( 'Link Color Visited', 'generatepress' ),
'section' => 'body_section',
'settings' => 'generate_settings[link_color_visited]',
)
)
);
}
$color_defaults = generate_get_color_defaults();
if ( ! $wp_customize->get_setting( 'generate_settings[blog_post_title_color]' ) ) {
$wp_customize->add_setting(
'generate_settings[blog_post_title_color]', array(
'generate_settings[blog_post_title_color]',
array(
'default' => $color_defaults['blog_post_title_color'],
'type' => 'option',
'sanitize_callback' => 'generate_sanitize_hex_color',
@ -357,7 +373,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
);
$wp_customize->add_setting(
'generate_settings[blog_post_title_hover_color]', array(
'generate_settings[blog_post_title_hover_color]',
array(
'default' => $color_defaults['blog_post_title_hover_color'],
'type' => 'option',
'sanitize_callback' => 'generate_sanitize_hex_color',
@ -398,7 +415,7 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
'choices' => array(
'current' => __( 'Current', 'generatepress' ),
'default' => __( 'Default', 'generatepress' ),
'white' => __( 'White', 'generatepress' ),
'classic' => __( 'Classic', 'generatepress' ),
'grey' => __( 'Grey', 'generatepress' ),
'red' => __( 'Red', 'generatepress' ),
'green' => __( 'Green', 'generatepress' ),
@ -410,7 +427,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
if ( ! $wp_customize->get_setting( 'generate_settings[navigation_background_color]' ) ) {
$wp_customize->add_setting(
'generate_settings[navigation_background_color]', array(
'generate_settings[navigation_background_color]',
array(
'default' => $color_defaults['navigation_background_color'],
'type' => 'option',
'sanitize_callback' => 'generate_sanitize_rgba_color',
@ -419,7 +437,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
);
$wp_customize->add_setting(
'generate_settings[navigation_text_color]', array(
'generate_settings[navigation_text_color]',
array(
'default' => $color_defaults['navigation_text_color'],
'type' => 'option',
'sanitize_callback' => 'generate_sanitize_hex_color',
@ -478,7 +497,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
);
$wp_customize->add_setting(
'generate_settings[subnavigation_text_color]', array(
'generate_settings[subnavigation_text_color]',
array(
'default' => $color_defaults['subnavigation_text_color'],
'type' => 'option',
'sanitize_callback' => 'generate_sanitize_hex_color',
@ -497,7 +517,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
);
$wp_customize->add_setting(
'generate_settings[subnavigation_text_hover_color]', array(
'generate_settings[subnavigation_text_hover_color]',
array(
'default' => $color_defaults['subnavigation_text_hover_color'],
'type' => 'option',
'sanitize_callback' => 'generate_sanitize_hex_color',
@ -516,7 +537,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
);
$wp_customize->add_setting(
'generate_settings[subnavigation_text_current_color]', array(
'generate_settings[subnavigation_text_current_color]',
array(
'default' => $color_defaults['subnavigation_text_current_color'],
'type' => 'option',
'sanitize_callback' => 'generate_sanitize_hex_color',
@ -545,10 +567,13 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
if ( class_exists( 'WP_Customize_Panel' ) ) {
if ( ! $wp_customize->get_panel( 'generate_layout_panel' ) ) {
$wp_customize->add_panel( 'generate_layout_panel', array(
'priority' => 25,
'title' => __( 'Layout', 'generatepress' ),
) );
$wp_customize->add_panel(
'generate_layout_panel',
array(
'priority' => 25,
'title' => __( 'Layout', 'generatepress' ),
)
);
}
}
@ -696,32 +721,76 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
$wp_customize->add_setting(
'generate_header_helper',
array(
'default' => 'current',
'type' => 'option',
'default' => 'current',
'type' => 'option',
'sanitize_callback' => 'generate_sanitize_preset_layout',
'transport' => 'postMessage',
'transport' => 'postMessage',
)
);
$wp_customize->add_control(
'generate_header_helper',
array(
'type' => 'select',
'label' => __( 'Header Presets', 'generatepress' ),
'section' => 'generate_layout_header',
'choices' => array(
'current' => __( 'Current', 'generatepress' ),
'default' => __( 'Default', 'generatepress' ),
'nav-before-centered' => __( 'Navigation Before - Centered', 'generatepress' ),
'nav-after-centered' => __( 'Navigation After - Centered', 'generatepress' ),
'nav-right' => __( 'Navigation Right', 'generatepress' ),
'nav-left' => __( 'Navigation Left', 'generatepress' ),
'type' => 'select',
'label' => __( 'Header Presets', 'generatepress' ),
'section' => 'generate_layout_header',
'choices' => array(
'current' => __( 'Current', 'generatepress' ),
'default' => __( 'Default', 'generatepress' ),
'classic' => __( 'Classic', 'generatepress' ),
'nav-before' => __( 'Navigation Before', 'generatepress' ),
'nav-after' => __( 'Navigation After', 'generatepress' ),
'nav-before-centered' => __( 'Navigation Before - Centered', 'generatepress' ),
'nav-after-centered' => __( 'Navigation After - Centered', 'generatepress' ),
'nav-left' => __( 'Navigation Left', 'generatepress' ),
),
'settings' => 'generate_header_helper',
'priority' => 4,
'settings' => 'generate_header_helper',
'priority' => 4,
)
);
if ( ! $wp_customize->get_setting( 'generate_settings[site_title_font_size]' ) ) {
$typography_defaults = generate_get_default_fonts();
$wp_customize->add_setting(
'generate_settings[site_title_font_size]',
array(
'default' => $typography_defaults['site_title_font_size'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage',
)
);
}
if ( ! $wp_customize->get_setting( 'generate_spacing_settings[header_top]' ) ) {
$spacing_defaults = generate_spacing_get_defaults();
$wp_customize->add_setting(
'generate_spacing_settings[header_top]',
array(
'default' => $spacing_defaults['header_top'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage',
)
);
}
if ( ! $wp_customize->get_setting( 'generate_spacing_settings[header_bottom]' ) ) {
$spacing_defaults = generate_spacing_get_defaults();
$wp_customize->add_setting(
'generate_spacing_settings[header_bottom]',
array(
'default' => $spacing_defaults['header_bottom'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage',
)
);
}
$wp_customize->add_setting(
'generate_settings[header_layout_setting]',
array(
@ -889,7 +958,7 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
'default' => $defaults['nav_position_setting'],
'type' => 'option',
'sanitize_callback' => 'generate_sanitize_choices',
'transport' => ( '' !== generate_get_option( 'nav_position_setting' ) ) ? 'postMessage' : 'refresh',
'transport' => 'refresh',
)
);
@ -1026,7 +1095,6 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
'default' => $defaults['content_layout_setting'],
'type' => 'option',
'sanitize_callback' => 'generate_sanitize_choices',
'transport' => 'postMessage',
)
);
@ -1266,9 +1334,9 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
'label' => __( 'Footer Bar Alignment', 'generatepress' ),
'section' => 'generate_layout_footer',
'choices' => array(
'left' => __( 'Left','generatepress' ),
'center' => __( 'Center','generatepress' ),
'right' => __( 'Right','generatepress' ),
'left' => __( 'Left', 'generatepress' ),
'center' => __( 'Center', 'generatepress' ),
'right' => __( 'Right', 'generatepress' ),
),
'settings' => 'generate_settings[footer_bar_alignment]',
'priority' => 47,
@ -1325,7 +1393,7 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
'label' => __( 'Content Type', 'generatepress' ),
'section' => 'generate_blog_section',
'choices' => array(
'full' => __( 'Full', 'generatepress' ),
'full' => __( 'Full Content', 'generatepress' ),
'excerpt' => __( 'Excerpt', 'generatepress' ),
),
'settings' => 'generate_settings[post_content]',
@ -1381,6 +1449,52 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
);
}
$show_flexbox_option = true;
if ( defined( 'GP_PREMIUM_VERSION' ) && version_compare( GP_PREMIUM_VERSION, '1.11.0-alpha.1', '<' ) ) {
$show_flexbox_option = false;
}
if ( generate_is_using_flexbox() ) {
$show_flexbox_option = true;
}
$show_flexbox_option = apply_filters( 'generate_show_flexbox_customizer_option', $show_flexbox_option );
if ( $show_flexbox_option ) {
$wp_customize->add_setting(
'generate_settings[structure]',
array(
'default' => $defaults['structure'],
'type' => 'option',
'sanitize_callback' => 'generate_sanitize_choices',
)
);
$wp_customize->add_control(
'generate_settings[structure]',
array(
'type' => 'select',
'label' => __( 'Structure', 'generatepress' ),
'section' => 'generate_general_section',
'choices' => array(
'flexbox' => __( 'Flexbox', 'generatepress' ),
'floats' => __( 'Floats', 'generatepress' ),
),
'description' => sprintf(
'<strong>%1$s</strong> %2$s',
__( 'Caution:', 'generatepress' ),
sprintf(
/* translators: Learn more here */
__( 'Switching your structure can change how your website displays. Review your website thoroughly before publishing this change, or use a staging site to review the potential changes. Learn more %s.', 'generatepress' ),
'<a href="https://docs.generatepress.com/article/switching-from-floats-to-flexbox/" target="_blank" rel="noopener noreferrer">' . __( 'here', 'generatepress' ) . '</a>'
)
),
'settings' => 'generate_settings[structure]',
)
);
}
$wp_customize->add_setting(
'generate_settings[icons]',
array(
@ -1420,6 +1534,7 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
'label' => __( 'Combine CSS', 'generatepress' ),
'description' => __( 'Reduce the number of CSS file requests and use a lite version of our grid system.', 'generatepress' ),
'section' => 'generate_general_section',
'active_callback' => 'generate_is_using_floats_callback',
)
);

View File

@ -12,9 +12,13 @@ if ( ! defined( 'ABSPATH' ) ) {
if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Customize_Width_Slider_Control' ) ) {
/**
* Create our container width slider control
*
* @deprecated 1.3.47
*/
class Generate_Customize_Width_Slider_Control extends WP_Customize_Control {
/**
* Render content.
*/
public function render_content() {}
}
}
@ -22,10 +26,14 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Customi
if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'GenerateLabelControl' ) ) {
/**
* Heading area
*
* @since 0.1
* @depreceted 1.3.41
**/
class GenerateLabelControl extends WP_Customize_Control {
class GenerateLabelControl extends WP_Customize_Control { // phpcs:ignore
/**
* Render content.
*/
public function render_content() {}
}
}
@ -34,14 +42,25 @@ if ( ! class_exists( 'Generate_Google_Font_Dropdown_Custom_Control' ) ) {
/**
* A class to create a dropdown for all google fonts
*/
class Generate_Google_Font_Dropdown_Custom_Control extends WP_Customize_Control {
class Generate_Google_Font_Dropdown_Custom_Control extends WP_Customize_Control { // phpcs:ignore
/**
* Set type.
*
* @var $type
*/
public $type = 'gp-customizer-fonts';
/**
* Enqueue scripts.
*/
public function enqueue() {
wp_enqueue_script( 'generatepress-customizer-fonts', trailingslashit( get_template_directory_uri() ) . 'inc/js/typography-controls.js', array( 'customize-controls' ), GENERATE_VERSION, true );
wp_localize_script( 'generatepress-customizer-fonts', 'gp_customize', array( 'nonce' => wp_create_nonce( 'gp_customize_nonce' ) ) );
}
/**
* Send variables to json.
*/
public function to_json() {
parent::to_json();
@ -50,11 +69,14 @@ if ( ! class_exists( 'Generate_Google_Font_Dropdown_Custom_Control' ) ) {
$this->json['value'] = $this->value();
$this->json['default_fonts_title'] = __( 'Default fonts', 'generatepress' );
$this->json['google_fonts_title'] = __( 'Google fonts', 'generatepress' );
$this->json['description'] = __( 'Font family','generatepress' );
$this->json['description'] = __( 'Font family', 'generatepress' );
$this->json['google_fonts'] = apply_filters( 'generate_typography_customize_list', generate_get_all_google_fonts( $number_of_fonts ) );
$this->json['default_fonts'] = generate_typography_default_fonts();
}
/**
* Render content.
*/
public function content_template() {
?>
<label>
@ -83,10 +105,24 @@ if ( ! class_exists( 'Generate_Select_Control' ) ) {
/**
* A class to create a dropdown for font weight
*/
class Generate_Select_Control extends WP_Customize_Control {
class Generate_Select_Control extends WP_Customize_Control { // phpcs:ignore
/**
* Set type.
*
* @var $type
*/
public $type = 'gp-typography-select';
/**
* Set choices.
*
* @var $choices
*/
public $choices = array();
/**
* Send variables to json.
*/
public function to_json() {
parent::to_json();
@ -100,6 +136,9 @@ if ( ! class_exists( 'Generate_Select_Control' ) ) {
}
/**
* Render content.
*/
public function content_template() {
?>
<# if ( ! data.choices )
@ -122,13 +161,26 @@ if ( ! class_exists( 'Generate_Select_Control' ) ) {
if ( ! class_exists( 'Generate_Hidden_Input_Control' ) ) {
/**
* Create our hidden input control
* Create our hidden input control
*/
class Generate_Hidden_Input_Control extends WP_Customize_Control {
// Setup control type
class Generate_Hidden_Input_Control extends WP_Customize_Control { // phpcs:ignore
/**
* Set type.
*
* @var $type
*/
public $type = 'gp-hidden-input';
/**
* Set ID
*
* @var $id
*/
public $id = '';
/**
* Send variables to json.
*/
public function to_json() {
parent::to_json();
$this->json['link'] = $this->get_link();
@ -136,6 +188,9 @@ if ( ! class_exists( 'Generate_Hidden_Input_Control' ) ) {
$this->json['id'] = $this->id;
}
/**
* Render content.
*/
public function content_template() {
?>
<input name="{{ data.id }}" type="text" {{{ data.link }}} value="{{{ data.value }}}" class="gp-hidden-input" />
@ -147,84 +202,102 @@ if ( ! class_exists( 'Generate_Hidden_Input_Control' ) ) {
if ( ! class_exists( 'Generate_Font_Weight_Custom_Control' ) ) {
/**
* A class to create a dropdown for font weight
*
* @deprecated since 1.3.40
*/
class Generate_Font_Weight_Custom_Control extends WP_Customize_Control {
public function __construct( $manager, $id, $args = array(), $options = array() ) {
parent::__construct( $manager, $id, $args );
}
class Generate_Font_Weight_Custom_Control extends WP_Customize_Control { // phpcs:ignore
/**
* Render the content of the category dropdown
* Construct.
*
* @return HTML
* @param object $manager The manager.
* @param int $id The ID.
* @param array $args The args.
* @param array $options The options.
*/
public function render_content() {
?>
<label>
<select <?php $this->link(); ?>>
<?php
printf('<option value="%s" %s>%s</option>', 'normal', selected($this->value(), 'normal', false), 'normal');
printf('<option value="%s" %s>%s</option>', 'bold', selected($this->value(), 'bold', false), 'bold');
printf('<option value="%s" %s>%s</option>', '100', selected($this->value(), '100', false), '100');
printf('<option value="%s" %s>%s</option>', '200', selected($this->value(), '200', false), '200');
printf('<option value="%s" %s>%s</option>', '300', selected($this->value(), '300', false), '300');
printf('<option value="%s" %s>%s</option>', '400', selected($this->value(), '400', false), '400');
printf('<option value="%s" %s>%s</option>', '500', selected($this->value(), '500', false), '500');
printf('<option value="%s" %s>%s</option>', '600', selected($this->value(), '600', false), '600');
printf('<option value="%s" %s>%s</option>', '700', selected($this->value(), '700', false), '700');
printf('<option value="%s" %s>%s</option>', '800', selected($this->value(), '800', false), '800');
printf('<option value="%s" %s>%s</option>', '900', selected($this->value(), '900', false), '900');
?>
</select>
<p class="description"><?php echo esc_html( $this->label ); ?></p>
</label>
<?php
}
}
}
if ( ! class_exists( 'Generate_Text_Transform_Custom_Control' ) ) {
/**
* A class to create a dropdown for text-transform
* @deprecated since 1.3.40
*/
class Generate_Text_Transform_Custom_Control extends WP_Customize_Control {
public function __construct( $manager, $id, $args = array(), $options = array() ) {
parent::__construct( $manager, $id, $args );
}
/**
* Render the content of the category dropdown
*
* @return HTML
*/
public function render_content() {
?>
<label>
<select <?php $this->link(); ?>>
<?php
printf('<option value="%s" %s>%s</option>', 'none', selected($this->value(), 'none', false), 'none');
printf('<option value="%s" %s>%s</option>', 'capitalize', selected($this->value(), 'capitalize', false), 'capitalize');
printf('<option value="%s" %s>%s</option>', 'uppercase', selected($this->value(), 'uppercase', false), 'uppercase');
printf('<option value="%s" %s>%s</option>', 'lowercase', selected($this->value(), 'lowercase', false), 'lowercase');
?>
</select>
<p class="description"><?php echo esc_html( $this->label ); ?></p>
</label>
<?php
}
}
public function render_content() {
?>
<label>
<select <?php $this->link(); ?>>
<?php
printf( '<option value="%s" %s>%s</option>', 'normal', selected( $this->value(), 'normal', false ), 'normal' );
printf( '<option value="%s" %s>%s</option>', 'bold', selected( $this->value(), 'bold', false ), 'bold' );
printf( '<option value="%s" %s>%s</option>', '100', selected( $this->value(), '100', false ), '100' );
printf( '<option value="%s" %s>%s</option>', '200', selected( $this->value(), '200', false ), '200' );
printf( '<option value="%s" %s>%s</option>', '300', selected( $this->value(), '300', false ), '300' );
printf( '<option value="%s" %s>%s</option>', '400', selected( $this->value(), '400', false ), '400' );
printf( '<option value="%s" %s>%s</option>', '500', selected( $this->value(), '500', false ), '500' );
printf( '<option value="%s" %s>%s</option>', '600', selected( $this->value(), '600', false ), '600' );
printf( '<option value="%s" %s>%s</option>', '700', selected( $this->value(), '700', false ), '700' );
printf( '<option value="%s" %s>%s</option>', '800', selected( $this->value(), '800', false ), '800' );
printf( '<option value="%s" %s>%s</option>', '900', selected( $this->value(), '900', false ), '900' );
?>
</select>
<p class="description"><?php echo esc_html( $this->label ); ?></p>
</label>
<?php
}
}
}
if ( ! class_exists( 'Generate_Text_Transform_Custom_Control' ) ) {
/**
* A class to create a dropdown for text-transform
*
* @deprecated since 1.3.40
*/
class Generate_Text_Transform_Custom_Control extends WP_Customize_Control { // phpcs:ignore
/**
* Construct.
*
* @param object $manager The manager.
* @param int $id The ID.
* @param array $args The args.
* @param array $options The options.
*/
public function __construct( $manager, $id, $args = array(), $options = array() ) {
parent::__construct( $manager, $id, $args );
}
/**
* Render the content of the category dropdown
*/
public function render_content() {
?>
<label>
<select <?php $this->link(); ?>>
<?php
printf( '<option value="%s" %s>%s</option>', 'none', selected( $this->value(), 'none', false ), 'none' );
printf( '<option value="%s" %s>%s</option>', 'capitalize', selected( $this->value(), 'capitalize', false ), 'capitalize' );
printf( '<option value="%s" %s>%s</option>', 'uppercase', selected( $this->value(), 'uppercase', false ), 'uppercase' );
printf( '<option value="%s" %s>%s</option>', 'lowercase', selected( $this->value(), 'lowercase', false ), 'lowercase' );
?>
</select>
<p class="description"><?php echo esc_html( $this->label ); ?></p>
</label>
<?php
}
}
}
if ( ! class_exists( 'Generate_Customize_Slider_Control' ) ) {
/**
* Create our container width slider control
*
* @deprecated 1.3.47
*/
class Generate_Customize_Slider_Control extends WP_Customize_Control {
class Generate_Customize_Slider_Control extends WP_Customize_Control { // phpcs:ignore
/**
* Render content.
*/
public function render_content() {}
}
}

View File

@ -25,9 +25,22 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Range_S
*/
public $type = 'generatepress-range-slider';
/**
* The control description.
*
* @access public
* @var string
*/
public $description = '';
/**
* The control sub-description.
*
* @access public
* @var string
*/
public $sub_description = '';
/**
* Refresh the parameters passed to the JavaScript via JSON.
*
@ -36,7 +49,7 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Range_S
public function to_json() {
parent::to_json();
$devices = array( 'desktop','tablet','mobile' );
$devices = array( 'desktop', 'tablet', 'mobile' );
foreach ( $devices as $device ) {
$this->json['choices'][ $device ]['min'] = ( isset( $this->choices[ $device ]['min'] ) ) ? $this->choices[ $device ]['min'] : '0';
$this->json['choices'][ $device ]['max'] = ( isset( $this->choices[ $device ]['max'] ) ) ? $this->choices[ $device ]['max'] : '100';
@ -53,10 +66,10 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Range_S
);
}
$this->json['desktop_label'] = __( 'Desktop','generatepress' );
$this->json['tablet_label'] = __( 'Tablet','generatepress' );
$this->json['mobile_label'] = __( 'Mobile','generatepress' );
$this->json['reset_label'] = __( 'Reset','generatepress' );
$this->json['desktop_label'] = __( 'Desktop', 'generatepress' );
$this->json['tablet_label'] = __( 'Tablet', 'generatepress' );
$this->json['mobile_label'] = __( 'Mobile', 'generatepress' );
$this->json['reset_label'] = __( 'Reset', 'generatepress' );
$this->json['description'] = $this->description;
$this->json['sub_description'] = $this->sub_description;
@ -68,8 +81,24 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Range_S
* @access public
*/
public function enqueue() {
wp_enqueue_script( 'generatepress-range-slider', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/slider-control.js', array( 'jquery', 'customize-base', 'jquery-ui-slider' ), false, true );
wp_enqueue_style( 'generatepress-range-slider-css', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/slider-customizer.css', null );
wp_enqueue_script(
'generatepress-range-slider',
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/slider-control.js',
array(
'jquery',
'customize-base',
'jquery-ui-slider',
),
GENERATE_VERSION,
true
);
wp_enqueue_style(
'generatepress-range-slider-css',
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/slider-customizer.css',
array(),
GENERATE_VERSION
);
}
/**

View File

@ -16,16 +16,57 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Typogra
* @since 2.0
*/
class Generate_Typography_Customize_Control extends WP_Customize_Control {
/**
* Set the type.
*
* @var string $type
*/
public $type = 'gp-customizer-typography';
/**
* Enqueue scripts.
*/
public function enqueue() {
wp_enqueue_script( 'generatepress-typography-selectWoo', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/selectWoo.min.js', array( 'customize-controls', 'jquery' ), GENERATE_VERSION, true );
wp_enqueue_style( 'generatepress-typography-selectWoo', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/selectWoo.min.css', array(), GENERATE_VERSION );
wp_enqueue_script(
'generatepress-typography-selectWoo',
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/selectWoo.min.js',
array(
'customize-controls',
'jquery',
),
GENERATE_VERSION,
true
);
wp_enqueue_script( 'generatepress-typography-customizer', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/typography-customizer.js', array( 'customize-controls', 'generatepress-typography-selectWoo' ), GENERATE_VERSION, true );
wp_enqueue_style( 'generatepress-typography-customizer', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/typography-customizer.css', array(), GENERATE_VERSION );
wp_enqueue_style(
'generatepress-typography-selectWoo',
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/selectWoo.min.css',
array(),
GENERATE_VERSION
);
wp_enqueue_script(
'generatepress-typography-customizer',
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/typography-customizer.js',
array(
'customize-controls',
'generatepress-typography-selectWoo',
),
GENERATE_VERSION,
true
);
wp_enqueue_style(
'generatepress-typography-customizer',
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/typography-customizer.css',
array(),
GENERATE_VERSION
);
}
/**
* Send variables to json.
*/
public function to_json() {
parent::to_json();
@ -43,7 +84,7 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Typogra
'link' => $this->get_link( $setting_key ),
'value' => $this->value( $setting_key ),
'default' => isset( $setting_id->default ) ? $setting_id->default : '',
'id' => isset( $setting_id->id ) ? $setting_id->id : ''
'id' => isset( $setting_id->id ) ? $setting_id->id : '',
);
if ( 'weight' === $setting_key ) {
@ -56,6 +97,9 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Typogra
}
}
/**
* Render content.
*/
public function content_template() {
?>
<# if ( '' !== data.label ) { #>
@ -165,6 +209,9 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Typogra
<?php
}
/**
* Build font weight choices.
*/
public function get_font_weight_choices() {
return array(
'normal' => esc_html( 'normal' ),
@ -181,6 +228,9 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Typogra
);
}
/**
* Build text transform choices.
*/
public function get_font_transform_choices() {
return array(
'none' => esc_html( 'none' ),

View File

@ -17,20 +17,57 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Customi
* @since 0.1
*/
class Generate_Customize_Misc_Control extends WP_Customize_Control {
/**
* Set description.
*
* @var public $description
*/
public $description = '';
/**
* Set URL.
*
* @var public $url
*/
public $url = '';
/**
* Set type.
*
* @var public $type
*/
public $type = 'addon';
/**
* Set label.
*
* @var public $label
*/
public $label = '';
/**
* Enqueue scripts.
*/
public function enqueue() {
wp_enqueue_style( 'generate-customizer-controls-css', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/upsell-customizer.css', array(), GENERATE_VERSION );
wp_enqueue_style(
'generate-customizer-controls-css',
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/upsell-customizer.css',
array(),
GENERATE_VERSION
);
}
/**
* Send variables to json.
*/
public function to_json() {
parent::to_json();
$this->json['url'] = esc_url( $this->url );
}
/**
* Render content.
*/
public function content_template() {
?>
<p class="description" style="margin-top: 5px;">{{{ data.description }}}</p>

View File

@ -17,11 +17,37 @@ if ( class_exists( 'WP_Customize_Section' ) && ! class_exists( 'GeneratePress_Up
* @since unknown
*/
class GeneratePress_Upsell_Section extends WP_Customize_Section {
/**
* Set type.
*
* @var public $type
*/
public $type = 'gp-upsell-section';
/**
* Set pro URL.
*
* @var public $pro_url
*/
public $pro_url = '';
/**
* Set pro text.
*
* @var public $pro_text
*/
public $pro_text = '';
/**
* Set ID.
*
* @var public $id
*/
public $id = '';
/**
* Send variables to json.
*/
public function json() {
$json = parent::json();
$json['pro_text'] = $this->pro_text;
@ -30,6 +56,9 @@ if ( class_exists( 'WP_Customize_Section' ) && ! class_exists( 'GeneratePress_Up
return $json;
}
/**
* Render content.
*/
protected function render_template() {
?>
<li id="accordion-section-{{ data.id }}" class="generate-upsell-accordion-section control-section-{{ data.type }} cannot-expand accordion-section">
@ -48,7 +77,19 @@ if ( ! function_exists( 'generate_customizer_controls_css' ) ) {
* @since 1.3.41
*/
function generate_customizer_controls_css() {
wp_enqueue_style( 'generate-customizer-controls-css', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/upsell-customizer.css', array(), GENERATE_VERSION );
wp_enqueue_script( 'generatepress-upsell', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/upsell-control.js', array( 'customize-controls' ), false, true );
wp_enqueue_style(
'generate-customizer-controls-css',
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/upsell-customizer.css',
array(),
GENERATE_VERSION
);
wp_enqueue_script(
'generatepress-upsell',
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/upsell-control.js',
array( 'customize-controls' ),
GENERATE_VERSION,
true
);
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,142 +1,142 @@
.customize-control-generatepress-range-slider .generatepress-slider {
position: relative;
width: calc(100% - 60px);
height: 6px;
background-color: rgba(0,0,0,.10);
cursor: pointer;
-webkit-transition: background .5s;
-moz-transition: background .5s;
transition: background .5s;
}
.customize-control-generatepress-range-slider .has-unit .generatepress-slider {
width: calc(100% - 90px);
}
.customize-control-generatepress-range-slider .gp_range_value.hide-value {
display: none;
}
.customize-control-generatepress-range-slider .gp_range_value.hide-value + .generatepress-slider {
width: 100%;
}
.customize-control-generatepress-range-slider .generatepress-slider .ui-slider-handle {
height: 16px;
width: 16px;
background-color: #3498D9;
display: inline-block;
position: absolute;
top: 50%;
-webkit-transform: translateY(-50%) translateX(-4px);
transform: translateY(-50%) translateX(-4px);
border-radius: 50%;
cursor: pointer;
}
.gp-range-title-area {
display: flex;
}
.gp-range-slider-controls {
margin-left: auto;
}
.customize-control-generatepress-range-slider .wrapper {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.customize-control-generatepress-range-slider .gp_range_value {
font-size: 14px;
padding: 0;
font-weight: 400;
width: 50px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.customize-control-generatepress-range-slider .has-unit .gp_range_value {
width: 80px;
}
.customize-control-generatepress-range-slider .gp_range_value span.value {
font-size: 12px;
width: calc(100% - 2px);
text-align: center;
min-height: 30px;
background: #FFF;
line-height: 30px;
border: 1px solid #DDD;
}
.customize-control-generatepress-range-slider .has-unit .gp_range_value span.value {
width: calc(100% - 32px);
display: block;
}
.customize-control-generatepress-range-slider .gp_range_value .unit {
width: 29px;
text-align: center;
font-size: 12px;
line-height: 30px;
background: #fff;
border: 1px solid #ddd;
margin-left: 1px;
}
.customize-control-generatepress-range-slider .generatepress-range-slider-reset span {
font-size: 16px;
line-height: 22px;
}
.customize-control-generatepress-range-slider .gp_range_value input {
font-size: 12px;
padding: 0px;
text-align: center;
min-height: 30px;
height: auto;
border-radius: 0;
border-color: #ddd;
}
.customize-control-generatepress-range-slider .has-unit .gp_range_value input {
width: calc(100% - 30px);
}
.customize-control-generatepress-range-slider .gp-range-title-area .dashicons {
cursor: pointer;
font-size: 11px;
width: 20px;
height: 20px;
line-height: 20px;
color: #222;
text-align: center;
position: relative;
top: 2px;
}
.customize-control-generatepress-range-slider .gp-range-title-area .dashicons:hover {
background: #fafafa;
}
.customize-control-generatepress-range-slider .gp-range-title-area .dashicons.selected {
background: #fff;
color: #222;
}
.customize-control-generatepress-range-slider .gp-device-controls > span:first-child:last-child {
display: none;
}
.customize-control-generatepress-range-slider .sub-description {
margin-top: 10px;
}
.customize-control-generatepress-range-slider .generatepress-slider {
position: relative;
width: calc(100% - 60px);
height: 6px;
background-color: rgba(0,0,0,.10);
cursor: pointer;
-webkit-transition: background .5s;
-moz-transition: background .5s;
transition: background .5s;
}
.customize-control-generatepress-range-slider .has-unit .generatepress-slider {
width: calc(100% - 90px);
}
.customize-control-generatepress-range-slider .gp_range_value.hide-value {
display: none;
}
.customize-control-generatepress-range-slider .gp_range_value.hide-value + .generatepress-slider {
width: 100%;
}
.customize-control-generatepress-range-slider .generatepress-slider .ui-slider-handle {
height: 16px;
width: 16px;
background-color: #3498D9;
display: inline-block;
position: absolute;
top: 50%;
-webkit-transform: translateY(-50%) translateX(-4px);
transform: translateY(-50%) translateX(-4px);
border-radius: 50%;
cursor: pointer;
}
.gp-range-title-area {
display: flex;
}
.gp-range-slider-controls {
margin-left: auto;
}
.customize-control-generatepress-range-slider .wrapper {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.customize-control-generatepress-range-slider .gp_range_value {
font-size: 14px;
padding: 0;
font-weight: 400;
width: 50px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.customize-control-generatepress-range-slider .has-unit .gp_range_value {
width: 80px;
}
.customize-control-generatepress-range-slider .gp_range_value span.value {
font-size: 12px;
width: calc(100% - 2px);
text-align: center;
min-height: 30px;
background: #FFF;
line-height: 30px;
border: 1px solid #DDD;
}
.customize-control-generatepress-range-slider .has-unit .gp_range_value span.value {
width: calc(100% - 32px);
display: block;
}
.customize-control-generatepress-range-slider .gp_range_value .unit {
width: 29px;
text-align: center;
font-size: 12px;
line-height: 30px;
background: #fff;
border: 1px solid #ddd;
margin-left: 1px;
}
.customize-control-generatepress-range-slider .generatepress-range-slider-reset span {
font-size: 16px;
line-height: 22px;
}
.customize-control-generatepress-range-slider .gp_range_value input {
font-size: 12px;
padding: 0px;
text-align: center;
min-height: 30px;
height: auto;
border-radius: 0;
border-color: #ddd;
}
.customize-control-generatepress-range-slider .has-unit .gp_range_value input {
width: calc(100% - 30px);
}
.customize-control-generatepress-range-slider .gp-range-title-area .dashicons {
cursor: pointer;
font-size: 11px;
width: 20px;
height: 20px;
line-height: 20px;
color: #222;
text-align: center;
position: relative;
top: 2px;
}
.customize-control-generatepress-range-slider .gp-range-title-area .dashicons:hover {
background: #fafafa;
}
.customize-control-generatepress-range-slider .gp-range-title-area .dashicons.selected {
background: #fff;
color: #222;
}
.customize-control-generatepress-range-slider .gp-device-controls > span:first-child:last-child {
display: none;
}
.customize-control-generatepress-range-slider .sub-description {
margin-top: 10px;
}

View File

@ -1,47 +1,47 @@
.generatepress-font-family {
margin-bottom: 12px;
}
.generatepress-weight-transform-wrapper {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
.generatepress-font-weight,
.generatepress-font-transform {
width: calc(50% - 5px);
}
span.select2-container.select2-container--default.select2-container--open li.select2-results__option {
margin:0;
}
span.select2-container.select2-container--default.select2-container--open{
z-index:999999;
}
.select2-selection__rendered li {
margin-bottom: 0;
}
.select2-container--default .select2-selection--single,
.select2-container--default.select2-container .select2-selection--multiple,
.select2-dropdown,
.select2-container--default .select2-selection--multiple .select2-selection__choice {
border-color: #ddd;
border-radius: 0;
}
.select2-container--default .select2-results__option[aria-selected=true] {
color: rgba(0,0,0,0.4);
}
#customize-control-font_heading_1_control,
#customize-control-font_heading_2_control,
#customize-control-font_heading_3_control {
margin-top: 20px;
}
.generatepress-font-family {
margin-bottom: 12px;
}
.generatepress-weight-transform-wrapper {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
.generatepress-font-weight,
.generatepress-font-transform {
width: calc(50% - 5px);
}
span.select2-container.select2-container--default.select2-container--open li.select2-results__option {
margin:0;
}
span.select2-container.select2-container--default.select2-container--open{
z-index:999999;
}
.select2-selection__rendered li {
margin-bottom: 0;
}
.select2-container--default .select2-selection--single,
.select2-container--default.select2-container .select2-selection--multiple,
.select2-dropdown,
.select2-container--default .select2-selection--multiple .select2-selection__choice {
border-color: #ddd;
border-radius: 0;
}
.select2-container--default .select2-results__option[aria-selected=true] {
color: rgba(0,0,0,0.4);
}
#customize-control-font_heading_1_control,
#customize-control-font_heading_2_control,
#customize-control-font_heading_3_control {
margin-top: 20px;
}

View File

@ -44,11 +44,11 @@ li#accordion-section-generatepress_upsell_section {
border: none;
background: none;
font: normal 20px/1 dashicons;
speak: none;
speak: never;
display: block;
padding: 0;
text-indent: 0;
text-align: center;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
}

View File

@ -3,7 +3,7 @@
// Add callback for when the header_textcolor setting exists.
api( 'generate_settings[nav_position_setting]', function( setting ) {
var isNavFloated, linkSettingValueToControlActiveState;
var isNavFloated, isNavAlignable, setNavDropPointActiveState, setNavAlignmentsActiveState;
/**
* Determine whether the navigation is floating.
@ -18,12 +18,31 @@
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
*/
linkSettingValueToControlActiveState = function( control ) {
setNavDropPointActiveState = function( control ) {
var setActiveState = function() {
control.active.set( isNavFloated() );
};
@ -49,33 +68,96 @@
setting.bind( setActiveState );
};
// Call linkSettingValueToControlActiveState on the navigation dropdown point.
api.control( 'generate_settings[nav_drop_point]', linkSettingValueToControlActiveState );
/**
* 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( headerAlignment, navLocation, navAlignment ) {
if ( headerAlignment ) {
api.control( 'generate_settings[header_alignment_setting]' ).setting.set( headerAlignment );
var setOption = function( options ) {
if ( options.headerAlignment ) {
api.instance( 'generate_settings[header_alignment_setting]' ).set( options.headerAlignment );
}
if ( navLocation ) {
api.control( 'generate_settings[nav_position_setting]' ).setting.set( navLocation );
if ( options.navLocation ) {
api.instance( 'generate_settings[nav_position_setting]' ).set( options.navLocation );
}
if ( navAlignment ) {
api.control( 'generate_settings[nav_alignment_setting]' ).setting.set( navAlignment );
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;
navAlignment = false,
boxAlignment = false,
siteTitleFontSize = false,
hideSiteTagline = false,
headerPaddingTop = false,
headerPaddingBottom = false;
value.bind( function( newval ) {
var headerAlignmentSetting = api.control( 'generate_settings[header_alignment_setting]' ).setting;
var navLocationSetting = api.control( 'generate_settings[nav_position_setting]' ).setting;
var navAlignmentSetting = api.control( 'generate_settings[nav_alignment_setting]' ).setting;
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();
@ -89,28 +171,109 @@
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 ) {
setOption( headerAlignment, navLocation, navAlignment );
options = {
headerAlignment: headerAlignment,
navLocation: navLocation,
navAlignment: navAlignment,
boxAlignment: boxAlignment,
siteTitleFontSize: siteTitleFontSize,
hideSiteTagline: hideSiteTagline,
headerPaddingTop: headerPaddingTop,
headerPaddingBottom: headerPaddingBottom,
};
setOption( options );
}
if ( 'default' === newval ) {
setOption( generatepress_defaults.header_alignment_setting, generatepress_defaults.nav_position_setting, generatepress_defaults.nav_alignment_setting );
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 ) {
setOption( 'center', 'nav-above-header', 'center' );
options['headerAlignment'] = 'center';
options['navLocation'] = 'nav-above-header';
options['navAlignment'] = 'center';
setOption( options );
}
if ( 'nav-after-centered' === newval ) {
setOption( 'center', 'nav-below-header', 'center' );
}
options['headerAlignment'] = 'center';
options['navLocation'] = 'nav-below-header';
options['navAlignment'] = 'center';
if ( 'nav-right' === newval ) {
setOption( 'left', 'nav-float-right', 'left' );
setOption( options );
}
if ( 'nav-left' === newval ) {
setOption( 'right', 'nav-float-left', 'right' );
options['headerAlignment'] = 'left';
options['navLocation'] = 'nav-float-left';
options['navAlignment'] = 'right';
setOption( options );
}
} );
} );
@ -231,24 +394,24 @@
subMenuCurrentTextColorSetting.set( generatepress_color_defaults.subnavigation_text_current_color );
}
if ( 'white' === newval ) {
backgroundColorSetting.set( '#ffffff' );
textColorSetting.set( '#000000' );
if ( 'classic' === newval ) {
backgroundColorSetting.set( '#222222' );
textColorSetting.set( '#ffffff' );
backgroundColorHoverSetting.set( '#ffffff' );
textColorHoverSetting.set( '#8f919e' );
backgroundColorHoverSetting.set( '#3f3f3f' );
textColorHoverSetting.set( '#ffffff' );
currentBackgroundColorSetting.set( '#ffffff' );
currentTextColorSetting.set( '#8f919e' );
currentBackgroundColorSetting.set( '#3f3f3f' );
currentTextColorSetting.set( '#ffffff' );
subMenuBackgroundColorSetting.set( '#f6f9fc' );
subMenuTextColorSetting.set( '#000000' );
subMenuBackgroundColorSetting.set( '#3f3f3f' );
subMenuTextColorSetting.set( '#ffffff' );
subMenuBackgroundColorHoverSetting.set( '#f6f9fc' );
subMenuTextColorHoverSetting.set( '#8f919e' );
subMenuBackgroundColorHoverSetting.set( '#4f4f4f' );
subMenuTextColorHoverSetting.set( '#ffffff' );
subMenuCurrentBackgroundColorSetting.set( '#f6f9fc' );
subMenuCurrentTextColorSetting.set( '#8f919e' );
subMenuCurrentBackgroundColorSetting.set( '#4f4f4f' );
subMenuCurrentTextColorSetting.set( '#ffffff' );
}
if ( 'grey' === newval ) {

View File

@ -348,11 +348,6 @@ function generatepress_typography_live_update( id, selector, property, unit, med
generatepress_typography_live_update( 'heading_3_line_height', 'h3', 'line-height', 'em' );
}
/**
* Content layout
*/
generatepress_classes_live_update( 'content_layout_setting', [ 'one-container', 'separate-containers' ], 'body' );
/**
* Top bar width
*/
@ -432,18 +427,25 @@ function generatepress_typography_live_update( id, selector, property, unit, med
*/
wp.customize( 'generate_settings[nav_layout_setting]', function( value ) {
value.bind( function( newval ) {
var navLocation = wp.customize.value('generate_settings[nav_position_setting]')();
if ( $( 'body' ).hasClass( 'sticky-enabled' ) ) {
wp.customize.preview.send( 'refresh' );
} else {
var mainNavigation = $( '.main-navigation' );
if ( 'fluid-nav' == newval ) {
$( '.main-navigation' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
mainNavigation.removeClass( 'grid-container' ).removeClass( 'grid-parent' );
if ( 'full-width' !== wp.customize.value('generate_settings[nav_inner_width]')() ) {
$( '.main-navigation .inside-navigation' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
}
}
if ( 'contained-nav' == newval ) {
$( '.main-navigation' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
$( '.main-navigation .inside-navigation' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
if ( ! mainNavigation.hasClass( 'has-branding' ) && generatepress_live_preview.isFlex && ( 'nav-float-right' === navLocation || 'nav-float-left' === navLocation ) ) {
return;
}
mainNavigation.addClass( 'grid-container' ).addClass( 'grid-parent' );
}
}
} );
@ -464,78 +466,33 @@ function generatepress_typography_live_update( id, selector, property, unit, med
} );
/**
* Navigation position
* Navigation alignment
*/
wp.customize( 'generate_settings[nav_position_setting]', function( value ) {
wp.customize( 'generate_settings[nav_alignment_setting]', function( value ) {
value.bind( function( newval ) {
$( 'body' ).trigger( 'generate_navigation_location_updated' );
var classes = [ 'left', 'center', 'right' ];
var selector = 'body';
var prefix = 'nav-aligned-';
// Update navigation alignment settings.
$( 'body' ).removeClass( 'nav-aligned-center' );
$( 'body' ).removeClass( 'nav-aligned-left' );
$( 'body' ).removeClass( 'nav-aligned-right' );
$( 'body' ).addClass( 'nav-aligned-' + wp.customize.value('generate_settings[nav_alignment_setting]')() );
if ( $( '.gen-sidebar-nav' ).length ) {
wp.customize.preview.send( 'refresh' );
return false;
}
if ( 'nav-left-sidebar' == newval ) {
wp.customize.preview.send( 'refresh' );
return false;
}
if ( 'nav-right-sidebar' == newval ) {
wp.customize.preview.send( 'refresh' );
return false;
if ( generatepress_live_preview.isFlex ) {
selector = '.main-navigation:not(.slideout-navigation)';
prefix = 'nav-align-';
}
if ( '' !== wp.customize.value('generate_settings[nav_drop_point]')() ) {
wp.customize.preview.send( 'refresh' );
return false;
}
jQuery.each( classes, function( i, v ) {
jQuery( selector ).removeClass( prefix + v );
});
var classes = [ 'nav-below-header', 'nav-above-header', 'nav-float-right', 'nav-float-left', 'nav-left-sidebar', 'nav-right-sidebar' ];
if ( 'nav-left-sidebar' !== newval && 'nav-right-sidebar' !== newval ) {
$.each( classes, function( i, v ) {
$( 'body' ).removeClass( v );
});
}
$( 'body' ).addClass( newval );
if ( 'nav-below-header' == newval ) {
$( '#site-navigation:first' ).insertAfter( '.site-header' ).show();
}
if ( 'nav-above-header' == newval ) {
if ( $( '.top-bar:not(.secondary-navigation .top-bar)' ).length ) {
$( '#site-navigation:first' ).insertAfter( '.top-bar' ).show();
} else {
$( '#site-navigation:first' ).prependTo( 'body' ).show();
}
}
if ( 'nav-float-right' == newval ) {
if ( ! $( 'body' ).hasClass( 'using-floats' ) && $( '.header-widget' ).length ) {
$( '#site-navigation:first' ).insertBefore( '.header-widget' ).show();
} else {
$( '#site-navigation:first' ).appendTo( '.inside-header' ).show();
}
}
if ( 'nav-float-left' == newval ) {
$( '#site-navigation:first' ).appendTo( '.inside-header' ).show();
}
if ( '' == newval ) {
if ( $( '.gen-sidebar-nav' ).length ) {
wp.customize.preview.send( 'refresh' );
} else {
$( '#site-navigation:first' ).hide();
if ( generatepress_live_preview.isFlex && generatepress_live_preview.isRTL ) {
jQuery( selector ).addClass( prefix + newval );
} else {
if ( 'nav-align-left' !== prefix + newval ) {
jQuery( selector ).addClass( prefix + newval );
}
}
} );
} );
/**
* Navigation alignment
*/
generatepress_classes_live_update( 'nav_alignment_setting', [ 'left', 'center', 'right' ], 'body', 'nav-aligned-' );
/**
* Footer width
*/
@ -582,10 +539,11 @@ function generatepress_typography_live_update( id, selector, property, unit, med
jQuery( 'body' ).on( 'generate_spacing_updated', function() {
var containerAlignment = wp.customize( 'generate_settings[container_alignment]' ).get(),
containerWidth = wp.customize( 'generate_settings[container_width]' ).get(),
containerLayout = wp.customize( 'generate_settings[content_layout_setting]' ).get(),
contentLeft = generatepress_live_preview.contentLeft,
contentRight = generatepress_live_preview.contentRight;
if ( 'text' === containerAlignment ) {
if ( ! generatepress_live_preview.isFlex && 'text' === containerAlignment ) {
if ( typeof wp.customize( 'generate_spacing_settings[content_left]' ) !== 'undefined' ) {
contentLeft = wp.customize( 'generate_spacing_settings[content_left]' ).get();
}
@ -597,13 +555,110 @@ function generatepress_typography_live_update( id, selector, property, unit, med
var newContainerWidth = Number( containerWidth ) + Number( contentLeft ) + Number( contentRight );
if ( jQuery( 'style#wide_container_width' ).length ) {
jQuery( 'style#wide_container_width' ).html( '#page{max-width:' + newContainerWidth + 'px;}' );
jQuery( 'style#wide_container_width' ).html( 'body:not(.full-width-content) #page{max-width:' + newContainerWidth + 'px;}' );
} else {
jQuery( 'head' ).append( '<style id="wide_container_width">#page{max-width:' + newContainerWidth + 'px;}</style>' );
jQuery( 'head' ).append( '<style id="wide_container_width">body:not(.full-width-content) #page{max-width:' + newContainerWidth + 'px;}</style>' );
setTimeout(function() {
jQuery( 'style#wide_container_width' ).not( ':last' ).remove();
}, 100);
}
}
if ( generatepress_live_preview.isFlex && 'boxes' === containerAlignment ) {
var topBarPaddingLeft = jQuery( '.inside-top-bar' ).css( 'padding-left' ),
topBarPaddingRight = jQuery( '.inside-top-bar' ).css( 'padding-right' ),
headerPaddingLeft = jQuery( '.inside-header' ).css( 'padding-left' ),
headerPaddingRight = jQuery( '.inside-header' ).css( 'padding-right' ),
footerWidgetPaddingLeft = jQuery( '.footer-widgets-container' ).css( 'padding-left' ),
footerWidgetPaddingRight = jQuery( '.footer-widgets-container' ).css( 'padding-right' ),
footerBarPaddingLeft = jQuery( '.inside-footer-bar' ).css( 'padding-left' ),
footerBarPaddingRight = jQuery( '.inside-footer-bar' ).css( 'padding-right' );
if ( typeof wp.customize( 'generate_spacing_settings[top_bar_left]' ) !== 'undefined' ) {
topBarPaddingLeft = wp.customize( 'generate_spacing_settings[top_bar_left]' ).get() + 'px';
}
if ( typeof wp.customize( 'generate_spacing_settings[top_bar_right]' ) !== 'undefined' ) {
topBarPaddingRight = wp.customize( 'generate_spacing_settings[top_bar_right]' ).get() + 'px';
}
if ( typeof wp.customize( 'generate_spacing_settings[header_left]' ) !== 'undefined' ) {
headerPaddingLeft = wp.customize( 'generate_spacing_settings[header_left]' ).get() + 'px';
}
if ( typeof wp.customize( 'generate_spacing_settings[header_right]' ) !== 'undefined' ) {
headerPaddingRight = wp.customize( 'generate_spacing_settings[header_right]' ).get() + 'px';
}
if ( typeof wp.customize( 'generate_spacing_settings[footer_widget_container_left]' ) !== 'undefined' ) {
footerWidgetPaddingLeft = wp.customize( 'generate_spacing_settings[footer_widget_container_left]' ).get() + 'px';
}
if ( typeof wp.customize( 'generate_spacing_settings[footer_widget_container_right]' ) !== 'undefined' ) {
footerWidgetPaddingRight = wp.customize( 'generate_spacing_settings[footer_widget_container_right]' ).get() + 'px';
}
if ( typeof wp.customize( 'generate_spacing_settings[footer_left]' ) !== 'undefined' ) {
footerBarPaddingLeft = wp.customize( 'generate_spacing_settings[footer_left]' ).get() + 'px';
}
if ( typeof wp.customize( 'generate_spacing_settings[footer_right]' ) !== 'undefined' ) {
footerBarPaddingRight = wp.customize( 'generate_spacing_settings[footer_right]' ).get() + 'px';
}
var newTopBarWidth = parseFloat( containerWidth ) + parseFloat( topBarPaddingLeft ) + parseFloat( topBarPaddingRight ),
newHeaderWidth = parseFloat( containerWidth ) + parseFloat( headerPaddingLeft ) + parseFloat( headerPaddingRight ),
newFooterWidgetWidth = parseFloat( containerWidth ) + parseFloat( footerWidgetPaddingLeft ) + parseFloat( footerWidgetPaddingRight ),
newFooterBarWidth = parseFloat( containerWidth ) + parseFloat( footerBarPaddingLeft ) + parseFloat( footerBarPaddingRight );
if ( jQuery( 'style#box_sizing_widths' ).length ) {
jQuery( 'style#box_sizing_widths' ).html( '.inside-top-bar.grid-container{max-width:' + newTopBarWidth + 'px;}.inside-header.grid-container{max-width:' + newHeaderWidth + 'px;}.footer-widgets-container.grid-container{max-width:' + newFooterWidgetWidth + 'px;}.inside-site-info.grid-container{max-width:' + newFooterBarWidth + 'px;}' );
} else {
jQuery( 'head' ).append( '<style id="box_sizing_widths">.inside-top-bar.grid-container{max-width:' + newTopBarWidth + 'px;}.inside-header.grid-container{max-width:' + newHeaderWidth + 'px;}.footer-widgets-container.grid-container{max-width:' + newFooterWidgetWidth + 'px;}.inside-site-info.grid-container{max-width:' + newFooterBarWidth + 'px;}</style>' );
setTimeout(function() {
jQuery( 'style#box_sizing_widths' ).not( ':last' ).remove();
}, 100);
}
}
if ( generatepress_live_preview.isFlex && 'text' === containerAlignment ) {
var headerPaddingLeft = jQuery( '.inside-header' ).css( 'padding-left' ),
headerPaddingRight = jQuery( '.inside-header' ).css( 'padding-right' ),
menuItemPadding = jQuery( '.main-navigation .main-nav ul li a' ).css( 'padding-left' ),
secondaryMenuItemPadding = jQuery( '.secondary-navigation .main-nav ul li a' ).css( 'padding-left' );
if ( typeof wp.customize( 'generate_spacing_settings[header_left]' ) !== 'undefined' ) {
headerPaddingLeft = wp.customize( 'generate_spacing_settings[header_left]' ).get() + 'px';
}
if ( typeof wp.customize( 'generate_spacing_settings[header_right]' ) !== 'undefined' ) {
headerPaddingRight = wp.customize( 'generate_spacing_settings[header_right]' ).get() + 'px';
}
if ( typeof wp.customize( 'generate_spacing_settings[menu_item]' ) !== 'undefined' ) {
menuItemPadding = wp.customize( 'generate_spacing_settings[menu_item]' ).get() + 'px';
}
if ( typeof wp.customize( 'generate_spacing_settings[secondary_menu_item]' ) !== 'undefined' ) {
secondaryMenuItemPadding = wp.customize( 'generate_spacing_settings[secondary_menu_item]' ).get() + 'px';
}
var newNavPaddingLeft = parseFloat( headerPaddingLeft ) - parseFloat( menuItemPadding ),
newNavPaddingRight = parseFloat( headerPaddingRight ) - parseFloat( menuItemPadding ),
newSecondaryNavPaddingLeft = parseFloat( headerPaddingLeft ) - parseFloat( secondaryMenuItemPadding ),
newSecondaryNavPaddingRight = parseFloat( headerPaddingRight ) - parseFloat( secondaryMenuItemPadding );
if ( jQuery( 'style#navigation_padding' ).length ) {
jQuery( 'style#navigation_padding' ).html( '.nav-below-header .main-navigation .inside-navigation.grid-container, .nav-above-header .main-navigation .inside-navigation.grid-container{padding: 0 ' + newNavPaddingRight + 'px 0 ' + newNavPaddingLeft + 'px;}' );
jQuery( 'style#secondary_navigation_padding' ).html( '.secondary-nav-below-header .secondary-navigation .inside-navigation.grid-container, .secondary-nav-above-header .secondary-navigation .inside-navigation.grid-container{padding: 0 ' + newSecondaryNavPaddingRight + 'px 0 ' + newSecondaryNavPaddingLeft + 'px;}' );
} else {
jQuery( 'head' ).append( '<style id="navigation_padding">.nav-below-header .main-navigation .inside-navigation.grid-container, .nav-above-header .main-navigation .inside-navigation.grid-container{padding: 0 ' + newNavPaddingRight + 'px 0 ' + newNavPaddingLeft + 'px;}</style>' );
jQuery( 'head' ).append( '<style id="secondary_navigation_padding">.secondary-nav-below-header .secondary-navigation .inside-navigation.grid-container, .secondary-nav-above-header .secondary-navigation .inside-navigation.grid-container{padding: 0 ' + newSecondaryNavPaddingRight + 'px 0 ' + newSecondaryNavPaddingLeft + 'px;}</style>' );
setTimeout(function() {
jQuery( 'style#navigation_padding' ).not( ':last' ).remove();
jQuery( 'style#secondary_navigation_padding' ).not( ':last' ).remove();
}, 100);
}
}
} );
} )( jQuery );

File diff suppressed because one or more lines are too long

View File

@ -1,154 +1,154 @@
( function( api ) {
api.controlConstructor['gp-customizer-typography'] = api.Control.extend( {
ready: function() {
var control = this;
control.container.on( 'change', '.generatepress-font-family select',
function() {
var _this = jQuery( this ),
_value = _this.val(),
_categoryID = _this.attr( 'data-category' ),
_variantsID = _this.attr( 'data-variants' );
// Set our font family
control.settings['family'].set( _this.val() );
// Bail if our controls don't exist
if ( 'undefined' == typeof control.settings['category'] || 'undefined' == typeof control.settings['variant'] ) {
return;
}
setTimeout( function() {
// Send our request to the generate_get_all_google_fonts_ajax function
var response = jQuery.getJSON({
type: 'POST',
url: ajaxurl,
data: {
action: 'generate_get_all_google_fonts_ajax',
gp_customize_nonce: gp_customize.nonce
},
async: false,
dataType: 'json',
});
// Get our response
var fonts = response.responseJSON;
// Create an ID from our selected font
var id = _value.split(' ').join('_').toLowerCase();
// Set our values if we have them
if ( id in fonts ) {
// Get existing variants if this font is already selected
var got_variants = false;
jQuery( '.generatepress-font-family select' ).not( _this ).each( function( key, select ) {
var parent = jQuery( this ).closest( '.generatepress-font-family' );
if ( _value == jQuery( select ).val() && _this.data( 'category' ) !== jQuery( select ).data( 'category' ) ) {
if ( ! got_variants ) {
updated_variants = jQuery( parent.next( '.generatepress-font-variant' ).find( 'select' ) ).val();
got_variants = true;
}
}
} );
// We're using a Google font, so show the variants field
_this.closest( '.generatepress-font-family' ).next( 'div' ).show();
// Remove existing variants
jQuery( 'select[name="' + _variantsID + '"]' ).find( 'option' ).remove();
// Populate our select input with available variants
jQuery.each( fonts[ id ].variants, function( key, value ) {
jQuery( 'select[name="' + _variantsID + '"]' ).append( jQuery( '<option></option>' ).attr( 'value', value ).text( value ) );
} );
// Set our variants
if ( ! got_variants ) {
control.settings[ 'variant' ].set( fonts[ id ].variants );
} else {
control.settings[ 'variant' ].set( updated_variants );
}
// Set our font category
control.settings[ 'category' ].set( fonts[ id ].category );
jQuery( 'input[name="' + _categoryID + '"' ).val( fonts[ id ].category );
} else {
_this.closest( '.generatepress-font-family' ).next( 'div' ).hide();
control.settings[ 'category' ].set( '' )
control.settings[ 'variant' ].set( '' )
jQuery( 'input[name="' + _categoryID + '"' ).val( '' );
jQuery( 'select[name="' + _variantsID + '"]' ).find( 'option' ).remove();
}
}, 25 );
}
);
control.container.on( 'change', '.generatepress-font-variant select',
function() {
var _this = jQuery( this );
var variants = _this.val();
control.settings['variant'].set( variants );
jQuery( '.generatepress-font-variant select' ).each( function( key, value ) {
var this_control = jQuery( this ).closest( 'li' ).attr( 'id' ).replace( 'customize-control-', '' );
var parent = jQuery( this ).closest( '.generatepress-font-variant' );
var font_val = api.control( this_control ).settings['family'].get();
if ( font_val == control.settings['family'].get() && _this.attr( 'name' ) !== jQuery( value ).attr( 'name' ) ) {
jQuery( parent.find( 'select' ) ).not( _this ).val( variants ).triggerHandler( 'change' );
api.control( this_control ).settings['variant'].set( variants );
}
} );
}
);
control.container.on( 'change', '.generatepress-font-category input',
function() {
control.settings['category'].set( jQuery( this ).val() );
}
);
control.container.on( 'change', '.generatepress-font-weight select',
function() {
control.settings['weight'].set( jQuery( this ).val() );
}
);
control.container.on( 'change', '.generatepress-font-transform select',
function() {
control.settings['transform'].set( jQuery( this ).val() );
}
);
}
} );
} )( wp.customize );
jQuery( document ).ready( function( $ ) {
$( '.generatepress-font-family select' ).select2();
$( '.generatepress-font-variant' ).each( function( key, value ) {
var _this = $( this );
var value = _this.data( 'saved-value' );
if ( value ) {
value = value.toString().split( ',' );
}
_this.find( 'select' ).select2().val( value ).trigger( 'change.select2' );
} );
$( ".generatepress-font-family" ).each( function( key, value ) {
var _this = $( this );
if ( $.inArray( _this.find( 'select' ).val(), typography_defaults ) !== -1 ) {
_this.next( '.generatepress-font-variant' ).hide();
}
} );
} );
( function( api ) {
api.controlConstructor['gp-customizer-typography'] = api.Control.extend( {
ready: function() {
var control = this;
control.container.on( 'change', '.generatepress-font-family select',
function() {
var _this = jQuery( this ),
_value = _this.val(),
_categoryID = _this.attr( 'data-category' ),
_variantsID = _this.attr( 'data-variants' );
// Set our font family
control.settings['family'].set( _this.val() );
// Bail if our controls don't exist
if ( 'undefined' == typeof control.settings['category'] || 'undefined' == typeof control.settings['variant'] ) {
return;
}
setTimeout( function() {
// Send our request to the generate_get_all_google_fonts_ajax function
var response = jQuery.getJSON({
type: 'POST',
url: ajaxurl,
data: {
action: 'generate_get_all_google_fonts_ajax',
gp_customize_nonce: gp_customize.nonce
},
async: false,
dataType: 'json',
});
// Get our response
var fonts = response.responseJSON;
// Create an ID from our selected font
var id = _value.split(' ').join('_').toLowerCase();
// Set our values if we have them
if ( id in fonts ) {
// Get existing variants if this font is already selected
var got_variants = false;
jQuery( '.generatepress-font-family select' ).not( _this ).each( function( key, select ) {
var parent = jQuery( this ).closest( '.generatepress-font-family' );
if ( _value == jQuery( select ).val() && _this.data( 'category' ) !== jQuery( select ).data( 'category' ) ) {
if ( ! got_variants ) {
updated_variants = jQuery( parent.next( '.generatepress-font-variant' ).find( 'select' ) ).val();
got_variants = true;
}
}
} );
// We're using a Google font, so show the variants field
_this.closest( '.generatepress-font-family' ).next( 'div' ).show();
// Remove existing variants
jQuery( 'select[name="' + _variantsID + '"]' ).find( 'option' ).remove();
// Populate our select input with available variants
jQuery.each( fonts[ id ].variants, function( key, value ) {
jQuery( 'select[name="' + _variantsID + '"]' ).append( jQuery( '<option></option>' ).attr( 'value', value ).text( value ) );
} );
// Set our variants
if ( ! got_variants ) {
control.settings[ 'variant' ].set( fonts[ id ].variants );
} else {
control.settings[ 'variant' ].set( updated_variants );
}
// Set our font category
control.settings[ 'category' ].set( fonts[ id ].category );
jQuery( 'input[name="' + _categoryID + '"' ).val( fonts[ id ].category );
} else {
_this.closest( '.generatepress-font-family' ).next( 'div' ).hide();
control.settings[ 'category' ].set( '' )
control.settings[ 'variant' ].set( '' )
jQuery( 'input[name="' + _categoryID + '"' ).val( '' );
jQuery( 'select[name="' + _variantsID + '"]' ).find( 'option' ).remove();
}
}, 25 );
}
);
control.container.on( 'change', '.generatepress-font-variant select',
function() {
var _this = jQuery( this );
var variants = _this.val();
control.settings['variant'].set( variants );
jQuery( '.generatepress-font-variant select' ).each( function( key, value ) {
var this_control = jQuery( this ).closest( 'li' ).attr( 'id' ).replace( 'customize-control-', '' );
var parent = jQuery( this ).closest( '.generatepress-font-variant' );
var font_val = api.control( this_control ).settings['family'].get();
if ( font_val == control.settings['family'].get() && _this.attr( 'name' ) !== jQuery( value ).attr( 'name' ) ) {
jQuery( parent.find( 'select' ) ).not( _this ).val( variants ).triggerHandler( 'change' );
api.control( this_control ).settings['variant'].set( variants );
}
} );
}
);
control.container.on( 'change', '.generatepress-font-category input',
function() {
control.settings['category'].set( jQuery( this ).val() );
}
);
control.container.on( 'change', '.generatepress-font-weight select',
function() {
control.settings['weight'].set( jQuery( this ).val() );
}
);
control.container.on( 'change', '.generatepress-font-transform select',
function() {
control.settings['transform'].set( jQuery( this ).val() );
}
);
}
} );
} )( wp.customize );
jQuery( document ).ready( function( $ ) {
$( '.generatepress-font-family select' ).select2();
$( '.generatepress-font-variant' ).each( function( key, value ) {
var _this = $( this );
var value = _this.data( 'saved-value' );
if ( value ) {
value = value.toString().split( ',' );
}
_this.find( 'select' ).select2().val( value ).trigger( 'change.select2' );
} );
$( ".generatepress-font-family" ).each( function( key, value ) {
var _this = $( this );
if ( $.inArray( _this.find( 'select' ).val(), typography_defaults ) !== -1 ) {
_this.next( '.generatepress-font-variant' ).hide();
}
} );
} );

View File

@ -9,15 +9,15 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
// Controls
// 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
// Helper functions.
require_once trailingslashit( dirname( __FILE__ ) ) . 'helpers.php';
// Deprecated
// Deprecated.
require_once trailingslashit( dirname( __FILE__ ) ) . 'deprecated.php';

View File

@ -15,24 +15,25 @@ if ( ! function_exists( 'generate_sanitize_typography' ) ) {
*
* @since 1.1.10
* @deprecated 1.3.45
* @param string $input The value to check.
*/
function generate_sanitize_typography( $input ) {
// Grab all of our fonts
// Grab all of our fonts.
$fonts = generate_get_all_google_fonts();
// Loop through all of them and grab their names
// Loop through all of them and grab their names.
$font_names = array();
foreach ( $fonts as $k => $fam ) {
$font_names[] = $fam['name'];
}
// Get all non-Google font names
// Get all non-Google font names.
$not_google = generate_typography_default_fonts();
// Merge them both into one array
// Merge them both into one array.
$valid = array_merge( $font_names, $not_google );
// Sanitize
// Sanitize.
if ( in_array( $input, $valid ) ) {
return $input;
} else {
@ -47,6 +48,7 @@ if ( ! function_exists( 'generate_sanitize_font_weight' ) ) {
*
* @since 1.1.10
* @deprecated 1.3.40
* @param string $input The value to check.
*/
function generate_sanitize_font_weight( $input ) {
@ -78,6 +80,7 @@ if ( ! function_exists( 'generate_sanitize_text_transform' ) ) {
*
* @since 1.1.10
* @deprecated 1.3.40
* @param string $input The value to check.
*/
function generate_sanitize_text_transform( $input ) {
@ -86,7 +89,7 @@ if ( ! function_exists( 'generate_sanitize_text_transform' ) ) {
'capitalize',
'uppercase',
'lowercase',
);
);
if ( in_array( $input, $valid ) ) {
return $input;
@ -99,6 +102,7 @@ if ( ! function_exists( 'generate_sanitize_text_transform' ) ) {
if ( ! function_exists( 'generate_typography_customize_preview_css' ) ) {
/**
* Hide the hidden input control
*
* @since 1.3.40
*/
function generate_typography_customize_preview_css() {
@ -109,3 +113,21 @@ if ( ! function_exists( 'generate_typography_customize_preview_css' ) ) {
<?php
}
}
if ( ! function_exists( 'generate_hidden_navigation' ) && function_exists( 'is_customize_preview' ) ) {
/**
* Adds a hidden navigation if no navigation is set
* This allows us to use postMessage to position the navigation when it doesn't exist
*
* @since 1.3.40
*/
function generate_hidden_navigation() {
if ( is_customize_preview() && function_exists( 'generate_navigation_position' ) ) {
?>
<div style="display:none;">
<?php generate_navigation_position(); ?>
</div>
<?php
}
}
}

View File

@ -43,25 +43,6 @@ if ( ! function_exists( 'generate_is_top_bar_active' ) ) {
}
}
if ( ! function_exists( 'generate_hidden_navigation' ) && function_exists( 'is_customize_preview' ) ) {
add_action( 'wp_footer', 'generate_hidden_navigation' );
/**
* Adds a hidden navigation if no navigation is set
* This allows us to use postMessage to position the navigation when it doesn't exist
*
* @since 1.3.40
*/
function generate_hidden_navigation() {
if ( is_customize_preview() && function_exists( 'generate_navigation_position' ) ) {
?>
<div style="display:none;">
<?php generate_navigation_position(); ?>
</div>
<?php
}
}
}
if ( ! function_exists( 'generate_customize_partial_blogname' ) ) {
/**
* Render the site title for the selective refresh partial.
@ -92,16 +73,16 @@ if ( ! function_exists( 'generate_enqueue_color_palettes' ) ) {
* @since 1.3.42
*/
function generate_enqueue_color_palettes() {
// Old versions of WP don't get nice things
// Old versions of WP don't get nice things.
if ( ! function_exists( 'wp_add_inline_script' ) ) {
return;
}
// Grab our palette array and turn it into JS
$palettes = json_encode( generate_get_default_color_palettes() );
// 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
// Add our custom palettes.
// json_encode takes care of escaping.
wp_add_inline_script( 'wp-color-picker', 'jQuery.wp.wpColorPicker.prototype.options.palettes = ' . $palettes . ';' );
}
}
@ -111,6 +92,7 @@ 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 );
@ -122,6 +104,7 @@ 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 ) );
@ -132,8 +115,10 @@ if ( ! function_exists( 'generate_sanitize_decimal_integer' ) ) {
* 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 '';
}
@ -146,8 +131,10 @@ 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 );
}
}
@ -158,19 +145,20 @@ if ( ! function_exists( 'generate_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'
);
function generate_sanitize_blog_excerpt( $input ) {
$valid = array(
'full',
'excerpt',
);
if ( in_array( $input, $valid ) ) {
return $input;
} else {
return 'full';
}
}
if ( in_array( $input, $valid ) ) {
return $input;
} else {
return 'full';
}
}
}
if ( ! function_exists( 'generate_sanitize_hex_color' ) ) {
@ -179,25 +167,28 @@ if ( ! function_exists( 'generate_sanitize_hex_color' ) ) {
* Allow blank value.
*
* @since 1.2.9.6
* @param string $color The color to check.
*/
function generate_sanitize_hex_color( $color ) {
if ( '' === $color ) {
return '';
}
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;
}
// 3 or 6 hex digits, or the empty string.
if ( preg_match( '|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) {
return $color;
}
return '';
}
return '';
}
}
/**
* Sanitize RGBA colors.
*
* @since 2.2
* @param string $color The color to check.
*/
function generate_sanitize_rgba_color( $color ) {
if ( '' === $color ) {
@ -211,7 +202,7 @@ function generate_sanitize_rgba_color( $color ) {
$color = str_replace( ' ', '', $color );
sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha );
return 'rgba('.$red.','.$green.','.$blue.','.$alpha.')';
return 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $alpha . ')';
}
if ( ! function_exists( 'generate_sanitize_choices' ) ) {
@ -219,17 +210,19 @@ 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
// Ensure input is a slug.
$input = sanitize_key( $input );
// Get list of choices from the control
// associated with the setting
// 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
// If the input is a valid key, return it.
// otherwise, return the default.
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
}
}
@ -238,6 +231,7 @@ if ( ! function_exists( 'generate_sanitize_choices' ) ) {
* Sanitize our Google Font variants
*
* @since 2.0
* @param string $input The value to check.
*/
function generate_sanitize_variants( $input ) {
if ( is_array( $input ) ) {
@ -256,9 +250,11 @@ add_action( 'customize_controls_enqueue_scripts', 'generate_do_control_inline_sc
* @since 2.0
*/
function generate_do_control_inline_scripts() {
wp_localize_script( 'generatepress-typography-customizer', 'gp_customize',
wp_localize_script(
'generatepress-typography-customizer',
'gp_customize',
array(
'nonce' => wp_create_nonce( 'gp_customize_nonce' )
'nonce' => wp_create_nonce( 'gp_customize_nonce' ),
)
);
@ -268,7 +264,7 @@ function generate_do_control_inline_scripts() {
'generatepress-typography-customizer',
'generatePressTypography',
array(
'googleFonts' => apply_filters( 'generate_typography_customize_list', generate_get_all_google_fonts( $number_of_fonts ) )
'googleFonts' => apply_filters( 'generate_typography_customize_list', generate_get_all_google_fonts( $number_of_fonts ) ),
)
);
@ -277,6 +273,8 @@ function generate_do_control_inline_scripts() {
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' ) ) {
@ -294,13 +292,19 @@ if ( ! function_exists( 'generate_customizer_live_preview' ) ) {
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'] ),
) );
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(),
)
);
}
}
@ -325,6 +329,20 @@ function generate_has_custom_logo_callback() {
*
* @since 2.2
*/
function generate_sanitize_preset_layout( $input ) {
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();
}

View File

@ -17,7 +17,7 @@ if ( ! function_exists( 'generate_create_menu' ) ) {
* @since 0.1
*/
function generate_create_menu() {
$generate_page = add_theme_page( 'GeneratePress', 'GeneratePress', apply_filters( 'generate_dashboard_page_capability', 'edit_theme_options' ), 'generate-options', 'generate_settings_page' );
$generate_page = add_theme_page( esc_html__( 'GeneratePress', 'generatepress' ), esc_html__( 'GeneratePress', 'generatepress' ), apply_filters( 'generate_dashboard_page_capability', 'edit_theme_options' ), 'generate-options', 'generate_settings_page' );
add_action( "admin_print_styles-$generate_page", 'generate_options_styles' );
}
}
@ -29,7 +29,7 @@ if ( ! function_exists( 'generate_options_styles' ) ) {
* @since 0.1
*/
function generate_options_styles() {
wp_enqueue_style( 'generate-options', get_template_directory_uri() . '/css/admin/style.css', array(), GENERATE_VERSION );
wp_enqueue_style( 'generate-options', get_template_directory_uri() . '/assets/css/admin/style.css', array(), GENERATE_VERSION );
}
}
@ -46,14 +46,14 @@ if ( ! function_exists( 'generate_settings_page' ) ) {
<div class="gp-masthead clearfix">
<div class="gp-container">
<div class="gp-title">
<a href="<?php echo generate_get_premium_url( 'https://generatepress.com' ); // WPCS: XSS ok, sanitization ok. ?>" target="_blank">GeneratePress</a> <span class="gp-version"><?php echo GENERATE_VERSION; // WPCS: XSS ok ?></span>
<a href="<?php echo generate_get_premium_url( 'https://generatepress.com' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in function. ?>" target="_blank">GeneratePress</a> <span class="gp-version"><?php echo esc_html( GENERATE_VERSION ); ?></span>
</div>
<div 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/' ); // WPCS: XSS ok, sanitization ok. ?>" target="_blank"><?php esc_html_e( 'Premium', 'generatepress' );?></a>
<a style="font-weight: bold;" href="<?php echo generate_get_premium_url( 'https://generatepress.com/premium/' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in function. ?>" target="_blank"><?php esc_html_e( 'Premium', 'generatepress' ); ?></a>
<?php endif; ?>
<a href="<?php echo esc_url( 'https://generatepress.com/support' ); ?>" target="_blank"><?php esc_html_e( 'Support', 'generatepress' ); ?></a>
<a href="<?php echo esc_url( 'https://docs.generatepress.com' ); ?>" target="_blank"><?php esc_html_e( 'Documentation', 'generatepress' );?></a>
<a href="<?php echo esc_url( 'https://docs.generatepress.com' ); ?>" target="_blank"><?php esc_html_e( 'Documentation', 'generatepress' ); ?></a>
</div>
</div>
</div>
@ -87,7 +87,8 @@ if ( ! function_exists( 'generate_settings_page' ) ) {
<?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>',
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' )
);
@ -107,69 +108,72 @@ if ( ! function_exists( 'generate_settings_page' ) ) {
<?php
$modules = array(
'Backgrounds' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#backgrounds', false ),
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#backgrounds', false ),
),
'Blog' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#blog', false ),
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#blog', false ),
),
'Colors' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#colors', false ),
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#colors', false ),
),
'Copyright' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#copyright', false ),
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#copyright', false ),
),
'Disable Elements' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#disable-elements', false ),
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#disable-elements', false ),
),
'Elements' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#elements', false ),
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#elements', false ),
),
'Import / Export' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#import-export', false ),
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#import-export', false ),
),
'Menu Plus' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#menu-plus', false ),
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#menu-plus', false ),
),
'Secondary Nav' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#secondary-nav', false ),
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#secondary-nav', false ),
),
'Sections' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#sections', false ),
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#sections', false ),
),
'Site Library' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/site-library', false ),
'url' => generate_get_premium_url( 'https://generatepress.com/site-library', false ),
),
'Spacing' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#spacing', false ),
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#spacing', false ),
),
'Typography' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#typography', false ),
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#typography', false ),
),
'WooCommerce' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#woocommerce', false ),
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#woocommerce', false ),
),
);
if ( ! defined( 'GP_PREMIUM_VERSION' ) ) : ?>
if ( ! defined( 'GP_PREMIUM_VERSION' ) ) :
?>
<div class="postbox generate-metabox">
<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>
<?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="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>
<div class="gp-clear"></div>
<?php } ?>
</div>
</div>
</div>
<?php
<?php
endif;
/**
@ -254,7 +258,7 @@ if ( ! function_exists( 'generate_settings_page' ) ) {
?>
<div class="postbox generate-metabox" id="gen-delete">
<h3 class="hndle"><?php esc_html_e( 'Reset Settings', 'generatepress' );?></h3>
<h3 class="hndle"><?php esc_html_e( 'Reset Settings', 'generatepress' ); ?></h3>
<div class="inside">
<p><?php esc_html_e( 'Deleting your settings can not be undone.', 'generatepress' ); ?></p>
<form method="post">
@ -263,9 +267,14 @@ if ( ! function_exists( 'generate_settings_page' ) ) {
<?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,
submit_button(
esc_attr__( 'Reset', 'generatepress' ),
'button-primary',
'submit',
false,
array(
'onclick' => esc_js( $warning )
'onclick' => esc_js( $warning ),
)
);
?>
@ -288,7 +297,7 @@ if ( ! function_exists( 'generate_settings_page' ) ) {
<div class="gp-options-footer">
<span>
<?php
printf( // WPCS: XSS ok
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>'
@ -350,16 +359,18 @@ if ( ! function_exists( 'generate_admin_errors' ) ) {
return;
}
if ( isset( $_GET['settings-updated'] ) && 'true' == $_GET['settings-updated'] ) {
add_settings_error( 'generate-notices', 'true', esc_html__( 'Settings saved.', 'generatepress' ), 'updated' );
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' );
}
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'] ) && 'imported' === $_GET['status'] ) {
add_settings_error( 'generate-notices', 'imported', esc_html__( 'Import successful.', 'generatepress' ), 'updated' );
}
if ( isset( $_GET['status'] ) && 'reset' == $_GET['status'] ) {
add_settings_error( 'generate-notices', 'reset', esc_html__( 'Settings removed.', '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' );

View File

@ -16,10 +16,11 @@ if ( ! function_exists( 'generate_get_defaults' ) ) {
* @since 0.1
*/
function generate_get_defaults() {
return apply_filters( 'generate_option_defaults',
return apply_filters(
'generate_option_defaults',
array(
'hide_title' => '',
'hide_tagline' => '',
'hide_tagline' => true,
'logo' => '',
'inline_logo_site_branding' => false,
'retina_logo' => '',
@ -27,18 +28,18 @@ if ( ! function_exists( 'generate_get_defaults' ) ) {
'top_bar_width' => 'full',
'top_bar_inner_width' => 'contained',
'top_bar_alignment' => 'right',
'container_width' => '1100',
'container_alignment' => 'boxes',
'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_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-below-header',
'nav_position_setting' => 'nav-float-right',
'nav_drop_point' => '',
'nav_dropdown_type' => 'hover',
'nav_dropdown_direction' => 'right',
'nav_dropdown_direction' => is_rtl() ? 'left' : 'right',
'nav_search' => 'disable',
'content_layout_setting' => 'separate-containers',
'layout_setting' => 'right-sidebar',
@ -50,15 +51,16 @@ if ( ! function_exists( 'generate_get_defaults' ) ) {
'footer_widget_setting' => '3',
'footer_bar_alignment' => 'right',
'back_to_top' => '',
'background_color' => '#efefef',
'text_color' => '#3a3a3a',
'background_color' => '#f7f8f9',
'text_color' => '#222222',
'link_color' => '#1e73be',
'link_color_hover' => '#000000',
'link_color_visited' => '',
'font_awesome_essentials' => true,
'icons' => 'font',
'icons' => 'svg',
'combine_css' => true,
'dynamic_css_cache' => true,
'structure' => 'flexbox',
)
);
}
@ -69,30 +71,31 @@ if ( ! function_exists( 'generate_get_color_defaults' ) ) {
* Set default options
*/
function generate_get_color_defaults() {
return apply_filters( 'generate_color_option_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' => '#3a3a3a',
'header_link_color' => '#3a3a3a',
'header_text_color' => '',
'header_link_color' => '',
'header_link_hover_color' => '',
'site_title_color' => '#222222',
'site_tagline_color' => '#757575',
'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',
'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',
@ -100,11 +103,11 @@ if ( ! function_exists( 'generate_get_color_defaults' ) ) {
'content_link_color' => '',
'content_link_hover_color' => '',
'content_title_color' => '',
'blog_post_title_color' => '',
'blog_post_title_hover_color' => '',
'blog_post_title_color' => '#222222',
'blog_post_title_hover_color' => '#55555e',
'entry_meta_text_color' => '#595959',
'entry_meta_link_color' => '#595959',
'entry_meta_link_color_hover' => '#1e73be',
'entry_meta_link_color' => '',
'entry_meta_link_color_hover' => '',
'h1_color' => '',
'h2_color' => '',
'h3_color' => '',
@ -115,24 +118,24 @@ if ( ! function_exists( 'generate_get_color_defaults' ) ) {
'sidebar_widget_text_color' => '',
'sidebar_widget_link_color' => '',
'sidebar_widget_link_hover_color' => '',
'sidebar_widget_title_color' => '#000000',
'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' => '#222222',
'footer_background_color' => '#55555e',
'footer_text_color' => '#ffffff',
'footer_link_color' => '#ffffff',
'footer_link_hover_color' => '#606060',
'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' => '#666666',
'form_button_background_color_hover' => '#3f3f3f',
'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 )',
@ -161,8 +164,8 @@ if ( ! function_exists( 'generate_get_default_fonts' ) ) {
'body_font_weight' => 'normal',
'body_font_transform' => 'none',
'body_font_size' => '17',
'body_line_height' => '1.5', // no unit
'paragraph_margin' => '1.5', // em
'body_line_height' => '1.5', // no unit.
'paragraph_margin' => '1.5', // em.
'font_top_bar' => 'inherit',
'font_top_bar_category' => '',
'font_top_bar_variants' => '',
@ -174,8 +177,8 @@ if ( ! function_exists( 'generate_get_default_fonts' ) ) {
'font_site_title_variants' => '',
'site_title_font_weight' => 'bold',
'site_title_font_transform' => 'none',
'site_title_font_size' => '45',
'mobile_site_title_font_size' => '30',
'site_title_font_size' => '25',
'mobile_site_title_font_size' => '',
'font_site_tagline' => 'inherit',
'font_site_tagline_category' => '',
'font_site_tagline_variants' => '',
@ -205,50 +208,53 @@ if ( ! function_exists( 'generate_get_default_fonts' ) ) {
'font_heading_1' => 'inherit',
'font_heading_1_category' => '',
'font_heading_1_variants' => '',
'heading_1_weight' => '300',
'heading_1_weight' => 'normal',
'heading_1_transform' => 'none',
'heading_1_font_size' => '40',
'heading_1_line_height' => '1.2', // em
'heading_1_font_size' => '42',
'heading_1_line_height' => '1.2', // em.
'heading_1_margin_bottom' => '20',
'mobile_heading_1_font_size' => '30',
'mobile_heading_1_font_size' => '31',
'font_heading_2' => 'inherit',
'font_heading_2_category' => '',
'font_heading_2_variants' => '',
'heading_2_weight' => '300',
'heading_2_weight' => 'normal',
'heading_2_transform' => 'none',
'heading_2_font_size' => '30',
'heading_2_line_height' => '1.2', // em
'heading_2_font_size' => '35',
'heading_2_line_height' => '1.2', // em.
'heading_2_margin_bottom' => '20',
'mobile_heading_2_font_size' => '25',
'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' => '20',
'heading_3_line_height' => '1.2', // em
'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' => '',
'heading_4_line_height' => '', // em
'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' => '',
'heading_5_line_height' => '', // em
'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
'heading_6_line_height' => '', // em.
'font_footer' => 'inherit',
'font_footer_category' => '',
'font_footer_variants' => '',
@ -277,12 +283,16 @@ if ( ! function_exists( 'generate_spacing_get_defaults' ) ) {
function generate_spacing_get_defaults( $filter = true ) {
$defaults = array(
'top_bar_top' => '10',
'top_bar_right' => '10',
'top_bar_right' => '40',
'top_bar_bottom' => '10',
'top_bar_left' => '10',
'header_top' => '40',
'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' => '40',
'header_bottom' => '20',
'header_left' => '40',
'menu_item' => '20',
'menu_item_height' => '60',
@ -298,8 +308,8 @@ if ( ! function_exists( 'generate_spacing_get_defaults' ) ) {
'mobile_content_left' => '30',
'separator' => '20',
'mobile_separator' => '',
'left_sidebar_width' => '25',
'right_sidebar_width' => '25',
'left_sidebar_width' => '30',
'right_sidebar_width' => '30',
'widget_top' => '40',
'widget_right' => '40',
'widget_bottom' => '40',
@ -310,9 +320,13 @@ if ( ! function_exists( 'generate_spacing_get_defaults' ) ) {
'footer_widget_container_left' => '40',
'footer_widget_separator' => '40',
'footer_top' => '20',
'footer_right' => '20',
'footer_right' => '40',
'footer_bottom' => '20',
'footer_left' => '20',
'footer_left' => '40',
'mobile_footer_top' => '',
'mobile_footer_right' => '30',
'mobile_footer_bottom' => '',
'mobile_footer_left' => '30',
);
if ( $filter ) {

View File

@ -9,24 +9,28 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
// Deprecated constants
// Deprecated constants.
define( 'GENERATE_URI', get_template_directory_uri() );
define( 'GENERATE_DIR', get_template_directory() );
if ( ! function_exists( 'generate_paging_nav' ) ) {
/**
* Build the pagination links
*
* @since 1.3.35
* @deprecated 1.3.45
*/
function generate_paging_nav() {
_deprecated_function( __FUNCTION__, '1.3.45', 'the_posts_navigation()' );
if ( function_exists( 'the_posts_pagination' ) ) {
the_posts_pagination( array(
'mid_size' => apply_filters( 'generate_pagination_mid_size', 1 ),
'prev_text' => __( '&larr; Previous', 'generatepress' ),
'next_text' => __( 'Next &rarr;', 'generatepress' )
) );
the_posts_pagination(
array(
'mid_size' => apply_filters( 'generate_pagination_mid_size', 1 ),
'prev_text' => __( '&larr; Previous', 'generatepress' ),
'next_text' => __( 'Next &rarr;', 'generatepress' ),
)
);
}
}
}
@ -34,26 +38,29 @@ if ( ! function_exists( 'generate_paging_nav' ) ) {
if ( ! function_exists( 'generate_additional_spacing' ) ) {
/**
* Add fallback CSS for our mobile search icon color
*
* @deprecated 1.3.47
*/
function generate_additional_spacing() {
// No longer needed
// No longer needed.
}
}
if ( ! function_exists( 'generate_mobile_search_spacing_fallback_css' ) ) {
/**
* Enqueue our mobile search icon color fallback CSS
*
* @deprecated 1.3.47
*/
function generate_mobile_search_spacing_fallback_css() {
// No longer needed
// No longer needed.
}
}
if ( ! function_exists( 'generate_addons_available' ) ) {
/**
* Check to see if there's any addons not already activated
*
* @since 1.0.9
* @deprecated 1.3.47
*/
@ -67,6 +74,7 @@ if ( ! function_exists( 'generate_addons_available' ) ) {
if ( ! function_exists( 'generate_no_addons' ) ) {
/**
* Check to see if no addons are activated
*
* @since 1.0.9
* @deprecated 1.3.47
*/
@ -80,6 +88,7 @@ if ( ! function_exists( 'generate_no_addons' ) ) {
if ( ! function_exists( 'generate_get_min_suffix' ) ) {
/**
* Figure out if we should use minified scripts or not
*
* @since 1.3.29
* @deprecated 2.0
*/
@ -89,96 +98,192 @@ if ( ! function_exists( 'generate_get_min_suffix' ) ) {
}
if ( ! function_exists( 'generate_add_layout_meta_box' ) ) {
/**
* Add layout metabox.
*
* @since 0.1
* @deprecated 2.0
*/
function generate_add_layout_meta_box() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_register_layout_meta_box()' );
}
}
if ( ! function_exists( 'generate_show_layout_meta_box' ) ) {
/**
* Show layout metabox.
*
* @since 0.1
* @deprecated 2.0
*/
function generate_show_layout_meta_box() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_do_layout_meta_box()' );
}
}
if ( ! function_exists( 'generate_save_layout_meta' ) ) {
/**
* Save layout metabox.
*
* @since 0.1
* @deprecated 2.0
*/
function generate_save_layout_meta() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_save_layout_meta_data()' );
}
}
if ( ! function_exists( 'generate_add_footer_widget_meta_box' ) ) {
/**
* Add footer widget metabox.
*
* @since 0.1
* @deprecated 2.0
*/
function generate_add_footer_widget_meta_box() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_register_layout_meta_box()' );
}
}
if ( ! function_exists( 'generate_show_footer_widget_meta_box' ) ) {
/**
* Show footer widget metabox.
*
* @since 0.1
* @deprecated 2.0
*/
function generate_show_footer_widget_meta_box() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_do_layout_meta_box()' );
}
}
if ( ! function_exists( 'generate_save_footer_widget_meta' ) ) {
/**
* Save footer widget metabox.
*
* @since 0.1
* @deprecated 2.0
*/
function generate_save_footer_widget_meta() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_save_layout_meta_data()' );
}
}
if ( ! function_exists( 'generate_add_page_builder_meta_box' ) ) {
/**
* Add page builder metabox.
*
* @since 0.1
* @deprecated 2.0
*/
function generate_add_page_builder_meta_box() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_register_layout_meta_box()' );
}
}
if ( ! function_exists( 'generate_show_page_builder_meta_box' ) ) {
/**
* Show page builder metabox.
*
* @since 0.1
* @deprecated 2.0
*/
function generate_show_page_builder_meta_box() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_do_layout_meta_box()' );
}
}
if ( ! function_exists( 'generate_save_page_builder_meta' ) ) {
/**
* Save page builder metabox.
*
* @since 0.1
* @deprecated 2.0
*/
function generate_save_page_builder_meta() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_save_layout_meta_data()' );
}
}
if ( ! function_exists( 'generate_add_de_meta_box' ) ) {
/**
* Add disable elements metabox.
*
* @since 0.1
* @deprecated 2.0
*/
function generate_add_de_meta_box() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_register_layout_meta_box()' );
}
}
if ( ! function_exists( 'generate_show_de_meta_box' ) ) {
/**
* Show disable elements metabox.
*
* @since 0.1
* @deprecated 2.0
*/
function generate_show_de_meta_box() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_do_layout_meta_box()' );
}
}
if ( ! function_exists( 'generate_save_de_meta' ) ) {
/**
* Save disable elements metabox.
*
* @since 0.1
* @deprecated 2.0
*/
function generate_save_de_meta() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_save_layout_meta_data()' );
}
}
if ( ! function_exists( 'generate_add_base_inline_css' ) ) {
/**
* Add base inline CSS.
*
* @since 0.1
* @deprecated 2.0
*/
function generate_add_base_inline_css() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_enqueue_dynamic_css()' );
}
}
if ( ! function_exists( 'generate_color_scripts' ) ) {
/**
* Enqueue base colors inline CSS.
*
* @since 0.1
* @deprecated 2.0
*/
function generate_color_scripts() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_enqueue_dynamic_css()' );
}
}
if ( ! function_exists( 'generate_typography_scripts' ) ) {
/**
* Enqueue typography CSS.
*
* @since 0.1
* @deprecated 2.0
*/
function generate_typography_scripts() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_enqueue_dynamic_css()' );
}
}
if ( ! function_exists( 'generate_spacing_scripts' ) ) {
/**
* Enqueue spacing CSS.
*
* @since 0.1
* @deprecated 2.0
*/
function generate_spacing_scripts() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_enqueue_dynamic_css()' );
}
@ -190,7 +295,7 @@ if ( ! function_exists( 'generate_get_setting' ) ) {
*
* @since 1.3.40
*
* @param string $option The option name to look up.
* @param string $setting The option name to look up.
* @return string The option value.
* @todo Ability to specify different option name and defaults.
*/
@ -206,8 +311,8 @@ if ( ! function_exists( 'generate_right_sidebar_class' ) ) {
* @param string|array $class One or more classes to add to the class list.
*/
function generate_right_sidebar_class( $class = '' ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', generate_get_right_sidebar_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
// Separates classes with a single space, collates classes for post DIV.
echo 'class="' . join( ' ', generate_get_right_sidebar_class( $class ) ) . '"'; // phpcs:ignore
}
}
@ -245,8 +350,8 @@ if ( ! function_exists( 'generate_left_sidebar_class' ) ) {
* @param string|array $class One or more classes to add to the class list.
*/
function generate_left_sidebar_class( $class = '' ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', generate_get_left_sidebar_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
// Separates classes with a single space, collates classes for post DIV.
echo 'class="' . join( ' ', generate_get_left_sidebar_class( $class ) ) . '"'; // phpcs:ignore
}
}
@ -284,8 +389,8 @@ if ( ! function_exists( 'generate_content_class' ) ) {
* @param string|array $class One or more classes to add to the class list.
*/
function generate_content_class( $class = '' ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', generate_get_content_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
// Separates classes with a single space, collates classes for post DIV.
echo 'class="' . join( ' ', generate_get_content_class( $class ) ) . '"'; // phpcs:ignore
}
}
@ -323,8 +428,8 @@ if ( ! function_exists( 'generate_header_class' ) ) {
* @param string|array $class One or more classes to add to the class list.
*/
function generate_header_class( $class = '' ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', generate_get_header_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
// Separates classes with a single space, collates classes for post DIV.
echo 'class="' . join( ' ', generate_get_header_class( $class ) ) . '"'; // phpcs:ignore
}
}
@ -362,8 +467,8 @@ if ( ! function_exists( 'generate_inside_header_class' ) ) {
* @param string|array $class One or more classes to add to the class list.
*/
function generate_inside_header_class( $class = '' ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', generate_get_inside_header_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
// Separates classes with a single space, collates classes for post DIV.
echo 'class="' . join( ' ', generate_get_inside_header_class( $class ) ) . '"'; // phpcs:ignore
}
}
@ -401,8 +506,8 @@ if ( ! function_exists( 'generate_container_class' ) ) {
* @param string|array $class One or more classes to add to the class list.
*/
function generate_container_class( $class = '' ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', generate_get_container_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
// Separates classes with a single space, collates classes for post DIV.
echo 'class="' . join( ' ', generate_get_container_class( $class ) ) . '"'; // phpcs:ignore
}
}
@ -440,8 +545,8 @@ if ( ! function_exists( 'generate_navigation_class' ) ) {
* @param string|array $class One or more classes to add to the class list.
*/
function generate_navigation_class( $class = '' ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', generate_get_navigation_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
// Separates classes with a single space, collates classes for post DIV.
echo 'class="' . join( ' ', generate_get_navigation_class( $class ) ) . '"'; // phpcs:ignore
}
}
@ -493,8 +598,8 @@ if ( ! function_exists( 'generate_inside_navigation_class' ) ) {
$return = apply_filters( 'generate_inside_navigation_class', $classes, $class );
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', $return ) . '"'; // WPCS: XSS ok, sanitization ok.
// Separates classes with a single space, collates classes for post DIV.
echo 'class="' . join( ' ', $return ) . '"'; // phpcs:ignore
}
}
@ -506,8 +611,8 @@ if ( ! function_exists( 'generate_menu_class' ) ) {
* @param string|array $class One or more classes to add to the class list.
*/
function generate_menu_class( $class = '' ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', generate_get_menu_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
// Separates classes with a single space, collates classes for post DIV.
echo 'class="' . join( ' ', generate_get_menu_class( $class ) ) . '"'; // phpcs:ignore
}
}
@ -545,8 +650,8 @@ if ( ! function_exists( 'generate_main_class' ) ) {
* @param string|array $class One or more classes to add to the class list.
*/
function generate_main_class( $class = '' ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', generate_get_main_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
// Separates classes with a single space, collates classes for post DIV.
echo 'class="' . join( ' ', generate_get_main_class( $class ) ) . '"'; // phpcs:ignore
}
}
@ -584,8 +689,8 @@ if ( ! function_exists( 'generate_footer_class' ) ) {
* @param string|array $class One or more classes to add to the class list.
*/
function generate_footer_class( $class = '' ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', generate_get_footer_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
// Separates classes with a single space, collates classes for post DIV.
echo 'class="' . join( ' ', generate_get_footer_class( $class ) ) . '"'; // phpcs:ignore
}
}
@ -637,8 +742,8 @@ if ( ! function_exists( 'generate_inside_footer_class' ) ) {
$return = apply_filters( 'generate_inside_footer_class', $classes, $class );
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', $return ) . '"'; // WPCS: XSS ok, sanitization ok.
// Separates classes with a single space, collates classes for post DIV.
echo 'class="' . join( ' ', $return ) . '"'; // phpcs:ignore
}
}
@ -664,8 +769,8 @@ if ( ! function_exists( 'generate_top_bar_class' ) ) {
$return = apply_filters( 'generate_top_bar_class', $classes, $class );
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', $return ) . '"'; // WPCS: XSS ok, sanitization ok.
// Separates classes with a single space, collates classes for post DIV.
echo 'class="' . join( ' ', $return ) . '"'; // phpcs:ignore
}
}
@ -676,23 +781,23 @@ if ( ! function_exists( 'generate_body_schema' ) ) {
* @since 1.3.15
*/
function generate_body_schema() {
// Set up blog variable
// Set up blog variable.
$blog = ( is_home() || is_archive() || is_attachment() || is_tax() || is_single() ) ? true : false;
// Set up default itemtype
// Set up default itemtype.
$itemtype = 'WebPage';
// Get itemtype for the blog
// Get itemtype for the blog.
$itemtype = ( $blog ) ? 'Blog' : $itemtype;
// Get itemtype for search results
// Get itemtype for search results.
$itemtype = ( is_search() ) ? 'SearchResultsPage' : $itemtype;
// Get the result
// Get the result.
$result = esc_html( apply_filters( 'generate_body_itemtype', $itemtype ) );
// Return our HTML
echo "itemtype='https://schema.org/$result' itemscope='itemscope'"; // WPCS: XSS ok, sanitization ok.
// Return our HTML.
echo "itemtype='https://schema.org/$result' itemscope='itemscope'"; // phpcs:ignore
}
}
@ -700,13 +805,110 @@ if ( ! function_exists( 'generate_article_schema' ) ) {
/**
* Figure out which schema tags to apply to the <article> element
* The function determines the itemtype: generate_article_schema( 'BlogPosting' )
*
* @since 1.3.15
* @param string $type The type of schema.
*/
function generate_article_schema( $type = 'CreativeWork' ) {
// Get the itemtype
// Get the itemtype.
$itemtype = esc_html( apply_filters( 'generate_article_itemtype', $type ) );
// Print the results
echo "itemtype='https://schema.org/$itemtype' itemscope='itemscope'"; // WPCS: XSS ok, sanitization ok.
// Print the results.
echo "itemtype='https://schema.org/$itemtype' itemscope='itemscope'"; // phpcs:ignore
}
}
/**
* Process database updates if necessary.
* There's nothing in here yet, but we're setting the version to use later.
*
* @since 2.1
* @deprecated 3.0.0
*/
function generate_do_admin_db_updates() {
// Replaced by Generate_Theme_Update().
}
/**
* Process important database updates when someone visits the front or backend.
*
* @since 2.3
* @deprecated 3.0.0
*/
function generate_do_db_updates() {
// Replaced by Generate_Theme_Update().
}
if ( ! function_exists( 'generate_update_logo_setting' ) ) {
/**
* Migrate the old logo database entry to the new custom_logo theme mod (WordPress 4.5)
*
* @since 1.3.29
* @deprecated 3.0.0
*/
function generate_update_logo_setting() {
// Replaced by Generate_Theme_Update().
}
}
if ( ! function_exists( 'generate_typography_convert_values' ) ) {
/**
* Take the old body font value and strip it of variants
* This should only run once
*
* @since 1.3.0
* @deprecated 3.0.0
*/
function generate_typography_convert_values() {
// Replaced by Generate_Theme_Update().
}
}
/**
* Execute functions after existing sites update.
*
* We check to see if options already exist. If they do, we can assume the user has
* updated the theme, and not installed it from scratch.
*
* We run this right away in the Dashboard to avoid other migration functions from
* setting options and causing these functions to run on fresh installs.
*
* @since 2.0
* @deprecated 3.0.0
*/
function generate_migrate_existing_settings() {
// Replaced by Generate_Theme_Update().
}
/**
* Output CSS for the icon fonts.
*
* @since 2.3
* @deprecated 3.0.0
*/
function generate_do_icon_css() {
$output = false;
if ( 'font' === generate_get_option( 'icons' ) ) {
$url = trailingslashit( get_template_directory_uri() );
if ( defined( 'GENERATE_MENU_PLUS_VERSION' ) ) {
$output .= '.main-navigation .slideout-toggle a:before,
.slide-opened .slideout-overlay .slideout-exit:before {
font-family: GeneratePress;
}
.slideout-navigation .dropdown-menu-toggle:before {
content: "\f107" !important;
}
.slideout-navigation .sfHover > a .dropdown-menu-toggle:before {
content: "\f106" !important;
}';
}
}
if ( $output ) {
return str_replace( array( "\r", "\n", "\t" ), '', $output );
}
}

View File

@ -18,41 +18,87 @@ if ( ! function_exists( 'generate_scripts' ) ) {
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
$dir_uri = get_template_directory_uri();
if ( generate_get_option( 'combine_css' ) && $suffix ) {
wp_enqueue_style( 'generate-style', $dir_uri . "/css/all.min.css", array(), GENERATE_VERSION, 'all' );
} else {
$lite = '';
if ( apply_filters( 'generate_unsemantic_grid_lite', false ) ) {
$lite = '-lite';
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' );
}
wp_enqueue_style( 'generate-style-grid', $dir_uri . "/css/unsemantic-grid{$lite}{$suffix}.css", false, GENERATE_VERSION, 'all' );
wp_enqueue_style( 'generate-style', $dir_uri . "/style{$suffix}.css", array(), GENERATE_VERSION, 'all' );
wp_enqueue_style( 'generate-mobile-style', $dir_uri . "/css/mobile{$suffix}.css", array( 'generate-style' ), 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 ( is_child_theme() ) {
wp_enqueue_style( 'generate-child', get_stylesheet_uri(), array( 'generate-style' ), filemtime( get_stylesheet_directory() . '/style.css' ), '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 . "/css/font-awesome{$suffix}.css", false, '4.7', 'all' );
wp_enqueue_style( 'font-awesome', $dir_uri . "/assets/css/components/font-awesome{$suffix}.css", false, '4.7', 'all' );
}
if ( is_rtl() ) {
if ( 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 . "/js/classList{$suffix}.js", array(), GENERATE_VERSION, true );
wp_enqueue_script( 'generate-classlist', $dir_uri . "/assets/js/classList{$suffix}.js", array(), GENERATE_VERSION, true );
wp_script_add_data( 'generate-classlist', 'conditional', 'lte IE 11' );
}
wp_enqueue_script( 'generate-menu', $dir_uri . "/js/menu{$suffix}.js", array(), GENERATE_VERSION, true );
wp_enqueue_script( 'generate-a11y', $dir_uri . "/js/a11y{$suffix}.js", array(), GENERATE_VERSION, true );
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 . "/js/dropdown-click{$suffix}.js", array( 'generate-menu' ), GENERATE_VERSION, true );
wp_enqueue_script( 'generate-dropdown-click', $dir_uri . "/assets/js/dropdown-click{$suffix}.js", array(), GENERATE_VERSION, true );
}
if ( 'enable' === generate_get_option( 'nav_search' ) ) {
wp_enqueue_script( 'generate-navigation-search', $dir_uri . "/js/navigation-search{$suffix}.js", array( 'generate-menu' ), GENERATE_VERSION, true );
wp_enqueue_script( 'generate-navigation-search', $dir_uri . "/assets/js/navigation-search{$suffix}.js", array(), GENERATE_VERSION, true );
wp_localize_script(
'generate-navigation-search',
@ -65,7 +111,7 @@ if ( ! function_exists( 'generate_scripts' ) ) {
}
if ( 'enable' === generate_get_option( 'back_to_top' ) ) {
wp_enqueue_script( 'generate-back-to-top', $dir_uri . "/js/back-to-top{$suffix}.js", array(), GENERATE_VERSION, true );
wp_enqueue_script( 'generate-back-to-top', $dir_uri . "/assets/js/back-to-top{$suffix}.js", array(), GENERATE_VERSION, true );
}
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
@ -89,19 +135,21 @@ if ( ! function_exists( 'generate_widgets_init' ) ) {
'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' ),
'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>' ),
) );
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>' ),
)
);
}
}
}
@ -121,11 +169,11 @@ if ( ! function_exists( 'generate_smart_content_width' ) ) {
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
$layout = generate_get_layout();
if ( 'left-sidebar' == $layout ) {
if ( 'left-sidebar' === $layout ) {
$content_width = $container_width * ( ( 100 - $left_sidebar_width ) / 100 );
} elseif ( 'right-sidebar' == $layout ) {
} elseif ( 'right-sidebar' === $layout ) {
$content_width = $container_width * ( ( 100 - $right_sidebar_width ) / 100 );
} elseif ( 'no-sidebar' == $layout ) {
} elseif ( 'no-sidebar' === $layout ) {
$content_width = $container_width;
} else {
$content_width = $container_width * ( ( 100 - ( $left_sidebar_width + $right_sidebar_width ) ) / 100 );
@ -205,8 +253,8 @@ if ( ! function_exists( '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
* @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;
@ -216,7 +264,10 @@ if ( ! function_exists( 'generate_remove_caption_padding' ) ) {
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
* 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 ) ) {
@ -224,6 +275,7 @@ if ( ! function_exists( 'generate_enhanced_image_navigation' ) ) {
}
$image = get_post( $id );
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose.
if ( ! empty( $image->post_parent ) && $image->post_parent != $id ) {
$url .= '#main';
}
@ -241,15 +293,17 @@ if ( ! function_exists( 'generate_categorized_blog' ) ) {
* @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' ) ) ) {
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,
$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,
) );
// 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 );
@ -269,7 +323,7 @@ if ( ! function_exists( 'generate_categorized_blog' ) ) {
if ( ! function_exists( 'generate_category_transient_flusher' ) ) {
add_action( 'edit_category', 'generate_category_transient_flusher' );
add_action( 'save_post', 'generate_category_transient_flusher' );
add_action( 'save_post', 'generate_category_transient_flusher' );
/**
* Flush out the transients used in {@see generate_categorized_blog()}.
*
@ -309,7 +363,7 @@ add_filter( 'generate_fontawesome_essentials', 'generate_set_font_awesome_essent
*
* @since 2.0
*
* @param bool $essentials
* @param bool $essentials The existing value.
* @return bool
*/
function generate_set_font_awesome_essentials( $essentials ) {
@ -326,7 +380,7 @@ add_filter( 'generate_dynamic_css_skip_cache', 'generate_skip_dynamic_css_cache'
*
* @since 2.0
*
* @param bool $cache
* @param bool $cache The existing value.
* @return bool
*/
function generate_skip_dynamic_css_cache( $cache ) {
@ -341,6 +395,8 @@ 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 ) {
@ -348,3 +404,33 @@ function generate_set_wp_headers( $headers ) {
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;
}

View File

@ -9,160 +9,41 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Display HTML classes for an element.
*
* @since 2.2
*
* @param string $context The element we're targeting.
* @param string|array $class One or more classes to add to the class list.
*/
function generate_do_element_classes( $context, $class = '' ) {
echo 'class="' . join( ' ', generate_get_element_classes( $context, $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
}
/**
* Retrieve HTML classes for an element.
*
* @since 2.2
*
* @param string $context The element we're targeting.
* @param string|array $class One or more classes to add to the class list.
* @return array Array of classes.
*/
function generate_get_element_classes( $context, $class = '' ) {
$classes = array();
if ( ! empty( $class ) ) {
if ( ! is_array( $class ) ) {
$class = preg_split( '#\s+#', $class );
}
$classes = array_merge( $classes, $class );
}
$classes = array_map( 'esc_attr', $classes );
return apply_filters( "generate_{$context}_class", $classes, $class );
}
/**
* Get any necessary microdata.
*
* @since 2.2
*
* @param string $context The element to target.
* @return string Our final attribute to add to the element.
*/
function generate_get_microdata( $context ) {
$data = false;
if ( 'microdata' !== apply_filters( 'generate_schema_type', 'microdata' ) ) {
return false;
}
if ( 'body' === $context ) {
$type = 'WebPage';
if ( is_home() || is_archive() || is_attachment() || is_tax() || is_single() ) {
$type = 'Blog';
}
if ( is_search() ) {
$type = 'SearchResultsPage';
}
$type = apply_filters( 'generate_body_itemtype', $type );
$data = sprintf(
'itemtype="https://schema.org/%s" itemscope',
esc_html( $type )
);
}
if ( 'header' === $context ) {
$data = 'itemtype="https://schema.org/WPHeader" itemscope';
}
if ( 'navigation' === $context ) {
$data = 'itemtype="https://schema.org/SiteNavigationElement" itemscope';
}
if ( 'article' === $context ) {
$type = apply_filters( 'generate_article_itemtype', 'CreativeWork' );
$data = sprintf(
'itemtype="https://schema.org/%s" itemscope',
esc_html( $type )
);
}
if ( 'post-author' === $context ) {
$data = 'itemprop="author" itemtype="https://schema.org/Person" itemscope';
}
if ( 'comment-body' === $context ) {
$data = 'itemtype="https://schema.org/Comment" itemscope';
}
if ( 'comment-author' === $context ) {
$data = 'itemprop="author" itemtype="https://schema.org/Person" itemscope';
}
if ( 'sidebar' === $context ) {
$data = 'itemtype="https://schema.org/WPSideBar" itemscope';
}
if ( 'footer' === $context ) {
$data = 'itemtype="https://schema.org/WPFooter" itemscope';
}
if ( $data ) {
return apply_filters( "generate_{$context}_microdata", $data );
}
}
/**
* Output our microdata for an element.
*
* @since 2.2
*
* @param $context The element to target.
* @return string The microdata.
*/
function generate_do_microdata( $context ) {
echo generate_get_microdata( $context ); // WPCS: XSS ok, sanitization ok.
}
if ( ! function_exists( 'generate_body_classes' ) ) {
add_filter( 'body_class', 'generate_body_classes' );
/**
* Adds custom classes to the array of body classes.
*
* @param array $classes The existing classes.
* @since 0.1
*/
function generate_body_classes( $classes ) {
$sidebar_layout = generate_get_layout();
$navigation_location = generate_get_navigation_location();
$navigation_alignment = generate_get_option( 'nav_alignment_setting' );
$navigation_dropdown = generate_get_option( 'nav_dropdown_type' );
$header_layout = generate_get_option( 'header_layout_setting' );
$header_alignment = generate_get_option( 'header_alignment_setting' );
$content_layout = generate_get_option( 'content_layout_setting' );
$footer_widgets = generate_get_footer_widgets();
$sidebar_layout = generate_get_layout();
$navigation_location = generate_get_navigation_location();
$navigation_alignment = generate_get_option( 'nav_alignment_setting' );
$navigation_dropdown = generate_get_option( 'nav_dropdown_type' );
$header_alignment = generate_get_option( 'header_alignment_setting' );
$content_layout = generate_get_option( 'content_layout_setting' );
// These values all have defaults, but we like to be extra careful.
$classes[] = ( $sidebar_layout ) ? $sidebar_layout : 'right-sidebar';
$classes[] = ( $navigation_location ) ? $navigation_location : 'nav-below-header';
$classes[] = ( $header_layout ) ? $header_layout : 'fluid-header';
$classes[] = ( $content_layout ) ? $content_layout : 'separate-containers';
$classes[] = ( '' !== $footer_widgets ) ? 'active-footer-widgets-' . absint( $footer_widgets ) : 'active-footer-widgets-3';
if ( ! generate_is_using_flexbox() ) {
$footer_widgets = generate_get_footer_widgets();
$header_layout = generate_get_option( 'header_layout_setting' );
$classes[] = ( $header_layout ) ? $header_layout : 'fluid-header';
$classes[] = ( '' !== $footer_widgets ) ? 'active-footer-widgets-' . absint( $footer_widgets ) : 'active-footer-widgets-3';
}
if ( 'enable' === generate_get_option( 'nav_search' ) ) {
$classes[] = 'nav-search-enabled';
}
// Only necessary for nav before or after header.
if ( 'nav-below-header' === $navigation_location || 'nav-above-header' === $navigation_location ) {
if ( ! generate_is_using_flexbox() && 'nav-below-header' === $navigation_location || 'nav-above-header' === $navigation_location ) {
if ( 'center' === $navigation_alignment ) {
$classes[] = 'nav-aligned-center';
} elseif ( 'right' === $navigation_alignment ) {
@ -219,6 +100,7 @@ if ( ! function_exists( 'generate_top_bar_classes' ) ) {
/**
* Adds custom classes to the header.
*
* @param array $classes The existing classes.
* @since 0.1
*/
function generate_top_bar_classes( $classes ) {
@ -226,7 +108,10 @@ if ( ! function_exists( 'generate_top_bar_classes' ) ) {
if ( 'contained' === generate_get_option( 'top_bar_width' ) ) {
$classes[] = 'grid-container';
$classes[] = 'grid-parent';
if ( ! generate_is_using_flexbox() ) {
$classes[] = 'grid-parent';
}
}
$classes[] = 'top-bar-align-' . esc_attr( generate_get_option( 'top_bar_alignment' ) );
@ -240,33 +125,38 @@ if ( ! function_exists( 'generate_right_sidebar_classes' ) ) {
/**
* Adds custom classes to the right sidebar.
*
* @param array $classes The existing classes.
* @since 0.1
*/
function generate_right_sidebar_classes( $classes ) {
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
$right_sidebar_tablet_width = apply_filters( 'generate_right_sidebar_tablet_width', $right_sidebar_width );
$left_sidebar_tablet_width = apply_filters( 'generate_left_sidebar_tablet_width', $left_sidebar_width );
$classes[] = 'widget-area';
$classes[] = 'grid-' . $right_sidebar_width;
$classes[] = 'tablet-grid-' . $right_sidebar_tablet_width;
$classes[] = 'grid-parent';
$classes[] = 'sidebar';
$classes[] = 'is-right-sidebar';
// Get the layout
$layout = generate_get_layout();
if ( ! generate_is_using_flexbox() ) {
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
if ( '' !== $layout ) {
switch ( $layout ) {
case 'both-left' :
$total_sidebar_width = $left_sidebar_width + $right_sidebar_width;
$classes[] = 'pull-' . ( 100 - $total_sidebar_width );
$right_sidebar_tablet_width = apply_filters( 'generate_right_sidebar_tablet_width', $right_sidebar_width );
$left_sidebar_tablet_width = apply_filters( 'generate_left_sidebar_tablet_width', $left_sidebar_width );
$total_sidebar_tablet_width = $left_sidebar_tablet_width + $right_sidebar_tablet_width;
$classes[] = 'tablet-pull-' . ( 100 - $total_sidebar_tablet_width );
break;
$classes[] = 'grid-' . $right_sidebar_width;
$classes[] = 'tablet-grid-' . $right_sidebar_tablet_width;
$classes[] = 'grid-parent';
// Get the layout.
$layout = generate_get_layout();
if ( '' !== $layout ) {
switch ( $layout ) {
case 'both-left':
$total_sidebar_width = $left_sidebar_width + $right_sidebar_width;
$classes[] = 'pull-' . ( 100 - $total_sidebar_width );
$total_sidebar_tablet_width = $left_sidebar_tablet_width + $right_sidebar_tablet_width;
$classes[] = 'tablet-pull-' . ( 100 - $total_sidebar_tablet_width );
break;
}
}
}
@ -279,39 +169,44 @@ if ( ! function_exists( 'generate_left_sidebar_classes' ) ) {
/**
* Adds custom classes to the left sidebar.
*
* @param array $classes The existing classes.
* @since 0.1
*/
function generate_left_sidebar_classes( $classes ) {
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
$total_sidebar_width = $left_sidebar_width + $right_sidebar_width;
$right_sidebar_tablet_width = apply_filters( 'generate_right_sidebar_tablet_width', $right_sidebar_width );
$left_sidebar_tablet_width = apply_filters( 'generate_left_sidebar_tablet_width', $left_sidebar_width );
$total_sidebar_tablet_width = $left_sidebar_tablet_width + $right_sidebar_tablet_width;
$classes[] = 'widget-area';
$classes[] = 'grid-' . $left_sidebar_width;
$classes[] = 'tablet-grid-' . $left_sidebar_tablet_width;
$classes[] = 'mobile-grid-100';
$classes[] = 'grid-parent';
$classes[] = 'sidebar';
$classes[] = 'is-left-sidebar';
// Get the layout
$layout = generate_get_layout();
if ( ! generate_is_using_flexbox() ) {
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
$total_sidebar_width = $left_sidebar_width + $right_sidebar_width;
if ( '' !== $layout ) {
switch ( $layout ) {
case 'left-sidebar' :
$classes[] = 'pull-' . ( 100 - $left_sidebar_width );
$classes[] = 'tablet-pull-' . ( 100 - $left_sidebar_tablet_width );
break;
$right_sidebar_tablet_width = apply_filters( 'generate_right_sidebar_tablet_width', $right_sidebar_width );
$left_sidebar_tablet_width = apply_filters( 'generate_left_sidebar_tablet_width', $left_sidebar_width );
$total_sidebar_tablet_width = $left_sidebar_tablet_width + $right_sidebar_tablet_width;
case 'both-sidebars' :
case 'both-left' :
$classes[] = 'pull-' . ( 100 - $total_sidebar_width );
$classes[] = 'tablet-pull-' . ( 100 - $total_sidebar_tablet_width );
break;
$classes[] = 'grid-' . $left_sidebar_width;
$classes[] = 'tablet-grid-' . $left_sidebar_tablet_width;
$classes[] = 'mobile-grid-100';
$classes[] = 'grid-parent';
// Get the layout.
$layout = generate_get_layout();
if ( '' !== $layout ) {
switch ( $layout ) {
case 'left-sidebar':
$classes[] = 'pull-' . ( 100 - $left_sidebar_width );
$classes[] = 'tablet-pull-' . ( 100 - $left_sidebar_tablet_width );
break;
case 'both-sidebars':
case 'both-left':
$classes[] = 'pull-' . ( 100 - $total_sidebar_width );
$classes[] = 'tablet-pull-' . ( 100 - $total_sidebar_tablet_width );
break;
}
}
}
@ -324,62 +219,66 @@ if ( ! function_exists( 'generate_content_classes' ) ) {
/**
* Adds custom classes to the content container.
*
* @param array $classes The existing classes.
* @since 0.1
*/
function generate_content_classes( $classes ) {
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
$total_sidebar_width = $left_sidebar_width + $right_sidebar_width;
$right_sidebar_tablet_width = apply_filters( 'generate_right_sidebar_tablet_width', $right_sidebar_width );
$left_sidebar_tablet_width = apply_filters( 'generate_left_sidebar_tablet_width', $left_sidebar_width );
$total_sidebar_tablet_width = $left_sidebar_tablet_width + $right_sidebar_tablet_width;
$classes[] = 'content-area';
$classes[] = 'grid-parent';
$classes[] = 'mobile-grid-100';
// Get the layout
$layout = generate_get_layout();
if ( ! generate_is_using_flexbox() ) {
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
$total_sidebar_width = $left_sidebar_width + $right_sidebar_width;
if ( '' !== $layout ) {
switch ( $layout ) {
$right_sidebar_tablet_width = apply_filters( 'generate_right_sidebar_tablet_width', $right_sidebar_width );
$left_sidebar_tablet_width = apply_filters( 'generate_left_sidebar_tablet_width', $left_sidebar_width );
$total_sidebar_tablet_width = $left_sidebar_tablet_width + $right_sidebar_tablet_width;
case 'right-sidebar' :
$classes[] = 'grid-' . ( 100 - $right_sidebar_width );
$classes[] = 'tablet-grid-' . ( 100 - $right_sidebar_tablet_width );
break;
$classes[] = 'grid-parent';
$classes[] = 'mobile-grid-100';
case 'left-sidebar' :
$classes[] = 'push-' . $left_sidebar_width;
$classes[] = 'grid-' . ( 100 - $left_sidebar_width );
$classes[] = 'tablet-push-' . $left_sidebar_tablet_width;
$classes[] = 'tablet-grid-' . ( 100 - $left_sidebar_tablet_width );
break;
// Get the layout.
$layout = generate_get_layout();
case 'no-sidebar' :
$classes[] = 'grid-100';
$classes[] = 'tablet-grid-100';
break;
if ( '' !== $layout ) {
switch ( $layout ) {
case 'both-sidebars' :
$classes[] = 'push-' . $left_sidebar_width;
$classes[] = 'grid-' . ( 100 - $total_sidebar_width );
$classes[] = 'tablet-push-' . $left_sidebar_tablet_width;
$classes[] = 'tablet-grid-' . ( 100 - $total_sidebar_tablet_width );
break;
case 'right-sidebar':
$classes[] = 'grid-' . ( 100 - $right_sidebar_width );
$classes[] = 'tablet-grid-' . ( 100 - $right_sidebar_tablet_width );
break;
case 'both-right' :
$classes[] = 'grid-' . ( 100 - $total_sidebar_width );
$classes[] = 'tablet-grid-' . ( 100 - $total_sidebar_tablet_width );
break;
case 'left-sidebar':
$classes[] = 'push-' . $left_sidebar_width;
$classes[] = 'grid-' . ( 100 - $left_sidebar_width );
$classes[] = 'tablet-push-' . $left_sidebar_tablet_width;
$classes[] = 'tablet-grid-' . ( 100 - $left_sidebar_tablet_width );
break;
case 'both-left' :
$classes[] = 'push-' . $total_sidebar_width;
$classes[] = 'grid-' . ( 100 - $total_sidebar_width );
$classes[] = 'tablet-push-' . $total_sidebar_tablet_width;
$classes[] = 'tablet-grid-' . ( 100 - $total_sidebar_tablet_width );
break;
case 'no-sidebar':
$classes[] = 'grid-100';
$classes[] = 'tablet-grid-100';
break;
case 'both-sidebars':
$classes[] = 'push-' . $left_sidebar_width;
$classes[] = 'grid-' . ( 100 - $total_sidebar_width );
$classes[] = 'tablet-push-' . $left_sidebar_tablet_width;
$classes[] = 'tablet-grid-' . ( 100 - $total_sidebar_tablet_width );
break;
case 'both-right':
$classes[] = 'grid-' . ( 100 - $total_sidebar_width );
$classes[] = 'tablet-grid-' . ( 100 - $total_sidebar_tablet_width );
break;
case 'both-left':
$classes[] = 'push-' . $total_sidebar_width;
$classes[] = 'grid-' . ( 100 - $total_sidebar_width );
$classes[] = 'tablet-push-' . $total_sidebar_tablet_width;
$classes[] = 'tablet-grid-' . ( 100 - $total_sidebar_tablet_width );
break;
}
}
}
@ -392,6 +291,7 @@ if ( ! function_exists( 'generate_header_classes' ) ) {
/**
* Adds custom classes to the header.
*
* @param array $classes The existing classes.
* @since 0.1
*/
function generate_header_classes( $classes ) {
@ -399,7 +299,14 @@ if ( ! function_exists( 'generate_header_classes' ) ) {
if ( 'contained-header' === generate_get_option( 'header_layout_setting' ) ) {
$classes[] = 'grid-container';
$classes[] = 'grid-parent';
if ( ! generate_is_using_flexbox() ) {
$classes[] = 'grid-parent';
}
}
if ( generate_has_inline_mobile_toggle() ) {
$classes[] = 'has-inline-mobile-toggle';
}
return $classes;
@ -411,6 +318,7 @@ if ( ! function_exists( 'generate_inside_header_classes' ) ) {
/**
* Adds custom classes to inside the header.
*
* @param array $classes The existing classes.
* @since 0.1
*/
function generate_inside_header_classes( $classes ) {
@ -418,7 +326,10 @@ if ( ! function_exists( 'generate_inside_header_classes' ) ) {
if ( 'full-width' !== generate_get_option( 'header_inner_width' ) ) {
$classes[] = 'grid-container';
$classes[] = 'grid-parent';
if ( ! generate_is_using_flexbox() ) {
$classes[] = 'grid-parent';
}
}
return $classes;
@ -430,29 +341,65 @@ if ( ! function_exists( 'generate_navigation_classes' ) ) {
/**
* Adds custom classes to the navigation.
*
* @param array $classes The existing classes.
* @since 0.1
*/
function generate_navigation_classes( $classes ) {
$classes[] = 'main-navigation';
if ( 'contained-nav' === generate_get_option( 'nav_layout_setting' ) ) {
$classes[] = 'grid-container';
$classes[] = 'grid-parent';
}
if ( generate_is_using_flexbox() ) {
$navigation_location = generate_get_navigation_location();
if ( 'left' === generate_get_option( 'nav_dropdown_direction' ) ) {
$nav_layout = generate_get_option( 'nav_position_setting' );
switch ( $nav_layout ) {
case 'nav-below-header':
case 'nav-above-header':
case 'nav-float-right':
case 'nav-float-left':
$classes[] = 'sub-menu-left';
break;
if ( 'nav-float-right' !== $navigation_location && 'nav-float-left' !== $navigation_location ) {
$classes[] = 'grid-container';
}
} else {
$classes[] = 'grid-container';
$classes[] = 'grid-parent';
}
}
if ( generate_is_using_flexbox() ) {
$nav_alignment = generate_get_option( 'nav_alignment_setting' );
if ( 'center' === $nav_alignment ) {
$classes[] = 'nav-align-center';
} elseif ( 'right' === $nav_alignment ) {
$classes[] = 'nav-align-right';
} elseif ( is_rtl() && 'left' === $nav_alignment ) {
$classes[] = 'nav-align-left';
}
if ( generate_has_menu_bar_items() ) {
$classes[] = 'has-menu-bar-items';
}
}
$submenu_direction = 'right';
if ( 'left' === generate_get_option( 'nav_dropdown_direction' ) ) {
$submenu_direction = 'left';
}
if ( 'nav-left-sidebar' === generate_get_navigation_location() ) {
$submenu_direction = 'right';
if ( 'both-right' === generate_get_layout() ) {
$submenu_direction = 'left';
}
}
if ( 'nav-right-sidebar' === generate_get_navigation_location() ) {
$submenu_direction = 'left';
if ( 'both-left' === generate_get_layout() ) {
$submenu_direction = 'right';
}
}
$classes[] = 'sub-menu-' . $submenu_direction;
return $classes;
}
}
@ -462,6 +409,7 @@ if ( ! function_exists( 'generate_inside_navigation_classes' ) ) {
/**
* Adds custom classes to the inner navigation.
*
* @param array $classes The existing classes.
* @since 1.3.41
*/
function generate_inside_navigation_classes( $classes ) {
@ -469,7 +417,10 @@ if ( ! function_exists( 'generate_inside_navigation_classes' ) ) {
if ( 'full-width' !== generate_get_option( 'nav_inner_width' ) ) {
$classes[] = 'grid-container';
$classes[] = 'grid-parent';
if ( ! generate_is_using_flexbox() ) {
$classes[] = 'grid-parent';
}
}
return $classes;
@ -481,6 +432,7 @@ if ( ! function_exists( 'generate_menu_classes' ) ) {
/**
* Adds custom classes to the menu.
*
* @param array $classes The existing classes.
* @since 0.1
*/
function generate_menu_classes( $classes ) {
@ -496,6 +448,7 @@ if ( ! function_exists( 'generate_footer_classes' ) ) {
/**
* Adds custom classes to the footer.
*
* @param array $classes The existing classes.
* @since 0.1
*/
function generate_footer_classes( $classes ) {
@ -503,7 +456,10 @@ if ( ! function_exists( 'generate_footer_classes' ) ) {
if ( 'contained-footer' === generate_get_option( 'footer_layout_setting' ) ) {
$classes[] = 'grid-container';
$classes[] = 'grid-parent';
if ( ! generate_is_using_flexbox() ) {
$classes[] = 'grid-parent';
}
}
if ( is_active_sidebar( 'footer-bar' ) ) {
@ -520,6 +476,7 @@ if ( ! function_exists( 'generate_inside_footer_classes' ) ) {
/**
* Adds custom classes to the footer.
*
* @param array $classes The existing classes.
* @since 0.1
*/
function generate_inside_footer_classes( $classes ) {
@ -527,7 +484,10 @@ if ( ! function_exists( 'generate_inside_footer_classes' ) ) {
if ( 'full-width' !== generate_get_option( 'footer_inner_width' ) ) {
$classes[] = 'grid-container';
$classes[] = 'grid-parent';
if ( ! generate_is_using_flexbox() ) {
$classes[] = 'grid-parent';
}
}
return $classes;
@ -538,6 +498,8 @@ if ( ! function_exists( 'generate_main_classes' ) ) {
add_filter( 'generate_main_class', 'generate_main_classes' );
/**
* Adds custom classes to the <main> element
*
* @param array $classes The existing classes.
* @since 1.1.0
*/
function generate_main_classes( $classes ) {
@ -547,16 +509,57 @@ if ( ! function_exists( 'generate_main_classes' ) ) {
}
}
add_filter( 'generate_page_class', 'generate_do_page_container_classes' );
/**
* Adds custom classes to the #page element
*
* @param array $classes The existing classes.
* @since 3.0.0
*/
function generate_do_page_container_classes( $classes ) {
$classes[] = 'site';
$classes[] = 'grid-container';
$classes[] = 'container';
if ( generate_is_using_hatom() ) {
$classes[] = 'hfeed';
}
if ( ! generate_is_using_flexbox() ) {
$classes[] = 'grid-parent';
}
return $classes;
}
add_filter( 'generate_comment-author_class', 'generate_do_comment_author_classes' );
/**
* Adds custom classes to the comment author element
*
* @param array $classes The existing classes.
* @since 3.0.0
*/
function generate_do_comment_author_classes( $classes ) {
$classes[] = 'comment-author';
if ( generate_is_using_hatom() ) {
$classes[] = 'vcard';
}
return $classes;
}
if ( ! function_exists( 'generate_post_classes' ) ) {
add_filter( 'post_class', 'generate_post_classes' );
/**
* Adds custom classes to the <article> element.
* Remove .hentry class from pages to comply with structural data guidelines.
*
* @param array $classes The existing classes.
* @since 1.3.39
*/
function generate_post_classes( $classes ) {
if ( 'page' == get_post_type() ) {
if ( 'page' === get_post_type() || ! generate_is_using_hatom() ) {
$classes = array_diff( $classes, array( 'hentry' ) );
}

View File

@ -23,8 +23,8 @@ function generate_enqueue_meta_box_scripts( $hook ) {
$screen = get_current_screen();
$post_type = $screen->id;
if ( in_array( $post_type, ( array ) $post_types ) ) {
wp_enqueue_style( 'generate-layout-metabox', get_template_directory_uri() . '/css/admin/meta-box.css', array(), GENERATE_VERSION );
if ( in_array( $post_type, (array) $post_types ) ) {
wp_enqueue_style( 'generate-layout-metabox', get_template_directory_uri() . '/assets/css/admin/meta-box.css', array(), GENERATE_VERSION );
}
}
}
@ -44,6 +44,15 @@ function generate_register_layout_meta_box() {
define( 'GENERATE_LAYOUT_META_BOX', true );
}
global $post;
$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 ) {
return;
}
$post_types = get_post_types( array( 'public' => true ) );
foreach ( $post_types as $type ) {
@ -74,7 +83,8 @@ function generate_do_layout_meta_box( $post ) {
$stored_meta['_generate-full-width-content'][0] = ( isset( $stored_meta['_generate-full-width-content'][0] ) ) ? $stored_meta['_generate-full-width-content'][0] : '';
$stored_meta['_generate-disable-headline'][0] = ( isset( $stored_meta['_generate-disable-headline'][0] ) ) ? $stored_meta['_generate-disable-headline'][0] : '';
$tabs = apply_filters( 'generate_metabox_tabs',
$tabs = apply_filters(
'generate_metabox_tabs',
array(
'sidebars' => array(
'title' => esc_html__( 'Sidebars', 'generatepress' ),
@ -92,7 +102,7 @@ function generate_do_layout_meta_box( $post ) {
'class' => '',
),
'container' => array(
'title' => esc_html__( 'Page Builder Container', 'generatepress' ),
'title' => esc_html__( 'Content Container', 'generatepress' ),
'target' => '#generate-layout-page-builder-container',
'class' => '',
),
@ -120,7 +130,7 @@ function generate_do_layout_meta_box( $post ) {
<div id="generate-meta-box-container">
<ul class="generate-meta-box-menu">
<?php
foreach ( ( array ) $tabs as $tab => $data ) {
foreach ( (array) $tabs as $tab => $data ) {
echo '<li class="' . esc_attr( $data['class'] ) . '"><a data-target="' . esc_attr( $data['target'] ) . '" href="#">' . esc_html( $data['title'] ) . '</a></li>';
}
@ -130,113 +140,60 @@ function generate_do_layout_meta_box( $post ) {
<div class="generate-meta-box-content">
<div id="generate-layout-sidebars">
<div class="generate_layouts">
<label for="meta-generate-layout-global" style="display:block;margin-bottom:10px;">
<input type="radio" name="_generate-sidebar-layout-meta" id="meta-generate-layout-global" value="" <?php checked( $stored_meta['_generate-sidebar-layout-meta'][0], '' ); ?>>
<?php esc_html_e( 'Default', 'generatepress' );?>
</label>
<label for="generate-sidebar-layout" class="generate-layout-metabox-section-title"><?php esc_html_e( 'Sidebar Layout', 'generatepress' ); ?></label>
<label for="meta-generate-layout-one" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( 'Right Sidebar', 'generatepress' );?>">
<input type="radio" name="_generate-sidebar-layout-meta" id="meta-generate-layout-one" value="right-sidebar" <?php checked( $stored_meta['_generate-sidebar-layout-meta'][0], 'right-sidebar' ); ?>>
<?php esc_html_e( 'Content', 'generatepress' );?> / <strong><?php echo esc_html_x( 'Sidebar', 'Short name for meta box', 'generatepress' ); ?></strong>
</label>
<label for="meta-generate-layout-two" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( 'Left Sidebar', 'generatepress' );?>">
<input type="radio" name="_generate-sidebar-layout-meta" id="meta-generate-layout-two" value="left-sidebar" <?php checked( $stored_meta['_generate-sidebar-layout-meta'][0], 'left-sidebar' ); ?>>
<strong><?php echo esc_html_x( 'Sidebar', 'Short name for meta box', 'generatepress' ); ?></strong> / <?php esc_html_e( 'Content', 'generatepress' );?>
</label>
<label for="meta-generate-layout-three" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( 'No Sidebars', 'generatepress' );?>">
<input type="radio" name="_generate-sidebar-layout-meta" id="meta-generate-layout-three" value="no-sidebar" <?php checked( $stored_meta['_generate-sidebar-layout-meta'][0], 'no-sidebar' ); ?>>
<?php esc_html_e( 'Content (no sidebars)', 'generatepress' );?>
</label>
<label for="meta-generate-layout-four" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( 'Both Sidebars', 'generatepress' );?>">
<input type="radio" name="_generate-sidebar-layout-meta" id="meta-generate-layout-four" value="both-sidebars" <?php checked( $stored_meta['_generate-sidebar-layout-meta'][0], 'both-sidebars' ); ?>>
<strong><?php echo esc_html_x( 'Sidebar', 'Short name for meta box', 'generatepress' ); ?></strong> / <?php esc_html_e( 'Content', 'generatepress' );?> / <strong><?php echo esc_html_x( 'Sidebar', 'Short name for meta box', 'generatepress' ); ?></strong>
</label>
<label for="meta-generate-layout-five" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( 'Both Sidebars on Left', 'generatepress' );?>">
<input type="radio" name="_generate-sidebar-layout-meta" id="meta-generate-layout-five" value="both-left" <?php checked( $stored_meta['_generate-sidebar-layout-meta'][0], 'both-left' ); ?>>
<strong><?php echo esc_html_x( 'Sidebar', 'Short name for meta box', 'generatepress' ); ?></strong> / <strong><?php echo esc_html_x( 'Sidebar', 'Short name for meta box', 'generatepress' ); ?></strong> / <?php esc_html_e( 'Content', 'generatepress' );?>
</label>
<label for="meta-generate-layout-six" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( 'Both Sidebars on Right', 'generatepress' );?>">
<input type="radio" name="_generate-sidebar-layout-meta" id="meta-generate-layout-six" value="both-right" <?php checked( $stored_meta['_generate-sidebar-layout-meta'][0], 'both-right' ); ?>>
<?php esc_html_e( 'Content', 'generatepress' );?> / <strong><?php echo esc_html_x( 'Sidebar', 'Short name for meta box', 'generatepress' ); ?></strong> / <strong><?php echo esc_html_x( 'Sidebar', 'Short name for meta box', 'generatepress' ); ?></strong>
</label>
<select name="_generate-sidebar-layout-meta" id="generate-sidebar-layout">
<option value="" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], '' ); ?>><?php esc_html_e( 'Default', 'generatepress' ); ?></option>
<option value="right-sidebar" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], 'right-sidebar' ); ?>><?php esc_html_e( 'Right Sidebar', 'generatepress' ); ?></option>
<option value="left-sidebar" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], 'left-sidebar' ); ?>><?php esc_html_e( 'Left Sidebar', 'generatepress' ); ?></option>
<option value="no-sidebar" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], 'no-sidebar' ); ?>><?php esc_html_e( 'No Sidebars', 'generatepress' ); ?></option>
<option value="both-sidebars" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], 'both-sidebars' ); ?>><?php esc_html_e( 'Both Sidebars', 'generatepress' ); ?></option>
<option value="both-left" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], 'both-left' ); ?>><?php esc_html_e( 'Both Sidebars on Left', 'generatepress' ); ?></option>
<option value="both-right" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], 'both-right' ); ?>><?php esc_html_e( 'Both Sidebars on Right', 'generatepress' ); ?></option>
</select>
</div>
</div>
<div id="generate-layout-footer-widgets" style="display: none;">
<div class="generate_footer_widget">
<label for="meta-generate-footer-widget-global" style="display:block;margin-bottom:10px;">
<input type="radio" name="_generate-footer-widget-meta" id="meta-generate-footer-widget-global" value="" <?php checked( $stored_meta['_generate-footer-widget-meta'][0], '' ); ?>>
<?php esc_html_e( 'Default', 'generatepress' );?>
</label>
<label for="generate-footer-widget" class="generate-layout-metabox-section-title"><?php esc_html_e( 'Footer Widgets', 'generatepress' ); ?></label>
<label for="meta-generate-footer-widget-zero" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( '0 Widgets', 'generatepress' );?>">
<input type="radio" name="_generate-footer-widget-meta" id="meta-generate-footer-widget-zero" value="0" <?php checked( $stored_meta['_generate-footer-widget-meta'][0], '0' ); ?>>
<?php esc_html_e( '0 Widgets', 'generatepress' );?>
</label>
<label for="meta-generate-footer-widget-one" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( '1 Widget', 'generatepress' );?>">
<input type="radio" name="_generate-footer-widget-meta" id="meta-generate-footer-widget-one" value="1" <?php checked( $stored_meta['_generate-footer-widget-meta'][0], '1' ); ?>>
<?php esc_html_e( '1 Widget', 'generatepress' );?>
</label>
<label for="meta-generate-footer-widget-two" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( '2 Widgets', 'generatepress' );?>">
<input type="radio" name="_generate-footer-widget-meta" id="meta-generate-footer-widget-two" value="2" <?php checked( $stored_meta['_generate-footer-widget-meta'][0], '2' ); ?>>
<?php esc_html_e( '2 Widgets', 'generatepress' );?>
</label>
<label for="meta-generate-footer-widget-three" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( '3 Widgets', 'generatepress' );?>">
<input type="radio" name="_generate-footer-widget-meta" id="meta-generate-footer-widget-three" value="3" <?php checked( $stored_meta['_generate-footer-widget-meta'][0], '3' ); ?>>
<?php esc_html_e( '3 Widgets', 'generatepress' );?>
</label>
<label for="meta-generate-footer-widget-four" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( '4 Widgets', 'generatepress' );?>">
<input type="radio" name="_generate-footer-widget-meta" id="meta-generate-footer-widget-four" value="4" <?php checked( $stored_meta['_generate-footer-widget-meta'][0], '4' ); ?>>
<?php esc_html_e( '4 Widgets', 'generatepress' );?>
</label>
<label for="meta-generate-footer-widget-five" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( '5 Widgets', 'generatepress' );?>">
<input type="radio" name="_generate-footer-widget-meta" id="meta-generate-footer-widget-five" value="5" <?php checked( $stored_meta['_generate-footer-widget-meta'][0], '5' ); ?>>
<?php esc_html_e( '5 Widgets', 'generatepress' );?>
</label>
<select name="_generate-footer-widget-meta" id="generate-footer-widget">
<option value="" <?php selected( $stored_meta['_generate-footer-widget-meta'][0], '' ); ?>><?php esc_html_e( 'Default', 'generatepress' ); ?></option>
<option value="0" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], '0' ); ?>><?php esc_html_e( '0 Widgets', 'generatepress' ); ?></option>
<option value="1" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], '1' ); ?>><?php esc_html_e( '1 Widgets', 'generatepress' ); ?></option>
<option value="2" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], '2' ); ?>><?php esc_html_e( '2 Widgets', 'generatepress' ); ?></option>
<option value="3" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], '3' ); ?>><?php esc_html_e( '3 Widgets', 'generatepress' ); ?></option>
<option value="4" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], '4' ); ?>><?php esc_html_e( '4 Widgets', 'generatepress' ); ?></option>
<option value="5" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], '5' ); ?>><?php esc_html_e( '5 Widgets', 'generatepress' ); ?></option>
</select>
</div>
</div>
<div id="generate-layout-page-builder-container" style="display: none;">
<label for="_generate-full-width-content" class="generate-layout-metabox-section-title"><?php esc_html_e( 'Content Container', 'generatepress' ); ?></label>
<p class="page-builder-content" style="color:#666;font-size:13px;margin-top:0;">
<?php esc_html_e( 'Choose your page builder content container type. Both options remove the content padding for you.', 'generatepress' ) ;?>
<?php esc_html_e( 'Choose your content container type.', 'generatepress' ); ?>
</p>
<p class="generate_full_width_template">
<label for="default-content" style="display:block;margin-bottom:10px;">
<input type="radio" name="_generate-full-width-content" id="default-content" value="" <?php checked( $stored_meta['_generate-full-width-content'][0], '' ); ?>>
<?php esc_html_e( 'Default', 'generatepress' );?>
</label>
<label id="full-width-content" for="_generate-full-width-content" style="display:block;margin-bottom:10px;">
<input type="radio" name="_generate-full-width-content" id="_generate-full-width-content" value="true" <?php checked( $stored_meta['_generate-full-width-content'][0], 'true' ); ?>>
<?php esc_html_e( 'Full Width', 'generatepress' );?>
</label>
<label id="generate-remove-padding" for="_generate-remove-content-padding" style="display:block;margin-bottom:10px;">
<input type="radio" name="_generate-full-width-content" id="_generate-remove-content-padding" value="contained" <?php checked( $stored_meta['_generate-full-width-content'][0], 'contained' ); ?>>
<?php esc_html_e( 'Contained', 'generatepress' );?>
</label>
</p>
<select name="_generate-full-width-content" id="_generate-full-width-content">
<option value="" <?php selected( $stored_meta['_generate-full-width-content'][0], '' ); ?>><?php esc_html_e( 'Default', 'generatepress' ); ?></option>
<option value="true" <?php selected( $stored_meta['_generate-full-width-content'][0], 'true' ); ?>><?php esc_html_e( 'Full Width', 'generatepress' ); ?></option>
<option value="contained" <?php selected( $stored_meta['_generate-full-width-content'][0], 'contained' ); ?>><?php esc_html_e( 'Contained', 'generatepress' ); ?></option>
</select>
</div>
<div id="generate-layout-disable-elements" style="display: none;">
<label class="generate-layout-metabox-section-title"><?php esc_html_e( 'Disable Elements', 'generatepress' ); ?></label>
<?php if ( ! defined( 'GENERATE_DE_VERSION' ) ) : ?>
<div class="generate_disable_elements">
<label for="meta-generate-disable-headline" style="display:block;margin: 0 0 1em;" title="<?php esc_attr_e( 'Content Title', 'generatepress' );?>">
<label for="meta-generate-disable-headline" style="display:block;margin: 0 0 1em;" title="<?php esc_attr_e( 'Content Title', 'generatepress' ); ?>">
<input type="checkbox" name="_generate-disable-headline" id="meta-generate-disable-headline" value="true" <?php checked( $stored_meta['_generate-disable-headline'][0], 'true' ); ?>>
<?php esc_html_e( 'Content Title', 'generatepress' );?>
<?php esc_html_e( 'Content Title', 'generatepress' ); ?>
</label>
<?php if ( ! defined( 'GP_PREMIUM_VERSION' ) ) : ?>
<span style="display:block;padding-top:1em;border-top:1px solid #EFEFEF;">
<a href="<?php echo generate_get_premium_url( 'https://generatepress.com/downloads/generate-disable-elements' ); // WPCS: XSS ok, sanitization ok. ?>" target="_blank"><?php esc_html_e( 'Premium module available', 'generatepress' ); ?></a>
<a href="<?php echo generate_get_premium_url( 'https://generatepress.com/downloads/generate-disable-elements' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in function. ?>" target="_blank"><?php esc_html_e( 'Premium module available', 'generatepress' ); ?></a>
</span>
<?php endif; ?>
</div>
@ -247,7 +204,7 @@ function generate_do_layout_meta_box( $post ) {
<?php do_action( 'generate_layout_meta_box_content', $stored_meta ); ?>
</div>
</div>
<?php
<?php
}
add_action( 'save_post', 'generate_save_layout_meta_data' );
@ -255,8 +212,7 @@ add_action( 'save_post', 'generate_save_layout_meta_data' );
* Saves the sidebar layout meta data.
*
* @since 2.0
*
* @param int Post ID.
* @param int $post_id Post ID.
*/
function generate_save_layout_meta_data( $post_id ) {
$is_autosave = wp_is_post_autosave( $post_id );
@ -299,7 +255,7 @@ function generate_save_layout_meta_data( $post_id ) {
delete_post_meta( $post_id, $page_builder_container_key );
}
// We only need this if the Disable Elements module doesn't exist
// We only need this if the Disable Elements module doesn't exist.
if ( ! defined( 'GENERATE_DE_VERSION' ) ) {
$disable_content_title_key = '_generate-disable-headline';
$disable_content_title_value = filter_input( INPUT_POST, $disable_content_title_key, FILTER_SANITIZE_STRING );

View File

@ -1,341 +0,0 @@
<?php
/**
* Migrates old options on update.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
add_action( 'admin_init', 'generate_do_admin_db_updates' );
/**
* Process database updates if necessary.
* There's nothing in here yet, but we're setting the version to use later.
*
* @since 2.1
*/
function generate_do_admin_db_updates() {
// Get the current version.
$current_version = get_option( 'generate_db_version', false );
// Process future database updates here.
// Set the new database version.
if ( version_compare( $current_version, GENERATE_VERSION, '<' ) ) {
update_option( 'generate_db_version', GENERATE_VERSION, false );
}
}
add_action( 'init', 'generate_do_db_updates', 5 );
/**
* Process important database updates when someone visits the front or backend.
*
* @since 2.3
*/
function generate_do_db_updates() {
$flags = get_option( 'generate_migration_settings', array() );
if ( ! isset( $flags['combine_css'] ) || 'done' !== $flags['combine_css'] ) {
if ( ! get_option( 'fresh_site' ) ) {
$settings = get_option( 'generate_settings', array() );
$settings['combine_css'] = false;
update_option( 'generate_settings', $settings );
}
$flags['combine_css'] = 'done';
update_option( 'generate_migration_settings', $flags );
}
}
if ( ! function_exists( 'generate_update_logo_setting' ) ) {
add_action( 'admin_init', 'generate_update_logo_setting' );
/**
* Migrate the old logo database entry to the new custom_logo theme mod (WordPress 4.5)
*
* @since 1.3.29
*/
function generate_update_logo_setting() {
// If we're not running WordPress 4.5, bail.
if ( ! function_exists( 'the_custom_logo' ) ) {
return;
}
// If we already have a custom logo, bail.
if ( get_theme_mod( 'custom_logo' ) ) {
return;
}
// Get our settings.
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
// Get the old logo value.
$old_value = $generate_settings['logo'];
// If there's no old value, bail.
if ( empty( $old_value ) ) {
return;
}
// We made it this far, that means we have an old logo, and no new logo.
// Let's get the ID from our old value.
$logo = attachment_url_to_postid( $old_value );
// Now let's update the new logo setting with our ID.
if ( is_int( $logo ) ) {
set_theme_mod( 'custom_logo', $logo );
}
// Got our custom logo? Time to delete the old value
if ( get_theme_mod( 'custom_logo' ) ) {
$new_settings['logo'] = '';
$update_settings = wp_parse_args( $new_settings, $generate_settings );
update_option( 'generate_settings', $update_settings );
}
}
}
if ( ! function_exists( 'generate_typography_convert_values' ) ) {
add_action( 'admin_init', 'generate_typography_convert_values' );
/**
* Take the old body font value and strip it of variants
* This should only run once
* @since 1.3.0
*/
function generate_typography_convert_values() {
// Don't run this if Typography add-on is activated
if ( function_exists( 'generate_fonts_customize_register' ) ) {
return;
}
// If we've done this before, bail
if ( 'true' == get_option( 'generate_update_core_typography' ) || 'true' == get_option( 'generate_update_premium_typography' ) ) {
return;
}
// Get all settings
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_default_fonts()
);
// Get our body font family setting
$value = $generate_settings['font_body'];
// Create a new, empty array
$new_settings = array();
// If our value has : in it, and isn't empty
if ( strpos( $value, ':' ) !== false && ! empty( $value ) ) {
// Remove the : and anything past it
$value = current( explode( ':', $value ) );
// Populate our new array with our new, clean value
$new_settings['font_body'] = $value;
}
// Update our options if our new array isn't empty
if ( ! empty( $new_settings ) ) {
$generate_new_typography_settings = wp_parse_args( $new_settings, $generate_settings );
update_option( 'generate_settings', $generate_new_typography_settings );
}
// All done, set an option so we don't go through this again
update_option( 'generate_update_core_typography','true' );
}
}
if ( ! function_exists( 'generate_typography_set_font_data' ) ) {
add_action( 'admin_init', 'generate_typography_set_font_data' );
/**
* This function will check to see if your category and variants are saved
* If not, it will set them for you
* Generally, set_theme_mod isn't best practice, but this is here for migration purposes for a set amount of time only
* Any time a user saves a font in the Customizer from now on, the category and variants are saved as theme_mods, so this function won't be necessary.
*
* @since 1.3.40
*/
function generate_typography_set_font_data() {
// Get our defaults
$defaults = generate_get_default_fonts();
// Get our settings
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
$defaults
);
// We don't need to do this if we're using the default font, as these values have defaults already
if ( $defaults['font_body'] == $generate_settings['font_body'] ) {
return;
}
// Don't need to continue if we're using a system font or our default font
if ( in_array( $generate_settings['font_body'], generate_typography_default_fonts() ) ) {
return;
}
// Don't continue if our category and variants are already set
if ( get_theme_mod( 'font_body_category' ) && get_theme_mod( 'font_body_variants' ) ) {
return;
}
// Get all of our fonts
$fonts = generate_get_all_google_fonts();
// Get the ID from our font
$id = strtolower( str_replace( ' ', '_', $generate_settings['font_body'] ) );
// If the ID doesn't exist within our fonts, we can bail
if ( ! array_key_exists( $id, $fonts ) ) {
return;
}
// Let's grab our category to go with our font
$category = ! empty( $fonts[$id]['category'] ) ? $fonts[$id]['category'] : '';
// Grab all of the variants associated with our font
$variants = $fonts[$id]['variants'];
// Loop through our variants and put them into an array, then turn them into a comma separated list
$output = array();
if ( $variants ) {
foreach ( $variants as $variant ) {
$output[] = $variant;
}
$variants = implode(',', $output);
}
// Set our theme mods with our new settings
if ( '' !== $category ) {
set_theme_mod( 'font_body_category', $category );
}
if ( '' !== $variants ) {
set_theme_mod( 'font_body_variants', $variants );
}
}
}
add_action( 'admin_init', 'generate_migrate_existing_settings', 1 );
/**
* Execute functions after existing sites update.
*
* We check to see if options already exist. If they do, we can assume the user has
* updated the theme, and not installed it from scratch.
*
* We run this right away in the Dashboard to avoid other migration functions from
* setting options and causing these functions to run on fresh installs.
*
* @since 2.0
*/
function generate_migrate_existing_settings() {
// Existing settings with no defaults.
$existing_settings = get_option( 'generate_settings' );
if ( get_theme_mod( 'font_body_variants', '' ) ) {
$existing_settings['font_body_variants'] = get_theme_mod( 'font_body_variants' );
}
if ( get_theme_mod( 'font_body_category', '' ) ) {
$existing_settings['font_body_category'] = get_theme_mod( 'font_body_category' );
}
// Existing settings with defaults.
$settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
// Empty arrays to add data to.
$migrated_flags = array();
$new_settings = array();
// An option to see what we've migrated.
$migration_settings = get_option( 'generate_migration_settings', array() );
// We have settings, so this isn't a fresh install.
if ( ! empty( $existing_settings ) ) {
// Turn on the full Font Awesome library for existing websites.
if ( ! isset( $migration_settings['font_awesome_essentials_updated'] ) || 'true' !== $migration_settings['font_awesome_essentials_updated'] ) {
$new_settings['font_awesome_essentials'] = false;
}
// Turn off dynamic CSS caching for existing websites.
if ( ! isset( $migration_settings['skip_dynamic_css_cache'] ) || 'true' !== $migration_settings['skip_dynamic_css_cache'] ) {
$new_settings['dynamic_css_cache'] = false;
}
// Set our font family to Open Sans if we never saved a different font.
if ( ! isset( $migration_settings['default_font_updated'] ) || 'true' !== $migration_settings['default_font_updated'] ) {
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
array(
'font_body' => 'Open Sans',
)
);
$category = get_theme_mod( 'font_body_category', 'sans-serif' );
$variants = get_theme_mod( 'font_body_variants', '300,300italic,regular,italic,600,600italic,700,700italic,800,800italic' );
if ( 'Open Sans' == $generate_settings['font_body'] ) {
$new_settings['font_body'] = 'Open Sans';
set_theme_mod( 'font_body_category', $category );
set_theme_mod( 'font_body_variants', $variants );
}
}
// Set blog post content to full content if it hasn't been set otherwise.
if ( ! isset( $migration_settings['blog_post_content_preview'] ) || 'true' !== $migration_settings['blog_post_content_preview'] ) {
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
array(
'post_content' => 'full',
)
);
if ( 'full' === $generate_settings['post_content'] ) {
$new_settings['post_content'] = 'full';
}
}
}
// Set our flags.
if ( ! isset( $migration_settings['font_awesome_essentials_updated'] ) || 'true' !== $migration_settings['font_awesome_essentials_updated'] ) {
$migrated_flags['font_awesome_essentials_updated'] = 'true';
}
if ( ! isset( $migration_settings['skip_dynamic_css_cache'] ) || 'true' !== $migration_settings['skip_dynamic_css_cache'] ) {
$migrated_flags['skip_dynamic_css_cache'] = 'true';
}
if ( ! isset( $migration_settings['default_font_updated'] ) || 'true' !== $migration_settings['default_font_updated'] ) {
$migrated_flags['default_font_updated'] = 'true';
}
if ( ! isset( $migration_settings['blog_post_content_preview'] ) || 'true' !== $migration_settings['blog_post_content_preview'] ) {
$migrated_flags['blog_post_content_preview'] = 'true';
}
// Merge our new settings with our existing settings.
if ( ! empty( $new_settings ) ) {
$update_settings = wp_parse_args( $new_settings, $settings );
update_option( 'generate_settings', $update_settings );
}
// Set our migrated setting flags.
if ( ! empty( $migrated_flags ) ) {
$update_migration_flags = wp_parse_args( $migrated_flags, $migration_settings );
update_option( 'generate_migration_settings', $update_migration_flags );
}
}

View File

@ -41,7 +41,7 @@ if ( ! function_exists( 'generate_woocommerce_start' ) ) {
*/
function generate_woocommerce_start() {
?>
<div id="primary" <?php generate_do_element_classes( 'content' );?>>
<div id="primary" <?php generate_do_element_classes( 'content' ); ?>>
<main id="main" <?php generate_do_element_classes( 'main' ); ?>>
<?php
/**
@ -62,9 +62,15 @@ if ( ! function_exists( 'generate_woocommerce_start' ) ) {
* @hooked generate_featured_page_header_inside_single - 10
*/
do_action( 'generate_before_content' );
$itemprop = '';
if ( 'microdata' === generate_get_schema_type() ) {
$itemprop = ' itemprop="text"';
}
?>
<div class="entry-content" itemprop="text">
<?php
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
<?php
}
}
@ -77,7 +83,7 @@ if ( ! function_exists( 'generate_woocommerce_end' ) ) {
*/
function generate_woocommerce_end() {
?>
</div><!-- .entry-content -->
</div>
<?php
/**
* generate_after_content hook.
@ -86,8 +92,8 @@ if ( ! function_exists( 'generate_woocommerce_end' ) ) {
*/
do_action( 'generate_after_content' );
?>
</div><!-- .inside-article -->
</article><!-- #post-## -->
</div>
</article>
<?php
/**
* generate_after_main_content hook.
@ -96,9 +102,9 @@ if ( ! function_exists( 'generate_woocommerce_end' ) ) {
*/
do_action( 'generate_after_main_content' );
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
</main>
</div>
<?php
}
}
@ -241,9 +247,15 @@ if ( ! function_exists( 'generate_beaver_builder_css' ) ) {
* @since 1.3.45
*/
function generate_beaver_builder_css() {
if ( generate_is_using_flexbox() ) {
return;
}
$body_classes = get_body_class();
// Check is Beaver Builder is active
// If we have the full-width-content class, we don't need to do anything else
if ( in_array( 'fl-builder', get_body_class() ) && ! in_array( 'full-width-content', get_body_class() ) && ! in_array( 'contained-content', get_body_class() ) ) {
// If we have the full-width-content class, we don't need to do anything else.
if ( in_array( 'fl-builder', $body_classes ) && ! in_array( 'full-width-content', $body_classes ) && ! in_array( 'contained-content', $body_classes ) ) {
global $post;
if ( ! isset( $post ) ) {
@ -266,3 +278,550 @@ if ( ! function_exists( 'generate_beaver_builder_css' ) ) {
}
}
}
add_action( 'wp_enqueue_scripts', 'generate_do_third_party_plugin_css', 50 );
/**
* Add CSS for third-party plugins.
*
* @since 3.0.1
*/
function generate_do_third_party_plugin_css() {
$css = new GeneratePress_CSS();
if ( generate_is_using_flexbox() && class_exists( 'Elementor\Plugin' ) ) {
$css->set_selector( '.elementor-template-full-width .site-content' );
$css->add_property( 'display', 'block' );
}
if ( $css->css_output() ) {
wp_add_inline_style( 'generate-style', $css->css_output() );
}
}
add_action( 'wp_enqueue_scripts', 'generate_do_pro_compatibility', 50 );
/**
* Add CSS to ensure compatibility with GP Premium.
*
* @since 3.0.0
*/
function generate_do_pro_compatibility() {
if ( ! defined( 'GP_PREMIUM_VERSION' ) ) {
return;
}
$css = new GeneratePress_CSS();
if ( version_compare( GP_PREMIUM_VERSION, '1.11.0-alpha.1', '<' ) ) {
if ( generate_is_using_flexbox() && defined( 'GENERATE_SECONDARY_NAV_VERSION' ) ) {
$css->set_selector( '.secondary-navigation .inside-navigation:before, .secondary-navigation .inside-navigation:after' );
$css->add_property( 'content', '"."' );
$css->add_property( 'display', 'block' );
$css->add_property( 'overflow', 'hidden' );
$css->add_property( 'visibility', 'hidden' );
$css->add_property( 'font-size', '0px' );
$css->add_property( 'line-height', '0px' );
$css->add_property( 'width', '0px' );
$css->add_property( 'height', '0px' );
$css->set_selector( '.secondary-navigation .inside-navigation:after' );
$css->add_property( 'clear', 'both' );
}
}
if ( version_compare( GP_PREMIUM_VERSION, '1.12.0-alpha.1', '<' ) ) {
if ( defined( 'GENERATE_MENU_PLUS_VERSION' ) && function_exists( 'generate_menu_plus_get_defaults' ) ) {
$menu_plus_settings = wp_parse_args(
get_option( 'generate_menu_plus_settings', array() ),
generate_menu_plus_get_defaults()
);
if ( generate_is_using_flexbox() && ( 'true' === $menu_plus_settings['sticky_menu'] || 'desktop' === $menu_plus_settings['sticky_menu'] || 'mobile' === $menu_plus_settings['sticky_menu'] || 'enable' === $menu_plus_settings['mobile_header_sticky'] ) ) {
if ( generate_has_inline_mobile_toggle() ) {
$css->start_media_query( generate_get_media_query( 'mobile-menu' ) );
$css->set_selector( '#sticky-placeholder' );
$css->add_property( 'height', '0' );
$css->add_property( 'overflow', 'hidden' );
$css->set_selector( '.has-inline-mobile-toggle #site-navigation.toggled' );
$css->add_property( 'margin-top', '0' );
$css->set_selector( '.has-inline-mobile-menu #site-navigation.toggled .main-nav > ul' );
$css->add_property( 'top', '1.5em' );
$css->stop_media_query();
}
if ( 'desktop' === $menu_plus_settings['sticky_menu'] ) {
$css->set_selector( '.sticky-enabled .gen-sidebar-nav.is_stuck .main-navigation' );
$css->add_property( 'margin-bottom', '0' );
$css->set_selector( '.sticky-enabled .gen-sidebar-nav.is_stuck' );
$css->add_property( 'z-index', '500' );
$css->set_selector( '.sticky-enabled .main-navigation.is_stuck' );
$css->add_property( 'box-shadow', '0 2px 2px -2px rgba(0, 0, 0, .2)' );
$css->set_selector( '.navigation-stick:not(.gen-sidebar-nav)' );
$css->add_property( 'left', '0' );
$css->add_property( 'right', '0' );
$css->add_property( 'width', '100% !important' );
$css->set_selector( '.both-sticky-menu .main-navigation:not(#mobile-header).toggled .main-nav > ul,.mobile-sticky-menu .main-navigation:not(#mobile-header).toggled .main-nav > ul,.mobile-header-sticky #mobile-header.toggled .main-nav > ul' );
$css->add_property( 'position', 'absolute' );
$css->add_property( 'left', '0' );
$css->add_property( 'right', '0' );
$css->add_property( 'z-index', '999' );
}
$css->set_selector( '.nav-float-right .navigation-stick' );
$css->add_property( 'width', '100% !important' );
$css->add_property( 'left', '0' );
$css->set_selector( '.nav-float-right .navigation-stick .navigation-branding' );
$css->add_property( 'margin-right', 'auto' );
if ( ! $menu_plus_settings['navigation_as_header'] ) {
$header_left = 40;
$header_right = 40;
$mobile_header_left = 30;
$mobile_header_right = 30;
if ( function_exists( 'generate_spacing_get_defaults' ) ) {
$spacing_settings = wp_parse_args(
get_option( 'generate_spacing_settings', array() ),
generate_spacing_get_defaults()
);
$header_left = $spacing_settings['header_left'];
$header_right = $spacing_settings['header_right'];
$mobile_header_left = $spacing_settings['mobile_header_left'];
$mobile_header_right = $spacing_settings['mobile_header_right'];
}
if ( function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox() ) {
if ( function_exists( 'generate_get_option' ) && 'text' === generate_get_option( 'container_alignment' ) ) {
$css->set_selector( '.main-navigation.navigation-stick .inside-navigation.grid-container' );
$css->add_property( 'padding-left', $header_left, false, 'px' );
$css->add_property( 'padding-right', $header_right, false, 'px' );
$css->start_media_query( generate_get_media_query( 'mobile-menu' ) );
$css->set_selector( '.main-navigation.navigation-stick .inside-navigation.grid-container' );
$css->add_property( 'padding-left', $mobile_header_left, false, 'px' );
$css->add_property( 'padding-right', $mobile_header_right, false, 'px' );
$css->stop_media_query();
}
}
}
$css->set_selector( '.nav-float-right .main-navigation.has-branding:not([class*="nav-align-"]):not(.mobile-header-navigation) .menu-bar-items,.nav-float-right .main-navigation.has-sticky-branding.navigation-stick:not([class*="nav-align-"]):not(.mobile-header-navigation) .menu-bar-items' );
$css->add_property( 'margin-left', '0' );
}
if ( generate_has_inline_mobile_toggle() && 'false' !== $menu_plus_settings['slideout_menu'] ) {
$css->set_selector( '.slideout-mobile .has-inline-mobile-toggle #site-navigation.toggled,.slideout-both .has-inline-mobile-toggle #site-navigation.toggled' );
$css->add_property( 'margin-top', '0' );
}
if ( 'font' === generate_get_option( 'icons' ) ) {
$css->set_selector( '.main-navigation .slideout-toggle a:before,.slide-opened .slideout-overlay .slideout-exit:before' );
$css->add_property( 'font-family', 'GeneratePress' );
$css->set_selector( '.slideout-navigation .dropdown-menu-toggle:before' );
$css->add_property( 'content', '"\f107" !important' );
$css->set_selector( '.slideout-navigation .sfHover > a .dropdown-menu-toggle:before' );
$css->add_property( 'content', '"\f106" !important' );
}
if ( generate_is_using_flexbox() && $menu_plus_settings['navigation_as_header'] ) {
$content_left = 40;
$content_right = 40;
if ( function_exists( 'generate_spacing_get_defaults' ) ) {
$spacing_settings = wp_parse_args(
get_option( 'generate_spacing_settings', array() ),
generate_spacing_get_defaults()
);
$content_left = $spacing_settings['content_left'];
$content_right = $spacing_settings['content_right'];
}
if ( 'text' === generate_get_option( 'container_alignment' ) ) {
$css->set_selector( '.main-navigation.has-branding .inside-navigation.grid-container, .main-navigation.has-branding .inside-navigation.grid-container' );
$css->add_property( 'padding', generate_padding_css( 0, $content_right, 0, $content_left ) );
}
$css->set_selector( '.navigation-branding' );
$css->add_property( 'margin-left', '10px' );
$css->set_selector( '.navigation-branding .main-title, .mobile-header-navigation .site-logo' );
$css->add_property( 'margin-left', '10px' );
if ( is_rtl() ) {
$css->set_selector( '.navigation-branding' );
$css->add_property( 'margin-left', 'auto' );
$css->add_property( 'margin-right', '10px' );
$css->set_selector( '.navigation-branding .main-title, .mobile-header-navigation .site-logo' );
$css->add_property( 'margin-right', '10px' );
$css->add_property( 'margin-left', '0' );
}
$css->set_selector( '.navigation-branding > div + .main-title' );
$css->add_property( 'margin-left', '10px' );
if ( is_rtl() ) {
$css->set_selector( '.navigation-branding > div + .main-title' );
$css->add_property( 'margin-right', '10px' );
}
$css->set_selector( '.has-branding .navigation-branding img' );
$css->add_property( 'margin', '0' );
$css->start_media_query( generate_get_media_query( 'mobile-menu' ) );
if ( 'text' === generate_get_option( 'container_alignment' ) ) {
$css->set_selector( '.main-navigation.has-branding .inside-navigation.grid-container' );
$css->add_property( 'padding', '0' );
}
$css->stop_media_query();
}
}
if ( defined( 'GENERATE_SPACING_VERSION' ) ) {
if ( generate_is_using_flexbox() ) {
$css->set_selector( '#footer-widgets, .site-info' );
$css->add_property( 'padding', '0' );
}
}
if ( defined( 'GENERATE_SECONDARY_NAV_VERSION' ) ) {
if ( generate_is_using_flexbox() && has_nav_menu( 'secondary' ) ) {
if ( 'text' === generate_get_option( 'container_alignment' ) && function_exists( 'generate_secondary_nav_get_defaults' ) ) {
$secondary_nav_settings = wp_parse_args(
get_option( 'generate_secondary_nav_settings', array() ),
generate_secondary_nav_get_defaults()
);
$spacing_settings = wp_parse_args(
get_option( 'generate_spacing_settings', array() ),
generate_spacing_get_defaults()
);
$navigation_left_padding = absint( $spacing_settings['header_left'] ) - absint( $secondary_nav_settings['secondary_menu_item'] );
$navigation_right_padding = absint( $spacing_settings['header_right'] ) - absint( $secondary_nav_settings['secondary_menu_item'] );
$css->set_selector( '.secondary-nav-below-header .secondary-navigation .inside-navigation.grid-container, .secondary-nav-above-header .secondary-navigation .inside-navigation.grid-container' );
$css->add_property( 'padding', generate_padding_css( 0, $navigation_right_padding, 0, $navigation_left_padding ) );
}
}
}
if ( generate_is_using_flexbox() && defined( 'GENERATE_FONT_VERSION' ) && function_exists( 'generate_get_default_fonts' ) ) {
$font_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_default_fonts()
);
if ( isset( $font_settings['tablet_navigation_font_size'] ) && '' !== $font_settings['tablet_navigation_font_size'] ) {
$css->start_media_query( generate_get_media_query( 'tablet' ) );
$css->set_selector( '.main-navigation .menu-toggle' );
$css->add_property( 'font-size', absint( $font_settings['tablet_navigation_font_size'] ), false, 'px' );
$css->stop_media_query();
}
if ( isset( $font_settings['mobile_navigation_font_size'] ) && '' !== $font_settings['mobile_navigation_font_size'] ) {
$css->start_media_query( generate_get_media_query( 'mobile-menu' ) );
$css->set_selector( '.main-navigation .menu-toggle' );
$css->add_property( 'font-size', absint( $font_settings['mobile_navigation_font_size'] ), false, 'px' );
$css->stop_media_query();
}
}
if ( ! generate_show_title() ) {
$css->set_selector( '.page .entry-content' )->add_property( 'margin-top', '0px' );
if ( is_single() ) {
if ( ! apply_filters( 'generate_post_author', true ) && ! apply_filters( 'generate_post_date', true ) ) {
$css->set_selector( '.single .entry-content' )->add_property( 'margin-top', '0' );
}
}
}
}
if ( $css->css_output() ) {
wp_add_inline_style( 'generate-style', $css->css_output() );
}
}
add_filter( 'generate_menu_item_dropdown_arrow_direction', 'generate_set_pro_menu_item_arrow_directions', 10, 3 );
/**
* Set the menu item arrow directions for Secondary and Slideout navs.
*
* @since 3.0.0
* @param string $arrow_direction The current direction.
* @param object $args The args for the current menu.
* @param int $depth The current depth of the menu item.
*/
function generate_set_pro_menu_item_arrow_directions( $arrow_direction, $args, $depth ) {
if ( function_exists( 'generate_secondary_nav_get_defaults' ) && 'secondary' === $args->theme_location ) {
$settings = wp_parse_args(
get_option( 'generate_secondary_nav_settings', array() ),
generate_secondary_nav_get_defaults()
);
if ( 0 !== $depth ) {
$arrow_direction = 'right';
if ( 'left' === $settings['secondary_nav_dropdown_direction'] ) {
$arrow_direction = 'left';
}
}
if ( 'secondary-nav-left-sidebar' === $settings['secondary_nav_position_setting'] ) {
$arrow_direction = 'right';
if ( 'both-right' === generate_get_layout() ) {
$arrow_direction = 'left';
}
}
if ( 'secondary-nav-right-sidebar' === $settings['secondary_nav_position_setting'] ) {
$arrow_direction = 'left';
if ( 'both-left' === generate_get_layout() ) {
$arrow_direction = 'right';
}
}
if ( 'hover' !== generate_get_option( 'nav_dropdown_type' ) ) {
$arrow_direction = 'down';
}
}
return $arrow_direction;
}
add_filter( 'generate_menu_plus_option_defaults', 'generate_set_menu_plus_compat_defaults' );
/**
* Set defaults in our pro Menu Plus module.
*
* @since 3.0.0
* @param array $defaults The existing defaults.
*/
function generate_set_menu_plus_compat_defaults( $defaults ) {
if ( generate_has_inline_mobile_toggle() ) {
$defaults['mobile_menu_label'] = '';
}
return $defaults;
}
add_filter( 'generate_spacing_option_defaults', 'generate_set_spacing_compat_defaults', 20 );
/**
* Set defaults in our pro Spacing module.
*
* @since 3.0.0
* @param array $defaults The existing defaults.
*/
function generate_set_spacing_compat_defaults( $defaults ) {
$defaults['mobile_header_top'] = '';
$defaults['mobile_header_bottom'] = '';
$defaults['mobile_header_right'] = '30';
$defaults['mobile_header_left'] = '30';
$defaults['mobile_widget_top'] = '30';
$defaults['mobile_widget_right'] = '30';
$defaults['mobile_widget_bottom'] = '30';
$defaults['mobile_widget_left'] = '30';
$defaults['mobile_footer_widget_container_top'] = '30';
$defaults['mobile_footer_widget_container_right'] = '30';
$defaults['mobile_footer_widget_container_bottom'] = '30';
$defaults['mobile_footer_widget_container_left'] = '30';
return $defaults;
}
add_filter( 'generate_page_hero_css_output', 'generate_do_pro_page_hero_css', 10, 2 );
/**
* Add CSS to our premium Page Heroes.
*
* @since 3.0.0
* @param string $css_output Existing CSS.
* @param array $options The Header Element options.
*/
function generate_do_pro_page_hero_css( $css_output, $options ) {
if ( ! defined( 'GP_PREMIUM_VERSION' ) ) {
return $css_output;
}
$new_css = '';
if ( version_compare( GP_PREMIUM_VERSION, '1.12.0-alpha.1', '<' ) ) {
$css = new GeneratePress_CSS();
$padding_inside = false;
if ( generate_is_using_flexbox() && 'text' === generate_get_option( 'container_alignment' ) ) {
$padding_inside = true;
}
if ( $padding_inside ) {
$container_width = generate_get_option( 'container_width' );
$padding_right = '0px';
$padding_left = '0px';
if ( $options['padding_right'] ) {
$padding_right = absint( $options['padding_right'] ) . $options['padding_right_unit'];
}
if ( $options['padding_left'] ) {
$padding_left = absint( $options['padding_left'] ) . $options['padding_left_unit'];
}
$css->set_selector( '.page-hero .inside-page-hero.grid-container' );
$css->add_property(
'max-width',
sprintf(
'calc(%1$s - %2$s - %3$s)',
$container_width . 'px',
$padding_right,
$padding_left
)
);
}
if ( generate_is_using_flexbox() && '' !== $options['site_header_merge'] ) {
if ( 'merge-desktop' === $options['site_header_merge'] ) {
$css->start_media_query( apply_filters( 'generate_not_mobile_media_query', '(min-width: 769px)' ) );
}
if ( $options['navigation_colors'] ) {
$navigation_background = $options['navigation_background_color'] ? $options['navigation_background_color'] : 'transparent';
$navigation_background_hover = $options['navigation_background_color_hover'] ? $options['navigation_background_color_hover'] : 'transparent';
$css->set_selector( '.header-wrap #site-navigation:not(.toggled), .header-wrap #mobile-header:not(.toggled):not(.navigation-stick), .has-inline-mobile-toggle .mobile-menu-control-wrapper' );
$css->add_property( 'background', $navigation_background );
$css->set_selector( '.main-navigation:not(.toggled):not(.navigation-stick) .menu-bar-item:not(.close-search) > a' );
$css->add_property( 'color', esc_attr( $options['navigation_text_color'] ) );
$css->set_selector( '.header-wrap #site-navigation:not(.toggled) .menu-bar-item:not(.close-search):hover > a, .header-wrap #mobile-header:not(.toggled) .menu-bar-item:not(.close-search):hover > a, .header-wrap #site-navigation:not(.toggled) .menu-bar-item:not(.close-search).sfHover > a, .header-wrap #mobile-header:not(.toggled) .menu-bar-item:not(.close-search).sfHover > a' );
$css->add_property( 'background', $navigation_background_hover );
if ( '' !== $options['navigation_text_color_hover'] ) {
$css->add_property( 'color', esc_attr( $options['navigation_text_color_hover'] ) );
} else {
$css->add_property( 'color', esc_attr( $options['navigation_text_color'] ) );
}
}
if ( 'merge-desktop' === $options['site_header_merge'] ) {
$css->stop_media_query();
}
}
if ( $css->css_output() ) {
$new_css = $css->css_output();
}
}
return $css_output . $new_css;
}
add_action( 'customize_register', 'generate_pro_compat_customize_register', 100 );
/**
* Alter some Customizer options in the pro version.
*
* @since 3.0.0
* @param object $wp_customize The Customizer object.
*/
function generate_pro_compat_customize_register( $wp_customize ) {
if ( ! defined( 'GP_PREMIUM_VERSION' ) ) {
return;
}
if ( version_compare( GP_PREMIUM_VERSION, '1.12.0-alpha.1', '<' ) ) {
if ( $wp_customize->get_setting( 'generate_spacing_settings[separator]' ) ) {
$wp_customize->get_setting( 'generate_spacing_settings[separator]' )->transport = 'refresh';
}
if ( $wp_customize->get_setting( 'generate_spacing_settings[right_sidebar_width]' ) ) {
$wp_customize->get_setting( 'generate_spacing_settings[right_sidebar_width]' )->transport = 'refresh';
}
if ( $wp_customize->get_setting( 'generate_spacing_settings[left_sidebar_width]' ) ) {
$wp_customize->get_setting( 'generate_spacing_settings[left_sidebar_width]' )->transport = 'refresh';
}
if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_top]' ) ) {
$wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_top]' )->transport = 'refresh';
}
if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_right]' ) ) {
$wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_right]' )->transport = 'refresh';
}
if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_bottom]' ) ) {
$wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_bottom]' )->transport = 'refresh';
}
if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_left]' ) ) {
$wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_left]' )->transport = 'refresh';
}
if ( $wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_top]' ) ) {
$wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_top]' )->transport = 'refresh';
}
if ( $wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_right]' ) ) {
$wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_right]' )->transport = 'refresh';
}
if ( $wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_bottom]' ) ) {
$wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_bottom]' )->transport = 'refresh';
}
if ( $wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_left]' ) ) {
$wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_left]' )->transport = 'refresh';
}
if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_top]' ) ) {
$wp_customize->get_setting( 'generate_spacing_settings[footer_top]' )->transport = 'refresh';
}
if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_right]' ) ) {
$wp_customize->get_setting( 'generate_spacing_settings[footer_right]' )->transport = 'refresh';
}
if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_bottom]' ) ) {
$wp_customize->get_setting( 'generate_spacing_settings[footer_bottom]' )->transport = 'refresh';
}
if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_left]' ) ) {
$wp_customize->get_setting( 'generate_spacing_settings[footer_left]' )->transport = 'refresh';
}
}
}
add_action( 'wp', 'generate_do_pro_compatibility_setup' );
/**
* Do basic compatibility with GP Premium versions.
*
* @since 3.0.0
*/
function generate_do_pro_compatibility_setup() {
if ( ! defined( 'GP_PREMIUM_VERSION' ) ) {
return;
}
if ( version_compare( GP_PREMIUM_VERSION, '1.12.0-alpha.1', '<' ) ) {
// Fix Elements removing archive post titles.
if ( function_exists( 'generate_premium_do_elements' ) && ! is_singular() ) {
add_filter( 'generate_show_title', '__return_true', 20 );
}
}
}

View File

@ -20,10 +20,8 @@ if ( ! function_exists( 'generate_archive_title' ) ) {
if ( ! function_exists( 'the_archive_title' ) ) {
return;
}
$clearfix = is_author() ? ' clearfix' : '';
?>
<header class="page-header<?php echo $clearfix; // WPCS: XSS ok, sanitization ok. ?>">
<header class="page-header">
<?php
/**
* generate_before_archive_title hook.
@ -47,7 +45,7 @@ if ( ! function_exists( 'generate_archive_title' ) ) {
*/
do_action( 'generate_after_archive_title' );
?>
</header><!-- .page-header -->
</header>
<?php
}
}
@ -59,7 +57,7 @@ if ( ! function_exists( 'generate_filter_the_archive_title' ) ) {
*
* @since 1.3.45
*
* @param string $title The archive title
* @param string $title The archive title.
* @return string The altered archive title
*/
function generate_filter_the_archive_title( $title ) {
@ -73,10 +71,13 @@ if ( ! function_exists( 'generate_filter_the_archive_title' ) ) {
* 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' ), 75 ),
$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
@ -100,11 +101,11 @@ function generate_do_archive_description() {
$term_description = term_description();
if ( ! empty( $term_description ) ) {
printf( '<div class="taxonomy-description">%s</div>', $term_description ); // WPCS: XSS ok, sanitization ok.
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>'; // WPCS: XSS ok, sanitization ok.
echo '<div class="author-info">' . get_the_author_meta( 'description' ) . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**

View File

@ -12,53 +12,58 @@ if ( ! defined( 'ABSPATH' ) ) {
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 ) : ?>
if ( 'pingback' === $comment->comment_type || 'trackback' === $comment->comment_type ) : ?>
<li id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
<div class="comment-body">
<?php _e( 'Pingback:', 'generatepress' ); // WPCS: XSS OK. ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( 'Edit', 'generatepress' ), '<span class="edit-link">', '</span>' ); ?>
<?php esc_html_e( 'Pingback:', 'generatepress' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( 'Edit', 'generatepress' ), '<span class="edit-link">', '</span>' ); ?>
</div>
<?php else : ?>
<li id="comment-<?php comment_ID(); ?>" <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?>>
<article id="div-comment-<?php comment_ID(); ?>" class="comment-body" <?php generate_do_microdata( 'comment-body' ); ?>>
<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'] ) {
if ( 0 != $args['avatar_size'] ) { // phpcs:ignore
echo get_avatar( $comment, $args['avatar_size'] );
}
?>
<div class="comment-author-info">
<div class="comment-author vcard" <?php generate_do_microdata( 'comment-author' ); ?>>
<div <?php generate_do_element_classes( 'comment-author' ); ?>>
<?php printf( '<cite itemprop="name" class="fn">%s</cite>', get_comment_author_link() ); ?>
</div><!-- .comment-author -->
</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( // WPCS: XSS OK.
/* translators: 1: date, 2: time */
_x( '%1$s at %2$s', '1: date, 2: time', 'generatepress' ),
get_comment_date(),
get_comment_time()
); ?>
<?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><!-- .comment-metadata -->
</div><!-- .comment-author-info -->
</div>
</div>
<?php if ( '0' == $comment->comment_approved ) : ?>
<p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'generatepress' ); // WPCS: XSS OK. ?></p>
<?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><!-- .comment-meta -->
</footer>
<div class="comment-content" itemprop="text">
<?php
@ -66,7 +71,6 @@ if ( ! function_exists( 'generate_comment' ) ) {
* generate_before_comment_content hook.
*
* @since 2.4
*
*/
do_action( 'generate_before_comment_text', $comment, $args, $depth );
@ -76,13 +80,12 @@ if ( ! function_exists( 'generate_comment' ) ) {
* generate_after_comment_content hook.
*
* @since 2.4
*
*/
do_action( 'generate_after_comment_text', $comment, $args, $depth );
?>
</div><!-- .comment-content -->
</article><!-- .comment-body -->
<?php
</div>
</article>
<?php
endif;
}
}
@ -92,15 +95,23 @@ add_action( 'generate_after_comment_text', 'generate_do_comment_reply_link', 10,
* 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>',
) ) );
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' );
@ -109,21 +120,21 @@ add_filter( 'comment_form_defaults', 'generate_set_comment_form_defaults' );
*
* @since 2.3
*
* @param array $defaults
* @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"></textarea></p>',
'<p class="comment-form-comment"><label for="comment" class="screen-reader-text">%1$s</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true" required></textarea></p>',
esc_html__( 'Comment', 'generatepress' )
);
$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' ) );
$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;
}
@ -133,22 +144,25 @@ add_filter( 'comment_form_default_fields', 'generate_filter_comment_fields' );
* Customizes the existing comment fields.
*
* @since 2.1.2
* @param array $fields
* @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 *" id="author" name="author" type="text" value="%2$s" size="30" />',
'<label for="author" class="screen-reader-text">%1$s</label><input placeholder="%1$s%3$s" id="author" name="author" type="text" value="%2$s" size="30" />',
esc_html__( 'Name', 'generatepress' ),
esc_attr( $commenter['comment_author'] )
esc_attr( $commenter['comment_author'] ),
$required ? ' *' : ''
);
$fields['email'] = sprintf(
'<label for="email" class="screen-reader-text">%1$s</label><input placeholder="%1$s *" id="email" name="email" type="email" value="%2$s" size="30" />',
'<label for="email" class="screen-reader-text">%1$s</label><input placeholder="%1$s%3$s" id="email" name="email" type="email" value="%2$s" size="30" />',
esc_html__( 'Email', 'generatepress' ),
esc_attr( $commenter['comment_author_email'] )
esc_attr( $commenter['comment_author_email'] ),
$required ? ' *' : ''
);
$fields['url'] = sprintf(
@ -159,3 +173,32 @@ function generate_filter_comment_fields( $fields ) {
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;
}
}

Some files were not shown because too many files have changed in this diff Show More