Initial commit

This commit is contained in:
2020-04-07 13:03:04 +00:00
committed by Gitium
commit 00f842d9bf
1673 changed files with 471161 additions and 0 deletions

View File

@ -0,0 +1,93 @@
<?php
/**
* The template for displaying 404 pages (Not Found).
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
get_header(); ?>
<div id="primary" <?php generate_do_element_classes( 'content' ); ?>>
<main id="main" <?php generate_do_element_classes( 'main' ); ?>>
<?php
/**
* generate_before_main_content hook.
*
* @since 0.1
*/
do_action( 'generate_before_main_content' );
?>
<div class="inside-article">
<?php
/**
* generate_before_content hook.
*
* @since 0.1
*
* @hooked generate_featured_page_header_inside_single - 10
*/
do_action( 'generate_before_content' );
?>
<header class="entry-header">
<h1 class="entry-title" 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.
*
* @since 0.1
*/
do_action( 'generate_after_main_content' );
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
/**
* generate_after_primary_content_area hook.
*
* @since 2.0
*/
do_action( 'generate_after_primary_content_area' );
generate_construct_sidebars();
get_footer();

View File

@ -0,0 +1,81 @@
<?php
/**
* The template for displaying Archive pages.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
get_header(); ?>
<div id="primary" <?php generate_do_element_classes( 'content' ); ?>>
<main id="main" <?php generate_do_element_classes( 'main' ); ?>>
<?php
/**
* generate_before_main_content hook.
*
* @since 0.1
*/
do_action( 'generate_before_main_content' );
if ( 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.
*/
get_template_part( 'content', get_post_format() );
endwhile;
/**
* generate_after_loop hook.
*
* @since 2.3
*/
do_action( 'generate_after_loop' );
generate_content_nav( 'nav-below' );
else :
get_template_part( 'no-results', 'archive' );
endif;
/**
* generate_after_main_content hook.
*
* @since 0.1
*/
do_action( 'generate_after_main_content' );
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
/**
* generate_after_primary_content_area hook.
*
* @since 2.0
*/
do_action( 'generate_after_primary_content_area' );
generate_construct_sidebars();
get_footer();

View File

@ -0,0 +1,113 @@
<?php
/**
* The template for displaying Comments.
*
* The area of the page that contains both current comments
* and the comment form. The actual display of comments is
* handled by a callback to generate_comment() which is
* located in the inc/template-tags.php file.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/*
* If the current post is protected by a password and
* the visitor has not yet entered the password we will
* return early without loading the comments.
*/
if ( post_password_required() ) {
return;
}
/**
* generate_before_comments hook.
*
* @since 0.1
*/
do_action( 'generate_before_comments' );
?>
<div id="comments">
<?php
/**
* generate_inside_comments hook.
*
* @since 1.3.47
*/
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'
) ),
number_format_i18n( $comments_number ),
get_the_title()
) );
echo esc_html( $comments_title );
?>
</h3>
<?php
/**
* generate_below_comments_title hook.
*
* @since 0.1
*/
do_action( 'generate_below_comments_title' );
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>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'generatepress' ) ); ?></div>
</nav><!-- #comment-nav-above -->
<?php endif; ?>
<ol class="comment-list">
<?php
/*
* Loop through and list the comments. Tell wp_list_comments()
* to use generate_comment() to format the comments.
* If you want to override this in a child theme, then you can
* 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',
) );
?>
</ol><!-- .comment-list -->
<?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;
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;
comment_form();
?>
</div><!-- #comments -->

View File

@ -0,0 +1,96 @@
<?php
/**
* The template for displaying Link post formats.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
<div class="inside-article">
<?php
/**
* generate_before_content hook.
*
* @since 0.1
*
* @hooked generate_featured_page_header_inside_single - 10
*/
do_action( 'generate_before_content' );
?>
<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' );
?>
</header><!-- .entry-header -->
<?php
/**
* generate_after_entry_header hook.
*
* @since 0.1
*
* @hooked generate_post_image - 10
*/
do_action( 'generate_after_entry_header' );
if ( generate_show_excerpt() ) : ?>
<div class="entry-summary" itemprop="text">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<?php else : ?>
<div class="entry-content" itemprop="text">
<?php
the_content();
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
<?php endif;
/**
* generate_after_entry_content hook.
*
* @since 0.1
*
* @hooked generate_footer_meta - 10
*/
do_action( 'generate_after_entry_content' );
/**
* generate_after_content hook.
*
* @since 0.1
*/
do_action( 'generate_after_content' );
?>
</div><!-- .inside-article -->
</article><!-- #post-## -->

View File

@ -0,0 +1,79 @@
<?php
/**
* The template used for displaying page content in page.php
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
<div class="inside-article">
<?php
/**
* generate_before_content hook.
*
* @since 0.1
*
* @hooked generate_featured_page_header_inside_single - 10
*/
do_action( 'generate_before_content' );
if ( generate_show_title() ) : ?>
<header class="entry-header">
<?php
/**
* generate_before_page_title hook.
*
* @since 2.4
*/
do_action( 'generate_before_page_title' );
the_title( '<h1 class="entry-title" itemprop="headline">', '</h1>' );
/**
* generate_after_page_title hook.
*
* @since 2.4
*/
do_action( 'generate_after_page_title' );
?>
</header><!-- .entry-header -->
<?php endif;
/**
* 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
the_content();
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
<?php
/**
* generate_after_content hook.
*
* @since 0.1
*/
do_action( 'generate_after_content' );
?>
</div><!-- .inside-article -->
</article><!-- #post-## -->

View File

@ -0,0 +1,90 @@
<?php
/**
* The template for displaying single posts.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
<div class="inside-article">
<?php
/**
* generate_before_content hook.
*
* @since 0.1
*
* @hooked generate_featured_page_header_inside_single - 10
*/
do_action( 'generate_before_content' );
?>
<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' );
?>
</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
the_content();
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
<?php
/**
* generate_after_entry_content hook.
*
* @since 0.1
*
* @hooked generate_footer_meta - 10
*/
do_action( 'generate_after_entry_content' );
/**
* generate_after_content hook.
*
* @since 0.1
*/
do_action( 'generate_after_content' );
?>
</div><!-- .inside-article -->
</article><!-- #post-## -->

View File

@ -0,0 +1,95 @@
<?php
/**
* The template for displaying posts within the loop.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
<div class="inside-article">
<?php
/**
* generate_before_content hook.
*
* @since 0.1
*
* @hooked generate_featured_page_header_inside_single - 10
*/
do_action( 'generate_before_content' );
?>
<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' );
?>
</header><!-- .entry-header -->
<?php
/**
* generate_after_entry_header hook.
*
* @since 0.1
*
* @hooked generate_post_image - 10
*/
do_action( 'generate_after_entry_header' );
if ( generate_show_excerpt() ) : ?>
<div class="entry-summary" itemprop="text">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<?php else : ?>
<div class="entry-content" itemprop="text">
<?php
the_content();
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
<?php endif;
/**
* generate_after_entry_content hook.
*
* @since 0.1
*
* @hooked generate_footer_meta - 10
*/
do_action( 'generate_after_entry_content' );
/**
* generate_after_content hook.
*
* @since 0.1
*/
do_action( 'generate_after_content' );
?>
</div><!-- .inside-article -->
</article><!-- #post-## -->

View File

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

View File

@ -0,0 +1,65 @@
img {
max-width: 100%;
height: auto;
}
pre {
background: rgba(0, 0, 0, 0.05);
font-family: inherit;
font-size: inherit;
line-height: normal;
margin-bottom: 1.5em;
padding: 20px;
overflow: auto;
max-width: 100%;
}
blockquote {
border-left: 5px solid rgba(0, 0, 0, 0.05);
padding: 20px;
font-size: 1.2em;
font-style:italic;
margin: 0 0 1.5em;
position: relative;
}
blockquote p:last-child {
margin: 0;
}
table, th, td {
border: 1px solid rgba(0, 0, 0, 0.1);
}
table {
border-collapse: separate;
border-spacing: 0;
border-width: 1px 0 0 1px;
margin: 0 0 1.5em;
table-layout: fixed;
width: 100%;
}
th,
td {
padding: 8px;
}
th {
border-width: 0 1px 1px 0;
}
td {
border-width: 0 1px 1px 0;
}
hr {
background-color: rgba(0, 0, 0, 0.1);
border: 0;
height: 1px;
margin-bottom: 40px;
margin-top: 40px;
}
/* Make sure embeds and iframes fit their containers */
embed,
iframe,
object {
max-width: 100%;
}

View File

@ -0,0 +1,80 @@
.generate-meta-box-content > div {
padding: 12px;
}
#generate_layout_options_meta_box .inside {
padding: 0;
margin:0;
}
#generate-meta-box-container .generate-meta-box-menu {
position: relative;
float: left;
list-style: none;
width: 180px;
line-height: 1em;
margin: 0 0 -1px 0;
padding: 0;
background-color: #fafafa;
border-right: 1px solid #eee;
box-sizing: border-box;
}
#generate-meta-box-container .generate-meta-box-menu li {
display: block;
position: relative;
margin: 0;
padding: 0;
line-height: 20px;
}
#generate-meta-box-container .generate-meta-box-menu li a {
display: block;
margin: 0;
padding: 10px;
line-height: 20px !important;
text-decoration: none;
border-bottom: 1px solid #eee;
box-shadow: none;
}
#generate-meta-box-container .generate-meta-box-content {
float: left;
width: calc( 100% - 180px );
margin-left: -1px;
border-left: 1px solid #eee;
background-color: #fff;
}
#generate-meta-box-container {
overflow: hidden;
background: #fff;
background: linear-gradient( 90deg, #fafafa 0%, #fafafa 180px, #fff 180px, #fff 100% );
}
#generate-meta-box-container .current {
position: relative;
font-weight: bold;
background-color: #e0e0e0;
}
#generate-meta-box-container .current a {
color: #555;
}
#generate-meta-box-container label {
font-weight: 400;
display: inline-block;
margin-bottom: 3px;
}
.generate-meta-box-menu li {
display: inline-block;
}
#side-sortables #generate-meta-box-container .generate-meta-box-menu,
#side-sortables #generate-meta-box-container .generate-meta-box-content {
float: none;
width: 100%;
margin: 0;
border: 0;
}

View File

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

File diff suppressed because one or more lines are too long

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,304 @@
/*--------------------------------------------------------------
>>> TABLE OF CONTENTS:
----------------------------------------------------------------
# Mobile Menu
# Breakpoint (768px)
# Links
# Top Bar
# Content Area
# Header
# Footer
--------------------------------------------------------------*/
/*--------------------------------------------------------------
## Mobile Menu
--------------------------------------------------------------*/
button.menu-toggle {
background-color: transparent;
width: 100%;
border: 0;
text-align: center;
}
button.menu-toggle:hover,
button.menu-toggle:active,
button.menu-toggle:focus {
background-color: transparent;
}
.menu-toggle: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:hover > ul,
.dropdown-hover .main-navigation.toggled ul li.sfHover > ul {
transition-delay: 0s;
}
.toggled .menu-item-has-children .dropdown-menu-toggle {
padding-left: 20px;
}
.main-navigation.toggled ul ul {
transition: 0s;
visibility: hidden;
}
.main-navigation.toggled .main-nav > ul {
display: block;
}
.main-navigation.toggled .main-nav ul ul.toggled-on {
position: relative;
top: 0;
left: auto !important;
right: auto !important;
width: 100%;
pointer-events: auto;
height: auto;
opacity: 1;
display: block;
visibility: visible;
}
.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 {
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 .menu li.search-item {
display: none !important;
}
.main-navigation.toggled .sf-menu > li.menu-item-float-right {
float: none !important;
display: inline-block !important;
}
/*--------------------------------------------------------------
# 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;
}
/*--------------------------------------------------------------
## Header
--------------------------------------------------------------*/
.inside-header > *:not(:last-child):not(.main-navigation) {
margin-bottom: 20px;
}
.site-header,
.header-aligned-right .site-header {
text-align: center;
}
.header-widget {
float: none;
max-width: 100%;
text-align: center;
}
/*--------------------------------------------------------------
## Content Area
--------------------------------------------------------------*/
.sidebar,
.content-area,
.inside-footer-widgets > div {
float: none;
width: 100%;
left: 0;
right: 0;
}
.site-main {
margin-left: 0 !important;
margin-right: 0 !important;
}
body:not(.no-sidebar) .site-main {
margin-bottom: 0 !important;
}
.one-container .sidebar {
margin-top: 40px;
}
.separate-containers #left-sidebar + #right-sidebar .inside-right-sidebar {
margin-top: 0;
}
.both-right.separate-containers .inside-left-sidebar,
.both-left.separate-containers .inside-left-sidebar,
.both-right.separate-containers .inside-right-sidebar,
.both-left.separate-containers .inside-right-sidebar {
margin-right: 0;
margin-left: 0;
}
.alignleft,
.alignright {
float: none;
display: block;
margin-left: auto;
margin-right: auto;
}
.post-image-aligned-left .post-image,
.post-image-aligned-right .post-image {
float: none;
margin: 2em 0;
text-align: center;
}
.comment .children {
padding-left: 10px;
margin-left: 0;
}
.edd_download {
display: block;
float: none !important;
margin-bottom: 1.5em;
width: 100% !important;
}
.entry-meta {
font-size: inherit;
}
.entry-meta a {
line-height: 1.8em;
}
/*--------------------------------------------------------------
## Footer
--------------------------------------------------------------*/
.site-info {
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 @@
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

@ -0,0 +1,567 @@
.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

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 434 KiB

View File

@ -0,0 +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" />
</font></defs></svg>

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

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

View File

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

View File

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

View File

@ -0,0 +1,390 @@
<?php
/**
* Integrate GeneratePress with the WordPress block editor.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Check what sidebar layout we're using.
* We need this function as the post meta in generate_get_layout() only runs
* on is_singular()
*
* @since 2.2
*
* @param bool $meta Check for post meta.
* @return string The saved sidebar layout.
*/
function generate_get_block_editor_sidebar_layout( $meta = true ) {
$layout = generate_get_option( 'layout_setting' );
if ( function_exists( 'get_current_screen' ) ) {
$screen = get_current_screen();
if ( is_object( $screen ) && 'post' === $screen->post_type ) {
$layout = generate_get_option( 'single_layout_setting' );
}
}
// Add in our default filter in case people have adjusted it.
$layout = apply_filters( 'generate_sidebar_layout', $layout );
if ( $meta ) {
$layout_meta = get_post_meta( get_the_ID(), '_generate-sidebar-layout-meta', true );
if ( $layout_meta ) {
$layout = $layout_meta;
}
}
return apply_filters( 'generate_block_editor_sidebar_layout', $layout );
}
/**
* Check whether we're disabling the content title or not.
* We need this function as the post meta in generate_show_title() only runs
* on is_singular()
*
* @since 2.2
*/
function generate_get_block_editor_show_content_title() {
$title = generate_show_title();
$disable_title = get_post_meta( get_the_ID(), '_generate-disable-headline', true );
if ( $disable_title ) {
$title = false;
}
return apply_filters( 'generate_block_editor_show_content_title', $title );
}
/**
* Get the content width for this post.
*
* @since 2.2
*/
function generate_get_block_editor_content_width() {
$container_width = generate_get_option( 'container_width' );
$content_width = $container_width;
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
$layout = generate_get_block_editor_sidebar_layout();
if ( 'left-sidebar' == $layout ) {
$content_width = $container_width * ( ( 100 - $left_sidebar_width ) / 100 );
} elseif ( 'right-sidebar' == $layout ) {
$content_width = $container_width * ( ( 100 - $right_sidebar_width ) / 100 );
} elseif ( 'no-sidebar' == $layout ) {
$content_width = $container_width;
} else {
$content_width = $container_width * ( ( 100 - ( $left_sidebar_width + $right_sidebar_width ) ) / 100 );
}
return apply_filters( 'generate_block_editor_content_width', $content_width );
}
add_action( 'enqueue_block_editor_assets', 'generate_enqueue_google_fonts' );
add_action( 'enqueue_block_editor_assets', 'generate_enqueue_backend_block_editor_assets' );
/**
* Add CSS to the admin side of the block editor.
*
* @since 2.2
*/
function generate_enqueue_backend_block_editor_assets() {
wp_enqueue_style( 'generate-block-editor-styles', get_template_directory_uri() . "/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 );
$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() );
}
$color_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_color_defaults()
);
$spacing_settings = wp_parse_args(
get_option( 'generate_spacing_settings', array() ),
generate_spacing_get_defaults()
);
$text_color = generate_get_option( 'text_color' );
if ( $color_settings['content_text_color'] ) {
$text_color = $color_settings['content_text_color'];
}
wp_localize_script( 'generate-block-editor-scripts', 'generate_block_editor', array(
'global_sidebar_layout' => generate_get_block_editor_sidebar_layout( false ),
'container_width' => generate_get_option( 'container_width' ),
'right_sidebar_width' => apply_filters( 'generate_right_sidebar_width', '25' ),
'left_sidebar_width' => apply_filters( 'generate_left_sidebar_width', '25' ),
'content_padding_right' => absint( $spacing_settings['content_right'] ) . 'px',
'content_padding_left' => absint( $spacing_settings['content_left'] ) . 'px',
'content_title' => generate_get_block_editor_show_content_title() ? 'true' : 'false',
'disable_content_title' => esc_html( 'Disable Content Title', 'generatepress' ),
'show_content_title' => esc_html( 'Show Content Title', 'generatepress' ),
'text_color' => $text_color,
'show_editor_styles' => $show_editor_styles,
) );
}
/**
* Write our CSS for the block editor.
*
* @since 2.2
*/
function generate_do_inline_block_editor_css() {
$color_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_color_defaults()
);
$font_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_default_fonts()
);
$css = new GeneratePress_CSS;
$content_width = generate_get_block_editor_content_width();
$spacing_settings = wp_parse_args(
get_option( 'generate_spacing_settings', array() ),
generate_spacing_get_defaults()
);
$content_width_calc = sprintf(
'calc(%1$s - %2$s - %3$s)',
absint( $content_width ) . 'px',
absint( $spacing_settings['content_left'] ) . 'px',
absint( $spacing_settings['content_right'] ) . 'px'
);
$css->set_selector( 'body .wp-block, html body.gutenberg-editor-page .editor-post-title__block, html body.gutenberg-editor-page .editor-default-block-appender, html body.gutenberg-editor-page .editor-block-list__block' );
if ( 'true' === get_post_meta( get_the_ID(), '_generate-full-width-content', true ) ) {
$css->add_property( 'max-width', '100%' );
} else {
$css->add_property( 'max-width', $content_width_calc );
}
$css->set_selector( 'html body.gutenberg-editor-page .block-editor-block-list__block[data-align="full"]' );
$css->add_property( 'max-width', 'none' );
$css->set_selector( '.edit-post-visual-editor .block-editor-block-list__block[data-align=wide]' );
$css->add_property( 'max-width', absint( $content_width ), false, 'px' );
if ( apply_filters( 'generate_do_group_inner_container_style', true ) ) {
$css->set_selector( '.wp-block-group__inner-container' );
$css->add_property( 'max-width', absint( $content_width ), false, 'px' );
$css->add_property( 'margin-left', 'auto' );
$css->add_property( 'margin-right', 'auto' );
$css->add_property( 'padding', generate_padding_css( $spacing_settings['content_top'], $spacing_settings['content_right'], $spacing_settings['content_bottom'], $spacing_settings['content_left'] ) );
}
$css->set_selector( '.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( '.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'] ) );
$body_family = generate_get_font_family_css( 'font_body', 'generate_settings', generate_get_default_fonts() );
$h1_family = generate_get_font_family_css( 'font_heading_1', 'generate_settings', generate_get_default_fonts() );
$h2_family = generate_get_font_family_css( 'font_heading_2', 'generate_settings', generate_get_default_fonts() );
$h3_family = generate_get_font_family_css( 'font_heading_3', 'generate_settings', generate_get_default_fonts() );
$h4_family = generate_get_font_family_css( 'font_heading_4', 'generate_settings', generate_get_default_fonts() );
$h5_family = generate_get_font_family_css( 'font_heading_5', 'generate_settings', generate_get_default_fonts() );
$h6_family = generate_get_font_family_css( 'font_heading_6', 'generate_settings', generate_get_default_fonts() );
$buttons_family = generate_get_font_family_css( 'font_buttons', 'generate_settings', generate_get_default_fonts() );
$css->set_selector( 'body.gutenberg-editor-page .block-editor-block-list__block, body .editor-styles-wrapper' );
$css->add_property( 'font-family', $body_family );
$css->add_property( 'font-size', absint( $font_settings['body_font_size'] ), false, 'px' );
if ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
} else {
$css->add_property( 'color', esc_attr( 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'] ) );
} else {
$css->add_property( 'color', esc_attr( 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 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-size', absint( $font_settings['heading_1_font_size'] ), false, 'px' );
$css->add_property( 'line-height', floatval( $font_settings['heading_1_line_height'] ), false, 'em' );
if ( $color_settings['h1_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['h1_color'] ) );
} elseif ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
} else {
$css->add_property( 'color', esc_attr( 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->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-size', absint( $font_settings['heading_2_font_size'] ), false, 'px' );
$css->add_property( 'line-height', floatval( $font_settings['heading_2_line_height'] ), false, 'em' );
if ( $color_settings['h2_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['h2_color'] ) );
} elseif ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
} else {
$css->add_property( 'color', esc_attr( 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-size', absint( $font_settings['heading_3_font_size'] ), false, 'px' );
$css->add_property( 'line-height', floatval( $font_settings['heading_3_line_height'] ), false, 'em' );
if ( $color_settings['h3_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['h3_color'] ) );
} elseif ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
} else {
$css->add_property( 'color', esc_attr( 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'] ) );
if ( '' !== $font_settings['heading_4_font_size'] ) {
$css->add_property( 'font-size', absint( $font_settings['heading_4_font_size'] ), false, 'px' );
} else {
$css->add_property( 'font-size', 'inherit' );
}
if ( '' !== $font_settings['heading_4_line_height'] ) {
$css->add_property( 'line-height', floatval( $font_settings['heading_4_line_height'] ), false, 'em' );
}
if ( $color_settings['h4_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['h4_color'] ) );
} elseif ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
} else {
$css->add_property( 'color', esc_attr( 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'] ) );
if ( '' !== $font_settings['heading_5_font_size'] ) {
$css->add_property( 'font-size', absint( $font_settings['heading_5_font_size'] ), false, 'px' );
} else {
$css->add_property( 'font-size', 'inherit' );
}
if ( '' !== $font_settings['heading_5_line_height'] ) {
$css->add_property( 'line-height', floatval( $font_settings['heading_5_line_height'] ), false, 'em' );
}
if ( $color_settings['h5_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['h5_color'] ) );
} elseif ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
} else {
$css->add_property( 'color', esc_attr( 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'] ) );
if ( '' !== $font_settings['heading_6_font_size'] ) {
$css->add_property( 'font-size', absint( $font_settings['heading_6_font_size'] ), false, 'px' );
} else {
$css->add_property( 'font-size', 'inherit' );
}
if ( '' !== $font_settings['heading_6_line_height'] ) {
$css->add_property( 'line-height', floatval( $font_settings['heading_6_line_height'] ), false, 'em' );
}
if ( $color_settings['h6_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['h6_color'] ) );
} elseif ( $color_settings['content_text_color'] ) {
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
} else {
$css->add_property( 'color', esc_attr( generate_get_option( 'text_color' ) ) );
}
$css->set_selector( '.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'] ) );
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' ) ) );
if ( $color_settings['content_background_color'] ) {
$body_background = esc_attr( generate_get_option( 'background_color' ) );
$content_background = esc_attr( $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'] ) );
} else {
$css->add_property( 'color', esc_attr( 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'] ) );
} else {
$css->add_property( 'color', esc_attr( generate_get_option( 'link_color_hover' ) ) );
}
return $css->css_output();
}

View File

@ -0,0 +1,212 @@
<?php
/**
* Builds our dynamic CSS.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! class_exists( 'GeneratePress_CSS' ) ) {
/**
* Creates minified css via PHP.
*
* @author Carlos Rios
* Modified by Tom Usborne for GeneratePress
*/
class GeneratePress_CSS {
/**
* The css selector that you're currently adding rules to
*
* @access protected
* @var string
*/
protected $_selector = '';
/**
* Stores the final css output with all of its rules for the current selector.
*
* @access protected
* @var string
*/
protected $_selector_output = '';
/**
* Stores all of the rules that will be added to the selector
*
* @access protected
* @var string
*/
protected $_css = '';
/**
* The string that holds all of the css to output
*
* @access protected
* @var string
*/
protected $_output = '';
/**
* Stores media queries
*
* @var null
*/
protected $_media_query = null;
/**
* The string that holds all of the css to output inside of the media query
*
* @access protected
* @var string
*/
protected $_media_query_output = '';
/**
* Sets a selector to the object and changes the current selector to a new one
*
* @access public
* @since 1.0
*
* @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 !== '' ) {
$this->add_selector_rules_to_output();
}
$this->_selector = $selector;
return $this;
}
/**
* Adds a css property with value to the css output
*
* @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)
* @return $this
*/
public function add_property( $property, $value, $og_default = false, $unit = false ) {
// Add our unit to our value if it exists.
if ( $unit && '' !== $unit ) {
$value = $value . $unit;
if ( '' !== $og_default ) {
$og_default = $og_default . $unit;
}
}
// If we don't have a value or our value is the same as our og default, bail.
if ( empty( $value ) || $og_default == $value ) {
return false;
}
$this->_css .= $property . ':' . $value . ';';
return $this;
}
/**
* Sets a media query in the class
*
* @since 1.1
* @param string $value
* @return $this
*/
public function start_media_query( $value ) {
// Add the current rules to the output.
$this->add_selector_rules_to_output();
// Add any previous media queries to the output.
if ( ! empty( $this->_media_query ) ) {
$this->add_media_query_rules_to_output();
}
// Set the new media query.
$this->_media_query = $value;
return $this;
}
/**
* Stops using a media query.
*
* @see start_media_query()
*
* @since 1.1
* @return $this
*/
public function stop_media_query() {
return $this->start_media_query( null );
}
/**
* Adds the current media query's rules to the class' output variable
*
* @since 1.1
* @return $this
*/
private function add_media_query_rules_to_output() {
if ( ! empty( $this->_media_query_output ) ) {
$this->_output .= sprintf( '@media %1$s{%2$s}', $this->_media_query, $this->_media_query_output );
// Reset the media query output string.
$this->_media_query_output = '';
}
return $this;
}
/**
* Adds the current selector rules to the output variable
*
* @access private
* @since 1.0
*
* @return $this
*/
private function add_selector_rules_to_output() {
if ( ! empty( $this->_css ) ) {
$this->_selector_output = $this->_selector;
$selector_output = sprintf( '%1$s{%2$s}', $this->_selector_output, $this->_css );
// Add our CSS to the output.
if ( ! empty( $this->_media_query ) ) {
$this->_media_query_output .= $selector_output;
$this->_css = '';
} else {
$this->_output .= $selector_output;
}
// Reset the css.
$this->_css = '';
}
return $this;
}
/**
* Returns the minified css in the $_output variable
*
* @access public
* @since 1.0
*
* @return string
*/
public function css_output() {
// Add current selector's rules to output.
$this->add_selector_rules_to_output();
// Output minified css.
return $this->_output;
}
}
}

View File

@ -0,0 +1,814 @@
<?php
/**
* Output all of our dynamic CSS.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! function_exists( 'generate_base_css' ) ) {
/**
* Generate the CSS in the <head> section using the Theme Customizer.
*
* @since 0.1
*/
function generate_base_css() {
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
$css = new GeneratePress_CSS;
$css->set_selector( 'body' );
$css->add_property( 'background-color', esc_attr( $generate_settings['background_color'] ) );
$css->add_property( 'color', esc_attr( $generate_settings['text_color'] ) );
$css->set_selector( 'a, a:visited' );
$css->add_property( 'color', esc_attr( $generate_settings['link_color'] ) );
$css->set_selector( 'a:visited' )->add_property( 'color', esc_attr( $generate_settings['link_color_visited'] ) );
$css->set_selector( 'a:hover, a:focus, a:active' );
$css->add_property( 'color', esc_attr( $generate_settings['link_color_hover'] ) );
$css->set_selector( 'body .grid-container' )->add_property( 'max-width', absint( $generate_settings['container_width'] ), false, 'px' );
if ( apply_filters( 'generate_do_group_inner_container_style', true ) ) {
$css->set_selector( '.wp-block-group__inner-container' );
$css->add_property( 'max-width', absint( $generate_settings['container_width'] ), false, 'px' );
$css->add_property( 'margin-left', 'auto' );
$css->add_property( 'margin-right', 'auto' );
}
$nav_drop_point = generate_get_option( 'nav_drop_point' );
$nav_location = generate_get_navigation_location();
if ( ( 'nav-float-right' === $nav_location || 'nav-float-left' === $nav_location ) && $nav_drop_point ) {
$media_query = sprintf(
'(max-width: %1$s) and %2$s',
absint( $nav_drop_point ) . 'px',
apply_filters( 'generate_not_mobile_menu_media_query', '(min-width: 769px)' )
);
$css->start_media_query( $media_query );
$css->set_selector( '.inside-header' );
$css->add_property( 'display', '-ms-flexbox' );
$css->add_property( 'display', 'flex' );
$css->add_property( '-ms-flex-direction', 'column' );
$css->add_property( 'flex-direction', 'column' );
$css->add_property( '-ms-flex-align', 'center' );
$css->add_property( 'align-items', 'center' );
$css->set_selector( '.site-logo, .site-branding' );
$css->add_property( 'margin-bottom', '1.5em' );
$css->set_selector( '#site-navigation' );
$css->add_property( 'margin', '0 auto' );
$css->set_selector( '.header-widget' );
$css->add_property( 'margin-top', '1.5em' );
if ( 'nav-float-left' === generate_get_option( 'nav_position_setting' ) ) {
$css->set_selector( '.nav-float-left .site-logo,.nav-float-left .site-branding,.nav-float-left .header-widget' );
$css->add_property( '-webkit-box-ordinal-group', 'initial' );
$css->add_property( '-ms-flex-order', 'initial' );
$css->add_property( 'order', 'initial' );
}
$css->stop_media_query();
}
if ( generate_get_option( 'logo_width' ) ) {
$css->set_selector( '.site-header .header-image' );
$css->add_property( 'width', absint( generate_get_option( 'logo_width' ) ), false, 'px' );
}
do_action( 'generate_base_css', $css );
return apply_filters( 'generate_base_css_output', $css->css_output() );
}
}
if ( ! function_exists( 'generate_advanced_css' ) ) {
/**
* Generate the CSS in the <head> section using the Theme Customizer.
*
* @since 0.1
*/
function generate_advanced_css() {
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_color_defaults()
);
$css = new GeneratePress_CSS;
$css->set_selector( '.top-bar' );
$css->add_property( 'background-color', esc_attr( $generate_settings['top_bar_background_color'] ) );
$css->add_property( 'color', esc_attr( $generate_settings['top_bar_text_color'] ) );
$css->set_selector( '.top-bar a,.top-bar a:visited' );
$css->add_property( 'color', esc_attr( $generate_settings['top_bar_link_color'] ) );
$css->set_selector( '.top-bar a:hover' );
$css->add_property( 'color', esc_attr( $generate_settings['top_bar_link_color_hover'] ) );
$css->set_selector( '.site-header' );
$css->add_property( 'background-color', esc_attr( $generate_settings['header_background_color'] ) );
$css->add_property( 'color', esc_attr( $generate_settings['header_text_color'] ) );
$css->set_selector( '.site-header a,.site-header a:visited' );
$css->add_property( 'color', esc_attr( $generate_settings['header_link_color'] ) );
$css->set_selector( '.site-header a:hover' );
$css->add_property( 'color', esc_attr( $generate_settings['header_link_hover_color'] ) );
$css->set_selector( '.main-title a,.main-title a:hover,.main-title a:visited' );
$css->add_property( 'color', esc_attr( $generate_settings['site_title_color'] ) );
$css->set_selector( '.site-description' );
$css->add_property( 'color', esc_attr( $generate_settings['site_tagline_color'] ) );
$css->set_selector( '.main-navigation,.main-navigation ul ul' );
$css->add_property( 'background-color', esc_attr( $generate_settings['navigation_background_color'] ) );
$css->set_selector( '.main-navigation .main-nav ul li a,.menu-toggle' );
$css->add_property( 'color', esc_attr( $generate_settings['navigation_text_color'] ) );
$css->set_selector( '.main-navigation .main-nav ul li:hover > a,.main-navigation .main-nav ul li:focus > a, .main-navigation .main-nav ul li.sfHover > a' );
$css->add_property( 'color', esc_attr( $generate_settings['navigation_text_hover_color'] ) );
$css->add_property( 'background-color', esc_attr( $generate_settings['navigation_background_hover_color'] ) );
$css->set_selector( 'button.menu-toggle:hover,button.menu-toggle:focus,.main-navigation .mobile-bar-items a,.main-navigation .mobile-bar-items a:hover,.main-navigation .mobile-bar-items a:focus' );
$css->add_property( 'color', esc_attr( $generate_settings['navigation_text_color'] ) );
$css->set_selector( '.main-navigation .main-nav ul li[class*="current-menu-"] > a' );
$css->add_property( 'color', esc_attr( $generate_settings['navigation_text_current_color'] ) );
$css->add_property( 'background-color', esc_attr( $generate_settings['navigation_background_current_color'] ) );
$css->set_selector( '.main-navigation .main-nav ul li[class*="current-menu-"] > a:hover,.main-navigation .main-nav ul li[class*="current-menu-"].sfHover > a' );
$css->add_property( 'color', esc_attr( $generate_settings['navigation_text_current_color'] ) );
$css->add_property( 'background-color', esc_attr( $generate_settings['navigation_background_current_color'] ) );
$navigation_search_background = $generate_settings['navigation_background_hover_color'];
$navigation_search_text = $generate_settings['navigation_text_hover_color'];
if ( '' !== $generate_settings['navigation_search_background_color'] ) {
$navigation_search_background = $generate_settings['navigation_search_background_color'];
}
if ( '' !== $generate_settings['navigation_search_text_color'] ) {
$navigation_search_text = $generate_settings['navigation_search_text_color'];
}
$css->set_selector( '.navigation-search input[type="search"],.navigation-search input[type="search"]:active, .navigation-search input[type="search"]:focus, .main-navigation .main-nav ul li.search-item.active > a' );
$css->add_property( 'color', esc_attr( $navigation_search_text ) );
$css->add_property( 'background-color', esc_attr( $navigation_search_background ) );
if ( '' !== $generate_settings['navigation_search_background_color'] ) {
$css->add_property( 'opacity', '1' );
}
$css->set_selector( '.main-navigation ul ul' );
$css->add_property( 'background-color', esc_attr( $generate_settings['subnavigation_background_color'] ) );
$css->set_selector( '.main-navigation .main-nav ul ul li a' );
$css->add_property( 'color', esc_attr( $generate_settings['subnavigation_text_color'] ) );
$css->set_selector( '.main-navigation .main-nav ul ul li:hover > a,.main-navigation .main-nav ul ul li:focus > a,.main-navigation .main-nav ul ul li.sfHover > a' );
$css->add_property( 'color', esc_attr( $generate_settings['subnavigation_text_hover_color'] ) );
$css->add_property( 'background-color', esc_attr( $generate_settings['subnavigation_background_hover_color'] ) );
$css->set_selector( '.main-navigation .main-nav ul ul li[class*="current-menu-"] > a' );
$css->add_property( 'color', esc_attr( $generate_settings['subnavigation_text_current_color'] ) );
$css->add_property( 'background-color', esc_attr( $generate_settings['subnavigation_background_current_color'] ) );
$css->set_selector( '.main-navigation .main-nav ul ul li[class*="current-menu-"] > a:hover,.main-navigation .main-nav ul ul li[class*="current-menu-"].sfHover > a' );
$css->add_property( 'color', esc_attr( $generate_settings['subnavigation_text_current_color'] ) );
$css->add_property( 'background-color', esc_attr( $generate_settings['subnavigation_background_current_color'] ) );
$css->set_selector( '.separate-containers .inside-article, .separate-containers .comments-area, .separate-containers .page-header, .one-container .container, .separate-containers .paging-navigation, .inside-page-header' );
$css->add_property( 'color', esc_attr( $generate_settings['content_text_color'] ) );
$css->add_property( 'background-color', esc_attr( $generate_settings['content_background_color'] ) );
$css->set_selector( '.inside-article a,.inside-article a:visited,.paging-navigation a,.paging-navigation a:visited,.comments-area a,.comments-area a:visited,.page-header a,.page-header a:visited' );
$css->add_property( 'color', esc_attr( $generate_settings['content_link_color'] ) );
$css->set_selector( '.inside-article a:hover,.paging-navigation a:hover,.comments-area a:hover,.page-header a:hover' );
$css->add_property( 'color', esc_attr( $generate_settings['content_link_hover_color'] ) );
$css->set_selector( '.entry-header h1,.page-header h1' );
$css->add_property( 'color', esc_attr( $generate_settings['content_title_color'] ) );
$css->set_selector( '.entry-title a,.entry-title a:visited' );
$css->add_property( 'color', esc_attr( $generate_settings['blog_post_title_color'] ) );
$css->set_selector( '.entry-title a:hover' );
$css->add_property( 'color', esc_attr( $generate_settings['blog_post_title_hover_color'] ) );
$css->set_selector( '.entry-meta' );
$css->add_property( 'color', esc_attr( $generate_settings['entry_meta_text_color'] ) );
$css->set_selector( '.entry-meta a,.entry-meta a:visited' );
$css->add_property( 'color', esc_attr( $generate_settings['entry_meta_link_color'] ) );
$css->set_selector( '.entry-meta a:hover' );
$css->add_property( 'color', esc_attr( $generate_settings['entry_meta_link_color_hover'] ) );
$css->set_selector( 'h1' );
$css->add_property( 'color', esc_attr( $generate_settings['h1_color'] ) );
$css->set_selector( 'h2' );
$css->add_property( 'color', esc_attr( $generate_settings['h2_color'] ) );
$css->set_selector( 'h3' );
$css->add_property( 'color', esc_attr( $generate_settings['h3_color'] ) );
$css->set_selector( 'h4' );
$css->add_property( 'color', esc_attr( $generate_settings['h4_color'] ) );
$css->set_selector( 'h5' );
$css->add_property( 'color', esc_attr( $generate_settings['h5_color'] ) );
$css->set_selector( 'h6' );
$css->add_property( 'color', esc_attr( $generate_settings['h6_color'] ) );
$css->set_selector( '.sidebar .widget' );
$css->add_property( 'color', esc_attr( $generate_settings['sidebar_widget_text_color'] ) );
$css->add_property( 'background-color', esc_attr( $generate_settings['sidebar_widget_background_color'] ) );
$css->set_selector( '.sidebar .widget a,.sidebar .widget a:visited' );
$css->add_property( 'color', esc_attr( $generate_settings['sidebar_widget_link_color'] ) );
$css->set_selector( '.sidebar .widget a:hover' );
$css->add_property( 'color', esc_attr( $generate_settings['sidebar_widget_link_hover_color'] ) );
$css->set_selector( '.sidebar .widget .widget-title' );
$css->add_property( 'color', esc_attr( $generate_settings['sidebar_widget_title_color'] ) );
$css->set_selector( '.footer-widgets' );
$css->add_property( 'color', esc_attr( $generate_settings['footer_widget_text_color'] ) );
$css->add_property( 'background-color', esc_attr( $generate_settings['footer_widget_background_color'] ) );
$css->set_selector( '.footer-widgets a,.footer-widgets a:visited' );
$css->add_property( 'color', esc_attr( $generate_settings['footer_widget_link_color'] ) );
$css->set_selector( '.footer-widgets a:hover' );
$css->add_property( 'color', esc_attr( $generate_settings['footer_widget_link_hover_color'] ) );
$css->set_selector( '.footer-widgets .widget-title' );
$css->add_property( 'color', esc_attr( $generate_settings['footer_widget_title_color'] ) );
$css->set_selector( '.site-info' );
$css->add_property( 'color', esc_attr( $generate_settings['footer_text_color'] ) );
$css->add_property( 'background-color', esc_attr( $generate_settings['footer_background_color'] ) );
$css->set_selector( '.site-info a,.site-info a:visited' );
$css->add_property( 'color', esc_attr( $generate_settings['footer_link_color'] ) );
$css->set_selector( '.site-info a:hover' );
$css->add_property( 'color', esc_attr( $generate_settings['footer_link_hover_color'] ) );
$css->set_selector( '.footer-bar .widget_nav_menu .current-menu-item a' );
$css->add_property( 'color', esc_attr( $generate_settings['footer_link_hover_color'] ) );
$css->set_selector( 'input[type="text"],input[type="email"],input[type="url"],input[type="password"],input[type="search"],input[type="tel"],input[type="number"],textarea,select' );
$css->add_property( 'color', esc_attr( $generate_settings['form_text_color'] ) );
$css->add_property( 'background-color', esc_attr( $generate_settings['form_background_color'] ) );
$css->add_property( 'border-color', esc_attr( $generate_settings['form_border_color'] ) );
$css->set_selector( 'input[type="text"]:focus,input[type="email"]:focus,input[type="url"]:focus,input[type="password"]:focus,input[type="search"]:focus,input[type="tel"]:focus,input[type="number"]:focus,textarea:focus,select:focus' );
$css->add_property( 'color', esc_attr( $generate_settings['form_text_color_focus'] ) );
$css->add_property( 'background-color', esc_attr( $generate_settings['form_background_color_focus'] ) );
$css->add_property( 'border-color', esc_attr( $generate_settings['form_border_color_focus'] ) );
$css->set_selector( 'button,html input[type="button"],input[type="reset"],input[type="submit"],a.button,a.button:visited,a.wp-block-button__link:not(.has-background)' );
$css->add_property( 'color', esc_attr( $generate_settings['form_button_text_color'] ) );
$css->add_property( 'background-color', esc_attr( $generate_settings['form_button_background_color'] ) );
$css->set_selector( 'button:hover,html input[type="button"]:hover,input[type="reset"]:hover,input[type="submit"]:hover,a.button:hover,button:focus,html input[type="button"]:focus,input[type="reset"]:focus,input[type="submit"]:focus,a.button:focus,a.wp-block-button__link:not(.has-background):active,a.wp-block-button__link:not(.has-background):focus,a.wp-block-button__link:not(.has-background):hover' );
$css->add_property( 'color', esc_attr( $generate_settings['form_button_text_color_hover'] ) );
$css->add_property( 'background-color', esc_attr( $generate_settings['form_button_background_color_hover'] ) );
$css->set_selector( '.generate-back-to-top,.generate-back-to-top:visited' );
$css->add_property( 'background-color', esc_attr( $generate_settings['back_to_top_background_color'] ) );
$css->add_property( 'color', esc_attr( $generate_settings['back_to_top_text_color'] ) );
$css->set_selector( '.generate-back-to-top:hover,.generate-back-to-top:focus' );
$css->add_property( 'background-color', esc_attr( $generate_settings['back_to_top_background_color_hover'] ) );
$css->add_property( 'color', esc_attr( $generate_settings['back_to_top_text_color_hover'] ) );
do_action( 'generate_colors_css', $css );
return apply_filters( 'generate_colors_css_output', $css->css_output() );
}
}
if ( ! function_exists( 'generate_font_css' ) ) {
/**
* Generate the CSS in the <head> section using the Theme Customizer.
*
* @since 0.1
*/
function generate_font_css() {
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_default_fonts()
);
$og_defaults = generate_get_default_fonts( false );
$css = new GeneratePress_CSS;
$subnav_font_size = $generate_settings['navigation_font_size'] >= 17 ? $generate_settings['navigation_font_size'] - 3 : $generate_settings['navigation_font_size'] - 1;
$body_family = generate_get_font_family_css( 'font_body', 'generate_settings', generate_get_default_fonts() );
$top_bar_family = generate_get_font_family_css( 'font_top_bar', 'generate_settings', generate_get_default_fonts() );
$site_title_family = generate_get_font_family_css( 'font_site_title', 'generate_settings', generate_get_default_fonts() );
$site_tagline_family = generate_get_font_family_css( 'font_site_tagline', 'generate_settings', generate_get_default_fonts() );
$navigation_family = generate_get_font_family_css( 'font_navigation', 'generate_settings', generate_get_default_fonts() );
$widget_family = generate_get_font_family_css( 'font_widget_title', 'generate_settings', generate_get_default_fonts() );
$h1_family = generate_get_font_family_css( 'font_heading_1', 'generate_settings', generate_get_default_fonts() );
$h2_family = generate_get_font_family_css( 'font_heading_2', 'generate_settings', generate_get_default_fonts() );
$h3_family = generate_get_font_family_css( 'font_heading_3', 'generate_settings', generate_get_default_fonts() );
$h4_family = generate_get_font_family_css( 'font_heading_4', 'generate_settings', generate_get_default_fonts() );
$h5_family = generate_get_font_family_css( 'font_heading_5', 'generate_settings', generate_get_default_fonts() );
$h6_family = generate_get_font_family_css( 'font_heading_6', 'generate_settings', generate_get_default_fonts() );
$footer_family = generate_get_font_family_css( 'font_footer', 'generate_settings', generate_get_default_fonts() );
$buttons_family = generate_get_font_family_css( 'font_buttons', 'generate_settings', generate_get_default_fonts() );
$css->set_selector( 'body, button, input, select, textarea' );
$css->add_property( 'font-family', $body_family );
$css->add_property( 'font-weight', esc_attr( $generate_settings['body_font_weight'] ), $og_defaults['body_font_weight'] );
$css->add_property( 'text-transform', esc_attr( $generate_settings['body_font_transform'] ), $og_defaults['body_font_transform'] );
$css->add_property( 'font-size', absint( $generate_settings['body_font_size'] ), $og_defaults['body_font_size'], 'px' );
$css->set_selector( 'body' );
$css->add_property( 'line-height', floatval( $generate_settings['body_line_height'] ), $og_defaults['body_line_height'] );
$css->set_selector( 'p' );
$css->add_property( 'margin-bottom', floatval( $generate_settings['paragraph_margin'] ), $og_defaults['paragraph_margin'], 'em' );
$css->set_selector( '.entry-content > [class*="wp-block-"]:not(:last-child)' );
$css->add_property( 'margin-bottom', floatval( $generate_settings['paragraph_margin'] ), false, 'em' );
$css->set_selector( '.top-bar' );
$css->add_property( 'font-family', $og_defaults['font_top_bar'] !== $generate_settings['font_top_bar'] ? $top_bar_family : null );
$css->add_property( 'font-weight', esc_attr( $generate_settings['top_bar_font_weight'] ), $og_defaults['top_bar_font_weight'] );
$css->add_property( 'text-transform', esc_attr( $generate_settings['top_bar_font_transform'] ), $og_defaults['top_bar_font_transform'] );
$css->add_property( 'font-size', absint( $generate_settings['top_bar_font_size'] ), absint( $og_defaults['top_bar_font_size'] ), 'px' );
$css->set_selector( '.main-title' );
$css->add_property( 'font-family', $og_defaults['font_site_title'] !== $generate_settings['font_site_title'] ? $site_title_family : null );
$css->add_property( 'font-weight', esc_attr( $generate_settings['site_title_font_weight'] ), $og_defaults['site_title_font_weight'] );
$css->add_property( 'text-transform', esc_attr( $generate_settings['site_title_font_transform'] ), $og_defaults['site_title_font_transform'] );
$css->add_property( 'font-size', absint( $generate_settings['site_title_font_size'] ), $og_defaults['site_title_font_size'], 'px' );
$css->set_selector( '.site-description' );
$css->add_property( 'font-family', $og_defaults['font_site_tagline'] !== $generate_settings['font_site_tagline'] ? $site_tagline_family : null );
$css->add_property( 'font-weight', esc_attr( $generate_settings['site_tagline_font_weight'] ), $og_defaults['site_tagline_font_weight'] );
$css->add_property( 'text-transform', esc_attr( $generate_settings['site_tagline_font_transform'] ), $og_defaults['site_tagline_font_transform'] );
$css->add_property( 'font-size', absint( $generate_settings['site_tagline_font_size'] ), $og_defaults['site_tagline_font_size'], 'px' );
$css->set_selector( '.main-navigation a, .menu-toggle' );
$css->add_property( 'font-family', $og_defaults['font_navigation'] !== $generate_settings['font_navigation'] ? $navigation_family : null );
$css->add_property( 'font-weight', esc_attr( $generate_settings['navigation_font_weight'] ), $og_defaults['navigation_font_weight'] );
$css->add_property( 'text-transform', esc_attr( $generate_settings['navigation_font_transform'] ), $og_defaults['navigation_font_transform'] );
$css->add_property( 'font-size', absint( $generate_settings['navigation_font_size'] ), $og_defaults['navigation_font_size'], 'px' );
$css->set_selector( '.main-navigation .main-nav ul ul li a' );
$css->add_property( 'font-size', absint( $subnav_font_size ), false, 'px' );
$css->set_selector( '.widget-title' );
$css->add_property( 'font-family', $og_defaults['font_widget_title'] !== $generate_settings['font_widget_title'] ? $widget_family : null );
$css->add_property( 'font-weight', esc_attr( $generate_settings['widget_title_font_weight'] ), $og_defaults['widget_title_font_weight'] );
$css->add_property( 'text-transform', esc_attr( $generate_settings['widget_title_font_transform'] ), $og_defaults['widget_title_font_transform'] );
$css->add_property( 'font-size', absint( $generate_settings['widget_title_font_size'] ), $og_defaults['widget_title_font_size'], 'px' );
$css->add_property( 'margin-bottom', absint( $generate_settings['widget_title_separator'] ), absint( $og_defaults['widget_title_separator'] ), 'px' );
$css->set_selector( '.sidebar .widget, .footer-widgets .widget' );
$css->add_property( 'font-size', absint( $generate_settings['widget_content_font_size'] ), $og_defaults['widget_content_font_size'], 'px' );
$css->set_selector( 'button:not(.menu-toggle),html input[type="button"],input[type="reset"],input[type="submit"],.button,.button:visited,.wp-block-button .wp-block-button__link' );
$css->add_property( 'font-family', $og_defaults['font_buttons'] !== $generate_settings['font_buttons'] ? $buttons_family : null );
$css->add_property( 'font-weight', esc_attr( $generate_settings['buttons_font_weight'] ), $og_defaults['buttons_font_weight'] );
$css->add_property( 'text-transform', esc_attr( $generate_settings['buttons_font_transform'] ), $og_defaults['buttons_font_transform'] );
if ( '' !== $generate_settings['buttons_font_size'] ) {
$css->add_property( 'font-size', absint( $generate_settings['buttons_font_size'] ), $og_defaults['buttons_font_size'], 'px' );
}
$css->set_selector( 'h1' );
$css->add_property( 'font-family', $og_defaults['font_heading_1'] !== $generate_settings['font_heading_1'] ? $h1_family : null );
$css->add_property( 'font-weight', esc_attr( $generate_settings['heading_1_weight'] ), $og_defaults['heading_1_weight'] );
$css->add_property( 'text-transform', esc_attr( $generate_settings['heading_1_transform'] ), $og_defaults['heading_1_transform'] );
$css->add_property( 'font-size', absint( $generate_settings['heading_1_font_size'] ), $og_defaults['heading_1_font_size'], 'px' );
$css->add_property( 'line-height', floatval( $generate_settings['heading_1_line_height'] ), $og_defaults['heading_1_line_height'], 'em' );
$css->add_property( 'margin-bottom', floatval( $generate_settings['heading_1_margin_bottom'] ), $og_defaults['heading_1_margin_bottom'], 'px' );
$css->set_selector( 'h2' );
$css->add_property( 'font-family', $og_defaults['font_heading_2'] !== $generate_settings['font_heading_2'] ? $h2_family : null );
$css->add_property( 'font-weight', esc_attr( $generate_settings['heading_2_weight'] ), $og_defaults['heading_2_weight'] );
$css->add_property( 'text-transform', esc_attr( $generate_settings['heading_2_transform'] ), $og_defaults['heading_2_transform'] );
$css->add_property( 'font-size', absint( $generate_settings['heading_2_font_size'] ), $og_defaults['heading_2_font_size'], 'px' );
$css->add_property( 'line-height', floatval( $generate_settings['heading_2_line_height'] ), $og_defaults['heading_2_line_height'], 'em' );
$css->add_property( 'margin-bottom', floatval( $generate_settings['heading_2_margin_bottom'] ), $og_defaults['heading_2_margin_bottom'], 'px' );
$css->set_selector( 'h3' );
$css->add_property( 'font-family', $og_defaults['font_heading_3'] !== $generate_settings['font_heading_3'] ? $h3_family : null );
$css->add_property( 'font-weight', esc_attr( $generate_settings['heading_3_weight'] ), $og_defaults['heading_3_weight'] );
$css->add_property( 'text-transform', esc_attr( $generate_settings['heading_3_transform'] ), $og_defaults['heading_3_transform'] );
$css->add_property( 'font-size', absint( $generate_settings['heading_3_font_size'] ), $og_defaults['heading_3_font_size'], 'px' );
$css->add_property( 'line-height', floatval( $generate_settings['heading_3_line_height'] ), $og_defaults['heading_3_line_height'], 'em' );
$css->add_property( 'margin-bottom', floatval( $generate_settings['heading_3_margin_bottom'] ), $og_defaults['heading_3_margin_bottom'], 'px' );
$css->set_selector( 'h4' );
$css->add_property( 'font-family', $og_defaults['font_heading_4'] !== $generate_settings['font_heading_4'] ? $h4_family : null );
$css->add_property( 'font-weight', esc_attr( $generate_settings['heading_4_weight'] ), $og_defaults['heading_4_weight'] );
$css->add_property( 'text-transform', esc_attr( $generate_settings['heading_4_transform'] ), $og_defaults['heading_4_transform'] );
if ( '' !== $generate_settings['heading_4_font_size'] ) {
$css->add_property( 'font-size', absint( $generate_settings['heading_4_font_size'] ), $og_defaults['heading_4_font_size'], 'px' );
}
if ( '' !== $generate_settings['heading_4_line_height'] ) {
$css->add_property( 'line-height', floatval( $generate_settings['heading_4_line_height'] ), $og_defaults['heading_4_line_height'], 'em' );
}
$css->set_selector( 'h5' );
$css->add_property( 'font-family', $og_defaults['font_heading_5'] !== $generate_settings['font_heading_5'] ? $h5_family : null );
$css->add_property( 'font-weight', esc_attr( $generate_settings['heading_5_weight'] ), $og_defaults['heading_5_weight'] );
$css->add_property( 'text-transform', esc_attr( $generate_settings['heading_5_transform'] ), $og_defaults['heading_5_transform'] );
if ( '' !== $generate_settings['heading_5_font_size'] ) {
$css->add_property( 'font-size', absint( $generate_settings['heading_5_font_size'] ), $og_defaults['heading_5_font_size'], 'px' );
}
if ( '' !== $generate_settings['heading_5_line_height'] ) {
$css->add_property( 'line-height', floatval( $generate_settings['heading_5_line_height'] ), $og_defaults['heading_5_line_height'], 'em' );
}
$css->set_selector( 'h6' );
$css->add_property( 'font-family', $og_defaults['font_heading_6'] !== $generate_settings['font_heading_6'] ? $h6_family : null );
$css->add_property( 'font-weight', esc_attr( $generate_settings['heading_6_weight'] ), $og_defaults['heading_6_weight'] );
$css->add_property( 'text-transform', esc_attr( $generate_settings['heading_6_transform'] ), $og_defaults['heading_6_transform'] );
if ( '' !== $generate_settings['heading_6_font_size'] ) {
$css->add_property( 'font-size', absint( $generate_settings['heading_6_font_size'] ), $og_defaults['heading_6_font_size'], 'px' );
}
if ( '' !== $generate_settings['heading_6_line_height'] ) {
$css->add_property( 'line-height', floatval( $generate_settings['heading_6_line_height'] ), $og_defaults['heading_6_line_height'], 'em' );
}
$css->set_selector( '.site-info' );
$css->add_property( 'font-family', $og_defaults['font_footer'] !== $generate_settings['font_footer'] ? $footer_family : null );
$css->add_property( 'font-weight', esc_attr( $generate_settings['footer_weight'] ), $og_defaults['footer_weight'] );
$css->add_property( 'text-transform', esc_attr( $generate_settings['footer_transform'] ), $og_defaults['footer_transform'] );
$css->add_property( 'font-size', absint( $generate_settings['footer_font_size'] ), $og_defaults['footer_font_size'], 'px' );
$css->start_media_query( generate_get_media_query( 'mobile' ) );
$mobile_site_title = ( isset( $generate_settings['mobile_site_title_font_size'] ) ) ? $generate_settings['mobile_site_title_font_size'] : '30';
$css->set_selector( '.main-title' );
$css->add_property( 'font-size', absint( $mobile_site_title ), false, 'px' );
$mobile_h1 = ( isset( $generate_settings['mobile_heading_1_font_size'] ) ) ? $generate_settings['mobile_heading_1_font_size'] : '30';
$css->set_selector( 'h1' );
$css->add_property( 'font-size', absint( $mobile_h1 ), false, 'px' );
$mobile_h2 = ( isset( $generate_settings['mobile_heading_2_font_size'] ) ) ? $generate_settings['mobile_heading_2_font_size'] : '25';
$css->set_selector( 'h2' );
$css->add_property( 'font-size', absint( $mobile_h2 ), false, 'px' );
$css->stop_media_query();
do_action( 'generate_typography_css', $css );
return apply_filters( 'generate_typography_css_output', $css->css_output() );
}
}
if ( ! function_exists( 'generate_spacing_css' ) ) {
/**
* Write our dynamic CSS.
*
* @since 0.1
*/
function generate_spacing_css() {
$spacing_settings = wp_parse_args(
get_option( 'generate_spacing_settings', array() ),
generate_spacing_get_defaults()
);
$og_defaults = generate_spacing_get_defaults( false );
$sidebar_layout = generate_get_layout();
$css = new GeneratePress_CSS;
$css->set_selector( '.inside-top-bar' );
$css->add_property( 'padding', generate_padding_css( $spacing_settings['top_bar_top'], $spacing_settings['top_bar_right'], $spacing_settings['top_bar_bottom'], $spacing_settings['top_bar_left'] ), generate_padding_css( $og_defaults['top_bar_top'], $og_defaults['top_bar_right'], $og_defaults['top_bar_bottom'], $og_defaults['top_bar_left'] ) );
$css->set_selector( '.inside-header' );
$css->add_property( 'padding', generate_padding_css( $spacing_settings['header_top'], $spacing_settings['header_right'], $spacing_settings['header_bottom'], $spacing_settings['header_left'] ), generate_padding_css( $og_defaults['header_top'], $og_defaults['header_right'], $og_defaults['header_bottom'], $og_defaults['header_left'] ) );
$css->set_selector( '.separate-containers .inside-article, .separate-containers .comments-area, .separate-containers .page-header, .separate-containers .paging-navigation, .one-container .site-content, .inside-page-header, .wp-block-group__inner-container' );
$css->add_property( 'padding', generate_padding_css( $spacing_settings['content_top'], $spacing_settings['content_right'], $spacing_settings['content_bottom'], $spacing_settings['content_left'] ), generate_padding_css( $og_defaults['content_top'], $og_defaults['content_right'], $og_defaults['content_bottom'], $og_defaults['content_left'] ) );
$content_padding = absint( $spacing_settings['content_right'] ) + absint( $spacing_settings['content_left'] );
$css->set_selector( '.entry-content .alignwide, body:not(.no-sidebar) .entry-content .alignfull' );
$css->add_property( 'margin-left', '-' . absint( $spacing_settings['content_left'] ) . 'px' );
$css->add_property( 'width', 'calc(100% + ' . absint( $content_padding ) . 'px)' );
$css->add_property( 'max-width', 'calc(100% + ' . absint( $content_padding ) . 'px)' );
if ( 'text' === generate_get_option( 'container_alignment' ) ) {
$css->set_selector( '.container.grid-container' );
$css->add_property( 'max-width', generate_get_option( 'container_width' ) + $content_padding, false, 'px' );
}
$css->set_selector( '.one-container.right-sidebar .site-main,.one-container.both-right .site-main' );
$css->add_property( 'margin-right', absint( $spacing_settings['content_right'] ), absint( $og_defaults['content_right'] ), 'px' );
$css->set_selector( '.one-container.left-sidebar .site-main,.one-container.both-left .site-main' );
$css->add_property( 'margin-left', absint( $spacing_settings['content_left'] ), absint( $og_defaults['content_left'] ), 'px' );
$css->set_selector( '.one-container.both-sidebars .site-main' );
$css->add_property( 'margin', generate_padding_css( '0', $spacing_settings['content_right'], '0', $spacing_settings['content_left'] ), generate_padding_css( '0', $og_defaults['content_right'], '0', $og_defaults['content_left'] ) );
$css->set_selector( '.separate-containers .widget, .separate-containers .site-main > *, .separate-containers .page-header, .widget-area .main-navigation' );
$css->add_property( 'margin-bottom', absint( $spacing_settings['separator'] ), absint( $og_defaults['separator'] ), 'px' );
$css->set_selector( '.separate-containers .site-main' );
$css->add_property( 'margin', absint( $spacing_settings['separator'] ), $og_defaults['separator'], 'px' );
$css->set_selector( '.both-right.separate-containers .inside-left-sidebar' );
$css->add_property( 'margin-right', absint( $spacing_settings['separator'] / 2 ), absint( $og_defaults['separator'] / 2 ), 'px' );
$css->set_selector( '.both-right.separate-containers .inside-right-sidebar' );
$css->add_property( 'margin-left', absint( $spacing_settings['separator'] / 2 ), absint( $og_defaults['separator'] / 2 ), 'px' );
$css->set_selector( '.both-left.separate-containers .inside-left-sidebar' );
$css->add_property( 'margin-right', absint( $spacing_settings['separator'] / 2 ), absint( $og_defaults['separator'] / 2 ), 'px' );
$css->set_selector( '.both-left.separate-containers .inside-right-sidebar' );
$css->add_property( 'margin-left', absint( $spacing_settings['separator'] / 2 ), absint( $og_defaults['separator'] / 2 ), 'px' );
$css->set_selector( '.separate-containers .page-header-image, .separate-containers .page-header-contained, .separate-containers .page-header-image-single, .separate-containers .page-header-content-single' );
$css->add_property( 'margin-top', absint( $spacing_settings['separator'] ), absint( $og_defaults['separator'] ), 'px' );
$css->set_selector( '.separate-containers .inside-right-sidebar, .separate-containers .inside-left-sidebar' );
$css->add_property( 'margin-top', absint( $spacing_settings['separator'] ), absint( $og_defaults['separator'] ), 'px' );
$css->add_property( 'margin-bottom', absint( $spacing_settings['separator'] ), absint( $og_defaults['separator'] ), 'px' );
$css->set_selector( '.main-navigation .main-nav ul li a,.menu-toggle,.main-navigation .mobile-bar-items a' );
$css->add_property( 'padding-left', absint( $spacing_settings['menu_item'] ), absint( $og_defaults['menu_item'] ), 'px' );
$css->add_property( 'padding-right', absint( $spacing_settings['menu_item'] ), absint( $og_defaults['menu_item'] ), 'px' );
$css->add_property( 'line-height', absint( $spacing_settings['menu_item_height'] ), absint( $og_defaults['menu_item_height'] ), 'px' );
$css->set_selector( '.main-navigation .main-nav ul ul li a' );
$css->add_property( 'padding', generate_padding_css( $spacing_settings['sub_menu_item_height'], $spacing_settings['menu_item'], $spacing_settings['sub_menu_item_height'], $spacing_settings['menu_item'] ), generate_padding_css( $og_defaults['sub_menu_item_height'], $og_defaults['menu_item'], $og_defaults['sub_menu_item_height'], $og_defaults['menu_item'] ) );
$css->set_selector( '.main-navigation ul ul' );
$css->add_property( 'width', absint( $spacing_settings['sub_menu_width'] ), absint( $og_defaults['sub_menu_width'] ), 'px' );
$css->set_selector( '.navigation-search input' );
$css->add_property( 'height', absint( $spacing_settings['menu_item_height'] ), absint( $og_defaults['menu_item_height'] ), 'px' );
$css->set_selector( '.rtl .menu-item-has-children .dropdown-menu-toggle' );
$css->add_property( 'padding-left', absint( $spacing_settings['menu_item'] ), false, 'px' );
$css->set_selector( '.menu-item-has-children .dropdown-menu-toggle' );
$css->add_property( 'padding-right', absint( $spacing_settings['menu_item'] ), absint( $og_defaults['menu_item'] ), 'px' );
$css->set_selector( '.menu-item-has-children ul .dropdown-menu-toggle' );
$css->add_property( 'padding-top', absint( $spacing_settings['sub_menu_item_height'] ), absint( $og_defaults['sub_menu_item_height'] ), 'px' );
$css->add_property( 'padding-bottom', absint( $spacing_settings['sub_menu_item_height'] ), absint( $og_defaults['sub_menu_item_height'] ), 'px' );
$css->add_property( 'margin-top', '-' . absint( $spacing_settings['sub_menu_item_height'] ), '-' . absint( $og_defaults['sub_menu_item_height'] ), 'px' );
$css->set_selector( '.rtl .main-navigation .main-nav ul li.menu-item-has-children > a' );
$css->add_property( 'padding-right', absint( $spacing_settings['menu_item'] ), false, 'px' );
$css->set_selector( '.widget-area .widget' );
$css->add_property( 'padding', generate_padding_css( $spacing_settings['widget_top'], $spacing_settings['widget_right'], $spacing_settings['widget_bottom'], $spacing_settings['widget_left'] ), generate_padding_css( $og_defaults['widget_top'], $og_defaults['widget_right'], $og_defaults['widget_bottom'], $og_defaults['widget_left'] ) );
$css->set_selector( '.footer-widgets' );
$css->add_property( 'padding', generate_padding_css( $spacing_settings['footer_widget_container_top'], $spacing_settings['footer_widget_container_right'], $spacing_settings['footer_widget_container_bottom'], $spacing_settings['footer_widget_container_left'] ), generate_padding_css( $og_defaults['footer_widget_container_top'], $og_defaults['footer_widget_container_right'], $og_defaults['footer_widget_container_bottom'], $og_defaults['footer_widget_container_left'] ) );
$css->set_selector( '.site-footer .footer-widgets-container .inner-padding' );
$css->add_property( 'padding', generate_padding_css( '0', '0', '0', $spacing_settings['footer_widget_separator'] ), generate_padding_css( '0', '0', '0', $og_defaults['footer_widget_separator'] ) );
$css->set_selector( '.site-footer .footer-widgets-container .inside-footer-widgets' );
$css->add_property( 'margin-left', '-' . absint( $spacing_settings['footer_widget_separator'] ), '-' . absint( $og_defaults['footer_widget_separator'] ), 'px' );
$css->set_selector( '.site-info' );
$css->add_property( 'padding', generate_padding_css( $spacing_settings['footer_top'], $spacing_settings['footer_right'], $spacing_settings['footer_bottom'], $spacing_settings['footer_left'] ), generate_padding_css( $og_defaults['footer_top'], $og_defaults['footer_right'], $og_defaults['footer_bottom'], $og_defaults['footer_left'] ) );
$css->start_media_query( generate_get_media_query( 'mobile' ) );
$css->set_selector( '.separate-containers .inside-article, .separate-containers .comments-area, .separate-containers .page-header, .separate-containers .paging-navigation, .one-container .site-content, .inside-page-header, .wp-block-group__inner-container' );
$css->add_property( 'padding', generate_padding_css( $spacing_settings['mobile_content_top'], $spacing_settings['mobile_content_right'], $spacing_settings['mobile_content_bottom'], $spacing_settings['mobile_content_left'] ) );
$mobile_content_padding = absint( $spacing_settings['mobile_content_right'] ) + absint( $spacing_settings['mobile_content_left'] );
$css->set_selector( '.entry-content .alignwide, body:not(.no-sidebar) .entry-content .alignfull' );
$css->add_property( 'margin-left', '-' . absint( $spacing_settings['mobile_content_left'] ) . 'px' );
$css->add_property( 'width', 'calc(100% + ' . absint( $mobile_content_padding ) . 'px)' );
$css->add_property( 'max-width', 'calc(100% + ' . absint( $mobile_content_padding ) . 'px)' );
if ( '' !== $spacing_settings['mobile_separator'] ) {
$css->set_selector( '.separate-containers .widget, .separate-containers .site-main > *, .separate-containers .page-header' );
$css->add_property( 'margin-bottom', absint( $spacing_settings['mobile_separator'] ), false, 'px' );
$css->set_selector( '.separate-containers .site-main' );
$css->add_property( 'margin', absint( $spacing_settings['mobile_separator'] ), false, 'px' );
$css->set_selector( '.separate-containers .page-header-image, .separate-containers .page-header-image-single' );
$css->add_property( 'margin-top', absint( $spacing_settings['mobile_separator'] ), false, 'px' );
$css->set_selector( '.separate-containers .inside-right-sidebar, .separate-containers .inside-left-sidebar' );
$css->add_property( 'margin-top', absint( $spacing_settings['mobile_separator'] ), false, 'px' );
$css->add_property( 'margin-bottom', absint( $spacing_settings['mobile_separator'] ), false, 'px' );
}
$css->stop_media_query();
// Add spacing back where dropdown arrow should be.
// Old versions of WP don't get nice things.
if ( version_compare( $GLOBALS['wp_version'], '4.4', '<' ) ) {
$css->set_selector( '.main-navigation .main-nav ul li.menu-item-has-children>a, .secondary-navigation .main-nav ul li.menu-item-has-children>a' );
$css->add_property( 'padding-right', absint( $spacing_settings['menu_item'] ), absint( $og_defaults['menu_item'] ), 'px' );
}
$output = '';
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_color_defaults()
);
// Find out if the content background color and sidebar widget background color is the same.
$sidebar = strtoupper( $generate_settings['sidebar_widget_background_color'] );
$content = strtoupper( $generate_settings['content_background_color'] );
$colors_match = ( ( $sidebar == $content ) || '' == $sidebar ) ? true : false;
// If they're all 40 (default), remove the padding when one container is set.
// This way, the user can still adjust the padding and it will work (unless they want 40px padding).
// We'll also remove the padding if there's no color difference between the widgets and content background color.
if ( ( '40' == $spacing_settings['widget_top'] && '40' == $spacing_settings['widget_right'] && '40' == $spacing_settings['widget_bottom'] && '40' == $spacing_settings['widget_left'] ) && $colors_match ) {
$output .= '.one-container .sidebar .widget{padding:0px;}';
}
do_action( 'generate_spacing_css', $css );
return apply_filters( 'generate_spacing_css_output', $css->css_output() . $output );
}
}
/**
* Generates any CSS that can't be cached (can change from page to page).
*
* @since 2.0
*/
function generate_no_cache_dynamic_css() {
$css = new GeneratePress_CSS;
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', '0px' );
}
}
}
$css->start_media_query( generate_get_media_query( 'mobile-menu' ) );
$css->set_selector( '.main-navigation .menu-toggle,.main-navigation .mobile-bar-items,.sidebar-nav-mobile:not(#sticky-placeholder)' );
$css->add_property( 'display', 'block' );
$css->set_selector( '.main-navigation ul,.gen-sidebar-nav' );
$css->add_property( 'display', 'none' );
$css->set_selector( '[class*="nav-float-"] .site-header .inside-header > *' );
$css->add_property( 'float', 'none' );
$css->add_property( 'clear', 'both' );
$css->stop_media_query();
return $css->css_output();
}
add_action( 'wp_enqueue_scripts', 'generate_enqueue_dynamic_css', 50 );
/**
* Enqueue our dynamic CSS.
*
* @since 2.0
*/
function generate_enqueue_dynamic_css() {
if ( ! get_option( 'generate_dynamic_css_output', false ) || is_customize_preview() || apply_filters( 'generate_dynamic_css_skip_cache', false ) ) {
$css = generate_base_css() . generate_font_css() . generate_advanced_css() . generate_spacing_css();
} else {
$css = get_option( 'generate_dynamic_css_output' ) . '/* End cached CSS */';
}
$css = $css . generate_no_cache_dynamic_css() . generate_do_icon_css();
wp_add_inline_style( 'generate-style', $css );
}
add_action( 'init', 'generate_set_dynamic_css_cache' );
/**
* Sets our dynamic CSS cache if it doesn't exist.
*
* If the theme version changed, bust the cache.
*
* @since 2.0
*/
function generate_set_dynamic_css_cache() {
if ( apply_filters( 'generate_dynamic_css_skip_cache', false ) ) {
return;
}
$cached_css = get_option( 'generate_dynamic_css_output', false );
$cached_version = get_option( 'generate_dynamic_css_cached_version', '' );
if ( ! $cached_css || $cached_version !== GENERATE_VERSION ) {
$css = generate_base_css() . generate_font_css() . generate_advanced_css() . generate_spacing_css();
update_option( 'generate_dynamic_css_output', $css );
update_option( 'generate_dynamic_css_cached_version', GENERATE_VERSION );
}
}
add_action( 'customize_save_after', 'generate_update_dynamic_css_cache' );
/**
* Update our CSS cache when done saving Customizer options.
*
* @since 2.0
*/
function generate_update_dynamic_css_cache() {
if ( apply_filters( 'generate_dynamic_css_skip_cache', false ) ) {
return;
}
$css = generate_base_css() . generate_font_css() . generate_advanced_css() . generate_spacing_css();
update_option( 'generate_dynamic_css_output', $css );
}
/**
* Output CSS for the icon fonts.
*
* @since 2.3
*/
function generate_do_icon_css() {
$output = false;
if ( 'font' === generate_get_option( 'icons' ) ) {
$url = trailingslashit( get_template_directory_uri() );
$output = '@font-face {
font-family: "GeneratePress";
src: url("' . $url . 'fonts/generatepress.eot");
src: url("' . $url . 'fonts/generatepress.eot#iefix") format("embedded-opentype"),
url("' . $url . 'fonts/generatepress.woff2") format("woff2"),
url("' . $url . 'fonts/generatepress.woff") format("woff"),
url("' . $url . 'fonts/generatepress.ttf") format("truetype"),
url("' . $url . 'fonts/generatepress.svg#GeneratePress") format("svg");
font-weight: normal;
font-style: normal;
}';
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 ( 'svg' === generate_get_option( 'icons' ) ) {
$output = 'button.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 {
display: none;
}';
}
if ( $output ) {
return str_replace( array( "\r", "\n", "\t" ), '', $output );
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,230 @@
<?php
/**
* Where old Customizer controls retire.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
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 {
public function render_content() {}
}
}
if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'GenerateLabelControl' ) ) {
/**
* Heading area
* @since 0.1
* @depreceted 1.3.41
**/
class GenerateLabelControl extends WP_Customize_Control {
public function render_content() {}
}
}
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 {
public $type = 'gp-customizer-fonts';
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' ) ) );
}
public function to_json() {
parent::to_json();
$number_of_fonts = apply_filters( 'generate_number_of_fonts', 200 );
$this->json['link'] = $this->get_link();
$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['google_fonts'] = apply_filters( 'generate_typography_customize_list', generate_get_all_google_fonts( $number_of_fonts ) );
$this->json['default_fonts'] = generate_typography_default_fonts();
}
public function content_template() {
?>
<label>
<span class="customize-control-title">{{ data.label }}</span>
<select {{{ data.link }}}>
<optgroup label="{{ data.default_fonts_title }}">
<# for ( var key in data.default_fonts ) { #>
<# var name = data.default_fonts[ key ].split(',')[0]; #>
<option value="{{ data.default_fonts[ key ] }}" <# if ( data.default_fonts[ key ] === data.value ) { #>selected="selected"<# } #>>{{ name }}</option>
<# } #>
</optgroup>
<optgroup label="{{ data.google_fonts_title }}">
<# for ( var key in data.google_fonts ) { #>
<option value="{{ data.google_fonts[ key ].name }}" <# if ( data.google_fonts[ key ].name === data.value ) { #>selected="selected"<# } #>>{{ data.google_fonts[ key ].name }}</option>
<# } #>
</optgroup>
</select>
<p class="description">{{ data.description }}</p>
</label>
<?php
}
}
}
if ( ! class_exists( 'Generate_Select_Control' ) ) {
/**
* A class to create a dropdown for font weight
*/
class Generate_Select_Control extends WP_Customize_Control {
public $type = 'gp-typography-select';
public $choices = array();
public function to_json() {
parent::to_json();
foreach ( $this->choices as $name => $choice ) {
$this->choices[ $name ] = $choice;
}
$this->json['choices'] = $this->choices;
$this->json['link'] = $this->get_link();
$this->json['value'] = $this->value();
}
public function content_template() {
?>
<# if ( ! data.choices )
return;
#>
<label>
<select {{{ data.link }}}>
<# jQuery.each( data.choices, function( label, choice ) { #>
<option value="{{ choice }}" <# if ( choice === data.value ) { #> selected="selected"<# } #>>{{ choice }}</option>
<# } ) #>
</select>
<# if ( data.label ) { #>
<p class="description">{{ data.label }}</p>
<# } #>
</label>
<?php
}
}
}
if ( ! class_exists( 'Generate_Hidden_Input_Control' ) ) {
/**
* Create our hidden input control
*/
class Generate_Hidden_Input_Control extends WP_Customize_Control {
// Setup control type
public $type = 'gp-hidden-input';
public $id = '';
public function to_json() {
parent::to_json();
$this->json['link'] = $this->get_link();
$this->json['value'] = $this->value();
$this->json['id'] = $this->id;
}
public function content_template() {
?>
<input name="{{ data.id }}" type="text" {{{ data.link }}} value="{{{ data.value }}}" class="gp-hidden-input" />
<?php
}
}
}
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 );
}
/**
* 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>', '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
}
}
}
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 {
public function render_content() {}
}
}

View File

@ -0,0 +1,180 @@
<?php
/**
* The range slider Customizer control.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Range_Slider_Control' ) ) {
/**
* Create a range slider control.
* This control allows you to add responsive settings.
*
* @since 1.3.47
*/
class Generate_Range_Slider_Control extends WP_Customize_Control {
/**
* The control type.
*
* @access public
* @var string
*/
public $type = 'generatepress-range-slider';
public $description = '';
public $sub_description = '';
/**
* Refresh the parameters passed to the JavaScript via JSON.
*
* @see WP_Customize_Control::to_json()
*/
public function to_json() {
parent::to_json();
$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';
$this->json['choices'][ $device ]['step'] = ( isset( $this->choices[ $device ]['step'] ) ) ? $this->choices[ $device ]['step'] : '1';
$this->json['choices'][ $device ]['edit'] = ( isset( $this->choices[ $device ]['edit'] ) ) ? $this->choices[ $device ]['edit'] : false;
$this->json['choices'][ $device ]['unit'] = ( isset( $this->choices[ $device ]['unit'] ) ) ? $this->choices[ $device ]['unit'] : false;
}
foreach ( $this->settings as $setting_key => $setting_id ) {
$this->json[ $setting_key ] = array(
'link' => $this->get_link( $setting_key ),
'value' => $this->value( $setting_key ),
'default' => isset( $setting_id->default ) ? $setting_id->default : '',
);
}
$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;
}
/**
* Enqueue control related scripts/styles.
*
* @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 );
}
/**
* An Underscore (JS) template for this control's content (but not its container).
*
* Class variables for this control class are available in the `data` JS object;
* export custom variables by overriding {@see WP_Customize_Control::to_json()}.
*
* @see WP_Customize_Control::print_template()
*
* @access protected
*/
protected function content_template() {
?>
<div class="generatepress-range-slider-control">
<div class="gp-range-title-area">
<# if ( data.label || data.description ) { #>
<div class="gp-range-title-info">
<# if ( data.label ) { #>
<span class="customize-control-title">{{{ data.label }}}</span>
<# } #>
<# if ( data.description ) { #>
<p class="description">{{{ data.description }}}</p>
<# } #>
</div>
<# } #>
<div class="gp-range-slider-controls">
<span class="gp-device-controls">
<# if ( 'undefined' !== typeof ( data.desktop ) ) { #>
<span class="generatepress-device-desktop dashicons dashicons-desktop" data-option="desktop" title="{{ data.desktop_label }}"></span>
<# } #>
<# if ( 'undefined' !== typeof (data.tablet) ) { #>
<span class="generatepress-device-tablet dashicons dashicons-tablet" data-option="tablet" title="{{ data.tablet_label }}"></span>
<# } #>
<# if ( 'undefined' !== typeof (data.mobile) ) { #>
<span class="generatepress-device-mobile dashicons dashicons-smartphone" data-option="mobile" title="{{ data.mobile_label }}"></span>
<# } #>
</span>
<span title="{{ data.reset_label }}" class="generatepress-reset dashicons dashicons-image-rotate"></span>
</div>
</div>
<div class="gp-range-slider-areas">
<# if ( 'undefined' !== typeof ( data.desktop ) ) { #>
<label class="range-option-area" data-option="desktop" style="display: none;">
<div class="wrapper <# if ( '' !== data.choices['desktop']['unit'] ) { #>has-unit<# } #>">
<div class="generatepress-slider" data-step="{{ data.choices['desktop']['step'] }}" data-min="{{ data.choices['desktop']['min'] }}" data-max="{{ data.choices['desktop']['max'] }}"></div>
<div class="gp_range_value <# if ( '' == data.choices['desktop']['unit'] && ! data.choices['desktop']['edit'] ) { #>hide-value<# } #>">
<input <# if ( data.choices['desktop']['edit'] ) { #>style="display:inline-block;"<# } else { #>style="display:none;"<# } #> type="number" step="{{ data.choices['desktop']['step'] }}" class="desktop-range value" value="{{ data.desktop.value }}" min="{{ data.choices['desktop']['min'] }}" max="{{ data.choices['desktop']['max'] }}" {{{ data.desktop.link }}} data-reset_value="{{ data.desktop.default }}" />
<span <# if ( ! data.choices['desktop']['edit'] ) { #>style="display:inline-block;"<# } else { #>style="display:none;"<# } #> class="value">{{ data.desktop.value }}</span>
<# if ( data.choices['desktop']['unit'] ) { #>
<span class="unit">{{ data.choices['desktop']['unit'] }}</span>
<# } #>
</div>
</div>
</label>
<# } #>
<# if ( 'undefined' !== typeof ( data.tablet ) ) { #>
<label class="range-option-area" data-option="tablet" style="display:none">
<div class="wrapper <# if ( '' !== data.choices['tablet']['unit'] ) { #>has-unit<# } #>">
<div class="generatepress-slider" data-step="{{ data.choices['tablet']['step'] }}" data-min="{{ data.choices['tablet']['min'] }}" data-max="{{ data.choices['tablet']['max'] }}"></div>
<div class="gp_range_value <# if ( '' == data.choices['tablet']['unit'] && ! data.choices['desktop']['edit'] ) { #>hide-value<# } #>">
<input <# if ( data.choices['tablet']['edit'] ) { #>style="display:inline-block;"<# } else { #>style="display:none;"<# } #> type="number" step="{{ data.choices['tablet']['step'] }}" class="tablet-range value" value="{{ data.tablet.value }}" min="{{ data.choices['tablet']['min'] }}" max="{{ data.choices['tablet']['max'] }}" {{{ data.tablet.link }}} data-reset_value="{{ data.tablet.default }}" />
<span <# if ( ! data.choices['tablet']['edit'] ) { #>style="display:inline-block;"<# } else { #>style="display:none;"<# } #> class="value">{{ data.tablet.value }}</span>
<# if ( data.choices['tablet']['unit'] ) { #>
<span class="unit">{{ data.choices['tablet']['unit'] }}</span>
<# } #>
</div>
</div>
</label>
<# } #>
<# if ( 'undefined' !== typeof ( data.mobile ) ) { #>
<label class="range-option-area" data-option="mobile" style="display:none;">
<div class="wrapper <# if ( '' !== data.choices['mobile']['unit'] ) { #>has-unit<# } #>">
<div class="generatepress-slider" data-step="{{ data.choices['mobile']['step'] }}" data-min="{{ data.choices['mobile']['min'] }}" data-max="{{ data.choices['mobile']['max'] }}"></div>
<div class="gp_range_value <# if ( '' == data.choices['mobile']['unit'] && ! data.choices['desktop']['edit'] ) { #>hide-value<# } #>">
<input <# if ( data.choices['mobile']['edit'] ) { #>style="display:inline-block;"<# } else { #>style="display:none;"<# } #> type="number" step="{{ data.choices['mobile']['step'] }}" class="mobile-range value" value="{{ data.mobile.value }}" min="{{ data.choices['mobile']['min'] }}" max="{{ data.choices['mobile']['max'] }}" {{{ data.mobile.link }}} data-reset_value="{{ data.mobile.default }}" />
<span <# if ( ! data.choices['mobile']['edit'] ) { #>style="display:inline-block;"<# } else { #>style="display:none;"<# } #> class="value">{{ data.mobile.value }}</span>
<# if ( data.choices['mobile']['unit'] ) { #>
<span class="unit">{{ data.choices['mobile']['unit'] }}</span>
<# } #>
</div>
</div>
</label>
<# } #>
</div>
<# if ( data.sub_description ) { #>
<p class="description sub-description">{{{ data.sub_description }}}</p>
<# } #>
</div>
<?php
}
}
}

View File

@ -0,0 +1,193 @@
<?php
/**
* The typography Customizer control.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Typography_Customize_Control' ) ) {
/**
* Create the typography elements control.
*
* @since 2.0
*/
class Generate_Typography_Customize_Control extends WP_Customize_Control {
public $type = 'gp-customizer-typography';
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-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 );
}
public function to_json() {
parent::to_json();
$this->json['default_fonts_title'] = __( 'System fonts', 'generatepress' );
$this->json['google_fonts_title'] = __( 'Google fonts', 'generatepress' );
$this->json['default_fonts'] = generate_typography_default_fonts();
$this->json['family_title'] = esc_html__( 'Font family', 'generatepress' );
$this->json['weight_title'] = esc_html__( 'Font weight', 'generatepress' );
$this->json['transform_title'] = esc_html__( 'Text transform', 'generatepress' );
$this->json['category_title'] = '';
$this->json['variant_title'] = esc_html__( 'Variants', 'generatepress' );
foreach ( $this->settings as $setting_key => $setting_id ) {
$this->json[ $setting_key ] = array(
'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 : ''
);
if ( 'weight' === $setting_key ) {
$this->json[ $setting_key ]['choices'] = $this->get_font_weight_choices();
}
if ( 'transform' === $setting_key ) {
$this->json[ $setting_key ]['choices'] = $this->get_font_transform_choices();
}
}
}
public function content_template() {
?>
<# if ( '' !== data.label ) { #>
<span class="customize-control-title">{{ data.label }}</span>
<# } #>
<# if ( 'undefined' !== typeof ( data.family ) ) { #>
<div class="generatepress-font-family">
<label>
<select {{{ data.family.link }}} data-category="{{{ data.category.id }}}" data-variants="{{{ data.variant.id }}}" style="width:100%;">
<optgroup label="{{ data.default_fonts_title }}">
<# for ( var key in data.default_fonts ) { #>
<# var name = data.default_fonts[ key ].split(',')[0]; #>
<option value="{{ data.default_fonts[ key ] }}" <# if ( data.default_fonts[ key ] === data.family.value ) { #>selected="selected"<# } #>>{{ name }}</option>
<# } #>
</optgroup>
<optgroup label="{{ data.google_fonts_title }}">
<# for ( var key in generatePressTypography.googleFonts ) { #>
<option value="{{ generatePressTypography.googleFonts[ key ].name }}" <# if ( generatePressTypography.googleFonts[ key ].name === data.family.value ) { #>selected="selected"<# } #>>{{ generatePressTypography.googleFonts[ key ].name }}</option>
<# } #>
</optgroup>
</select>
<# if ( '' !== data.family_title ) { #>
<p class="description">{{ data.family_title }}</p>
<# } #>
</label>
</div>
<# } #>
<# if ( 'undefined' !== typeof ( data.variant ) ) { #>
<#
var id = data.family.value.split(' ').join('_').toLowerCase();
var font_data = generatePressTypography.googleFonts[id];
var variants = '';
if ( typeof font_data !== 'undefined' ) {
variants = font_data.variants;
}
if ( null === data.variant.value ) {
data.variant.value = data.variant.default;
}
#>
<div id={{{ data.variant.id }}}" class="generatepress-font-variant" data-saved-value="{{ data.variant.value }}">
<label>
<select name="{{{ data.variant.id }}}" multiple class="typography-multi-select" style="width:100%;" {{{ data.variant.link }}}>
<# _.each( variants, function( label, choice ) { #>
<option value="{{ label }}">{{ label }}</option>
<# } ) #>
</select>
<# if ( '' !== data.variant_title ) { #>
<p class="description">{{ data.variant_title }}</p>
<# } #>
</label>
</div>
<# } #>
<# if ( 'undefined' !== typeof ( data.category ) ) { #>
<div class="generatepress-font-category">
<label>
<input name="{{{ data.category.id }}}" type="hidden" {{{ data.category.link }}} value="{{{ data.category.value }}}" class="gp-hidden-input" />
<# if ( '' !== data.category_title ) { #>
<p class="description">{{ data.category_title }}</p>
<# } #>
</label>
</div>
<# } #>
<div class="generatepress-weight-transform-wrapper">
<# if ( 'undefined' !== typeof ( data.weight ) ) { #>
<div class="generatepress-font-weight">
<label>
<select {{{ data.weight.link }}}>
<# _.each( data.weight.choices, function( label, choice ) { #>
<option value="{{ choice }}" <# if ( choice === data.weight.value ) { #> selected="selected" <# } #>>{{ label }}</option>
<# } ) #>
</select>
<# if ( '' !== data.weight_title ) { #>
<p class="description">{{ data.weight_title }}</p>
<# } #>
</label>
</div>
<# } #>
<# if ( 'undefined' !== typeof ( data.transform ) ) { #>
<div class="generatepress-font-transform">
<label>
<select {{{ data.transform.link }}}>
<# _.each( data.transform.choices, function( label, choice ) { #>
<option value="{{ choice }}" <# if ( choice === data.transform.value ) { #> selected="selected" <# } #>>{{ label }}</option>
<# } ) #>
</select>
<# if ( '' !== data.transform_title ) { #>
<p class="description">{{ data.transform_title }}</p>
<# } #>
</label>
</div>
<# } #>
</div>
<?php
}
public function get_font_weight_choices() {
return array(
'normal' => esc_html( 'normal' ),
'bold' => esc_html( 'bold' ),
'100' => esc_html( '100' ),
'200' => esc_html( '200' ),
'300' => esc_html( '300' ),
'400' => esc_html( '400' ),
'500' => esc_html( '500' ),
'600' => esc_html( '600' ),
'700' => esc_html( '700' ),
'800' => esc_html( '800' ),
'900' => esc_html( '900' ),
);
}
public function get_font_transform_choices() {
return array(
'none' => esc_html( 'none' ),
'capitalize' => esc_html( 'capitalize' ),
'uppercase' => esc_html( 'uppercase' ),
'lowercase' => esc_html( 'lowercase' ),
);
}
}
}

View File

@ -0,0 +1,43 @@
<?php
/**
* The upsell Customizer controll.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Customize_Misc_Control' ) ) {
/**
* Create our in-section upsell controls.
* Escape your URL in the Customizer using esc_url().
*
* @since 0.1
*/
class Generate_Customize_Misc_Control extends WP_Customize_Control {
public $description = '';
public $url = '';
public $type = 'addon';
public $label = '';
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 );
}
public function to_json() {
parent::to_json();
$this->json['url'] = esc_url( $this->url );
}
public function content_template() {
?>
<p class="description" style="margin-top: 5px;">{{{ data.description }}}</p>
<span class="get-addon">
<a href="{{{ data.url }}}" class="button button-primary" target="_blank">{{ data.label }}</a>
</span>
<?php
}
}
}

View File

@ -0,0 +1,54 @@
<?php
/**
* The upsell Customizer section.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( class_exists( 'WP_Customize_Section' ) && ! class_exists( 'GeneratePress_Upsell_Section' ) ) {
/**
* Create our upsell section.
* Escape your URL in the Customizer using esc_url().
*
* @since unknown
*/
class GeneratePress_Upsell_Section extends WP_Customize_Section {
public $type = 'gp-upsell-section';
public $pro_url = '';
public $pro_text = '';
public $id = '';
public function json() {
$json = parent::json();
$json['pro_text'] = $this->pro_text;
$json['pro_url'] = esc_url( $this->pro_url );
$json['id'] = $this->id;
return $json;
}
protected function render_template() {
?>
<li id="accordion-section-{{ data.id }}" class="generate-upsell-accordion-section control-section-{{ data.type }} cannot-expand accordion-section">
<h3><a href="{{{ data.pro_url }}}" target="_blank">{{ data.pro_text }}</a></h3>
</li>
<?php
}
}
}
if ( ! function_exists( 'generate_customizer_controls_css' ) ) {
add_action( 'customize_controls_enqueue_scripts', 'generate_customizer_controls_css' );
/**
* Add CSS for our controls
*
* @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 );
}
}

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

@ -0,0 +1,54 @@
.customize-control-addon:before {
content: "";
height: 1px;
width: 50px;
background: rgba(0,0,0,.10);
display: block;
margin-bottom: 10px;
}
.customize-control-addon {
margin-top: 10px;
}
li#accordion-section-generatepress_upsell_section {
border-top: 1px solid #D54E21;
border-bottom: 1px solid #D54E21;
}
.generate-upsell-accordion-section a {
background: #FFF;
display: block;
padding: 10px 10px 11px 14px;
line-height: 21px;
color: #D54E21;
text-decoration: none;
}
.generate-upsell-accordion-section a:hover {
background:#FAFAFA;
}
.generate-upsell-accordion-section h3 {
margin: 0;
position: relative;
}
.generate-upsell-accordion-section h3 a:after {
content: "\f345";
color: #D54E21;
position: absolute;
top: 11px;
right: 10px;
z-index: 1;
float: right;
border: none;
background: none;
font: normal 20px/1 dashicons;
speak: none;
display: block;
padding: 0;
text-indent: 0;
text-align: center;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

View File

@ -0,0 +1,338 @@
( function( api ) {
'use strict';
// Add callback for when the header_textcolor setting exists.
api( 'generate_settings[nav_position_setting]', function( setting ) {
var isNavFloated, linkSettingValueToControlActiveState;
/**
* Determine whether the navigation is floating.
*
* @returns {boolean} Is floating?
*/
isNavFloated = function() {
if ( 'nav-float-right' === setting.get() || 'nav-float-left' === setting.get() ) {
return true;
}
return false;
};
/**
* Update a control's active state according to the navigation location setting's value.
*
* @param {wp.customize.Control} control
*/
linkSettingValueToControlActiveState = function( control ) {
var setActiveState = function() {
control.active.set( isNavFloated() );
};
// FYI: With the following we can eliminate all of our PHP active_callback code.
control.active.validate = isNavFloated;
// Set initial active state.
setActiveState();
/*
* Update activate state whenever the setting is changed.
* Even when the setting does have a refresh transport where the
* server-side active callback will manage the active state upon
* refresh, having this JS management of the active state will
* ensure that controls will have their visibility toggled
* immediately instead of waiting for the preview to load.
* This is especially important if the setting has a postMessage
* transport where changing the setting wouldn't normally cause
* the preview to refresh and thus the server-side active_callbacks
* would not get invoked.
*/
setting.bind( setActiveState );
};
// Call linkSettingValueToControlActiveState on the navigation dropdown point.
api.control( 'generate_settings[nav_drop_point]', linkSettingValueToControlActiveState );
} );
var setOption = function( headerAlignment, navLocation, navAlignment ) {
if ( headerAlignment ) {
api.control( 'generate_settings[header_alignment_setting]' ).setting.set( headerAlignment );
}
if ( navLocation ) {
api.control( 'generate_settings[nav_position_setting]' ).setting.set( navLocation );
}
if ( navAlignment ) {
api.control( 'generate_settings[nav_alignment_setting]' ).setting.set( navAlignment );
}
};
api( 'generate_header_helper', function( value ) {
var headerAlignment = false,
navLocation = false,
navAlignment = 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;
if ( ! headerAlignmentSetting._dirty ) {
headerAlignment = headerAlignmentSetting.get();
}
if ( ! navLocationSetting._dirty ) {
navLocation = navLocationSetting.get();
}
if ( ! navAlignmentSetting._dirty ) {
navAlignment = navAlignmentSetting.get();
}
if ( 'current' === newval ) {
setOption( headerAlignment, navLocation, navAlignment );
}
if ( 'default' === newval ) {
setOption( generatepress_defaults.header_alignment_setting, generatepress_defaults.nav_position_setting, generatepress_defaults.nav_alignment_setting );
}
if ( 'nav-before-centered' === newval ) {
setOption( 'center', 'nav-above-header', 'center' );
}
if ( 'nav-after-centered' === newval ) {
setOption( 'center', 'nav-below-header', 'center' );
}
if ( 'nav-right' === newval ) {
setOption( 'left', 'nav-float-right', 'left' );
}
if ( 'nav-left' === newval ) {
setOption( 'right', 'nav-float-left', 'right' );
}
} );
} );
api( 'nav_color_presets', function( value ) {
var backgroundColor = false,
textColor = false,
backgroundColorHover = false,
textColorHover = false,
currentBackgroundColor = false,
currentTextColor = false,
subMenuBackgroundColor = false,
subMenuTextColor = false,
subMenuBackgroundColorHover = false,
subMenuTextColorHover = false,
subMenuCurrentBackgroundColor = false,
subMenuCurrentTextColor = false;
value.bind( function( newval ) {
var backgroundColorSetting = api.instance( 'generate_settings[navigation_background_color]' ),
textColorSetting = api.instance( 'generate_settings[navigation_text_color]' ),
backgroundColorHoverSetting = api.instance( 'generate_settings[navigation_background_hover_color]' ),
textColorHoverSetting = api.instance( 'generate_settings[navigation_text_hover_color]' ),
currentBackgroundColorSetting = api.instance( 'generate_settings[navigation_background_current_color]' ),
currentTextColorSetting = api.instance( 'generate_settings[navigation_text_current_color]' ),
subMenuBackgroundColorSetting = api.instance( 'generate_settings[subnavigation_background_color]' ),
subMenuTextColorSetting = api.instance( 'generate_settings[subnavigation_text_color]' ),
subMenuBackgroundColorHoverSetting = api.instance( 'generate_settings[subnavigation_background_hover_color]' ),
subMenuTextColorHoverSetting = api.instance( 'generate_settings[subnavigation_text_hover_color]' ),
subMenuCurrentBackgroundColorSetting = api.instance( 'generate_settings[subnavigation_background_current_color]' ),
subMenuCurrentTextColorSetting = api.instance( 'generate_settings[subnavigation_text_current_color]' );
if ( ! backgroundColorSetting._dirty ) {
backgroundColor = backgroundColorSetting.get();
}
if ( ! textColorSetting._dirty ) {
textColor = textColorSetting.get();
}
if ( ! backgroundColorHoverSetting._dirty ) {
backgroundColorHover = backgroundColorHoverSetting.get();
}
if ( ! textColorHoverSetting._dirty ) {
textColorHover = textColorHoverSetting.get();
}
if ( ! currentBackgroundColorSetting._dirty ) {
currentBackgroundColor = currentBackgroundColorSetting.get();
}
if ( ! currentTextColorSetting._dirty ) {
currentTextColor = currentTextColorSetting.get();
}
if ( ! subMenuBackgroundColorSetting._dirty ) {
subMenuBackgroundColor = subMenuBackgroundColorSetting.get();
}
if ( ! subMenuTextColorSetting._dirty ) {
subMenuTextColor = subMenuTextColorSetting.get();
}
if ( ! subMenuBackgroundColorHoverSetting._dirty ) {
subMenuBackgroundColorHover = subMenuBackgroundColorHoverSetting.get();
}
if ( ! subMenuTextColorHoverSetting._dirty ) {
subMenuTextColorHover = subMenuTextColorHoverSetting.get();
}
if ( ! subMenuCurrentBackgroundColorSetting._dirty ) {
subMenuCurrentBackgroundColor = subMenuCurrentBackgroundColorSetting.get();
}
if ( ! subMenuCurrentTextColorSetting._dirty ) {
subMenuCurrentTextColor = subMenuCurrentTextColorSetting.get();
}
if ( 'current' === newval ) {
backgroundColorSetting.set( backgroundColor );
textColorSetting.set( textColor );
backgroundColorHoverSetting.set( backgroundColorHover );
textColorHoverSetting.set( textColorHover );
currentBackgroundColorSetting.set( currentBackgroundColor );
currentTextColorSetting.set( currentTextColorSetting );
subMenuBackgroundColorSetting.set( subMenuBackgroundColor );
subMenuTextColorSetting.set( subMenuTextColor );
subMenuBackgroundColorHoverSetting.set( subMenuBackgroundColorHover );
subMenuTextColorHoverSetting.set( subMenuTextColorHover );
subMenuCurrentBackgroundColorSetting.set( subMenuCurrentBackgroundColor );
subMenuCurrentTextColorSetting.set( subMenuCurrentTextColorSetting );
}
if ( 'default' === newval ) {
backgroundColorSetting.set( generatepress_color_defaults.navigation_background_color );
textColorSetting.set( generatepress_color_defaults.navigation_text_color );
backgroundColorHoverSetting.set( generatepress_color_defaults.navigation_background_hover_color );
textColorHoverSetting.set( generatepress_color_defaults.navigation_text_hover_color );
currentBackgroundColorSetting.set( generatepress_color_defaults.navigation_background_current_color );
currentTextColorSetting.set( generatepress_color_defaults.navigation_text_current_color );
subMenuBackgroundColorSetting.set( generatepress_color_defaults.subnavigation_background_color );
subMenuTextColorSetting.set( generatepress_color_defaults.subnavigation_text_color );
subMenuBackgroundColorHoverSetting.set( generatepress_color_defaults.subnavigation_background_hover_color );
subMenuTextColorHoverSetting.set( generatepress_color_defaults.subnavigation_text_hover_color );
subMenuCurrentBackgroundColorSetting.set( generatepress_color_defaults.subnavigation_background_current_color );
subMenuCurrentTextColorSetting.set( generatepress_color_defaults.subnavigation_text_current_color );
}
if ( 'white' === newval ) {
backgroundColorSetting.set( '#ffffff' );
textColorSetting.set( '#000000' );
backgroundColorHoverSetting.set( '#ffffff' );
textColorHoverSetting.set( '#8f919e' );
currentBackgroundColorSetting.set( '#ffffff' );
currentTextColorSetting.set( '#8f919e' );
subMenuBackgroundColorSetting.set( '#f6f9fc' );
subMenuTextColorSetting.set( '#000000' );
subMenuBackgroundColorHoverSetting.set( '#f6f9fc' );
subMenuTextColorHoverSetting.set( '#8f919e' );
subMenuCurrentBackgroundColorSetting.set( '#f6f9fc' );
subMenuCurrentTextColorSetting.set( '#8f919e' );
}
if ( 'grey' === newval ) {
backgroundColorSetting.set( '#595959' );
textColorSetting.set( '#ffffff' );
backgroundColorHoverSetting.set( '#424242' );
textColorHoverSetting.set( '#ffffff' );
currentBackgroundColorSetting.set( '#424242' );
currentTextColorSetting.set( '#ffffff' );
subMenuBackgroundColorSetting.set( '#424242' );
subMenuTextColorSetting.set( '#ffffff' );
subMenuBackgroundColorHoverSetting.set( '#424242' );
subMenuTextColorHoverSetting.set( '#dbdbdb' );
subMenuCurrentBackgroundColorSetting.set( '#424242' );
subMenuCurrentTextColorSetting.set( '#dbdbdb' );
}
if ( 'blue' === newval ) {
backgroundColorSetting.set( '#1e73be' );
textColorSetting.set( '#ffffff' );
backgroundColorHoverSetting.set( '#035a9e' );
textColorHoverSetting.set( '#ffffff' );
currentBackgroundColorSetting.set( '#035a9e' );
currentTextColorSetting.set( '#ffffff' );
subMenuBackgroundColorSetting.set( '#035a9e' );
subMenuTextColorSetting.set( '#ffffff' );
subMenuBackgroundColorHoverSetting.set( '#035a9e' );
subMenuTextColorHoverSetting.set( '#bbd2e8' );
subMenuCurrentBackgroundColorSetting.set( '#035a9e' );
subMenuCurrentTextColorSetting.set( '#bbd2e8' );
}
if ( 'red' === newval ) {
backgroundColorSetting.set( '#ed4250' );
textColorSetting.set( '#ffffff' );
backgroundColorHoverSetting.set( '#c42f2f' );
textColorHoverSetting.set( '#ffffff' );
currentBackgroundColorSetting.set( '#c42f2f' );
currentTextColorSetting.set( '#ffffff' );
subMenuBackgroundColorSetting.set( '#c42f2f' );
subMenuTextColorSetting.set( '#ffffff' );
subMenuBackgroundColorHoverSetting.set( '#c42f2f' );
subMenuTextColorHoverSetting.set( '#fcd9d6' );
subMenuCurrentBackgroundColorSetting.set( '#c42f2f' );
subMenuCurrentTextColorSetting.set( '#fcd9d6' );
}
if ( 'green' === newval ) {
backgroundColorSetting.set( '#16aa74' );
textColorSetting.set( '#ffffff' );
backgroundColorHoverSetting.set( '#119b6d' );
textColorHoverSetting.set( '#ffffff' );
currentBackgroundColorSetting.set( '#119b6d' );
currentTextColorSetting.set( '#ffffff' );
subMenuBackgroundColorSetting.set( '#119b6d' );
subMenuTextColorSetting.set( '#ffffff' );
subMenuBackgroundColorHoverSetting.set( '#119b6d' );
subMenuTextColorHoverSetting.set( '#c2e8de' );
subMenuCurrentBackgroundColorSetting.set( '#119b6d' );
subMenuCurrentTextColorSetting.set( '#c2e8de' );
}
jQuery('.wp-color-picker').wpColorPicker().change();
} );
} );
}( wp.customize ) );

View File

@ -0,0 +1,609 @@
/**
* Theme Customizer enhancements for a better user experience.
*
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
*/
function generatepress_colors_live_update( id, selector, property, default_value, get_value ) {
default_value = typeof default_value !== 'undefined' ? default_value : 'initial';
get_value = typeof get_value !== 'undefined' ? get_value : '';
wp.customize( 'generate_settings[' + id + ']', function( value ) {
value.bind( function( newval ) {
default_value = ( '' !== get_value ) ? wp.customize.value('generate_settings[' + get_value + ']')() : default_value;
newval = ( '' !== newval ) ? newval : default_value;
if ( jQuery( 'style#' + id ).length ) {
jQuery( 'style#' + id ).html( selector + '{' + property + ':' + newval + ';}' );
} else {
jQuery( 'head' ).append( '<style id="' + id + '">' + selector + '{' + property + ':' + newval + '}</style>' );
setTimeout(function() {
jQuery( 'style#' + id ).not( ':last' ).remove();
}, 1000);
}
} );
} );
}
function generatepress_classes_live_update( id, classes, selector, prefix ) {
classes = typeof classes !== 'undefined' ? classes : '';
prefix = typeof prefix !== 'undefined' ? prefix : '';
wp.customize( 'generate_settings[' + id + ']', function( value ) {
value.bind( function( newval ) {
jQuery.each( classes, function( i, v ) {
jQuery( selector ).removeClass( prefix + v );
});
jQuery( selector ).addClass( prefix + newval );
} );
} );
}
function generatepress_typography_live_update( id, selector, property, unit, media, settings ) {
settings = typeof settings !== 'undefined' ? settings : 'generate_settings';
wp.customize( settings + '[' + id + ']', function( value ) {
value.bind( function( newval ) {
// Get our unit if applicable
unit = typeof unit !== 'undefined' ? unit : '';
var isTablet = ( 'tablet' == id.substring( 0, 6 ) ) ? true : false,
isMobile = ( 'mobile' == id.substring( 0, 6 ) ) ? true : false;
if ( isTablet ) {
if ( '' == wp.customize(settings + '[' + id + ']').get() ) {
var desktopID = id.replace( 'tablet_', '' );
newval = wp.customize(settings + '[' + desktopID + ']').get();
}
}
if ( isMobile ) {
if ( '' == wp.customize(settings + '[' + id + ']').get() ) {
var desktopID = id.replace( 'mobile_', '' );
newval = wp.customize(settings + '[' + desktopID + ']').get();
}
}
if ( 'buttons_font_size' == id && '' == wp.customize('generate_settings[buttons_font_size]').get() ) {
newval = wp.customize('generate_settings[body_font_size]').get();
}
// We're using a desktop value
if ( ! isTablet && ! isMobile ) {
var tabletValue = ( typeof wp.customize(settings + '[tablet_' + id + ']') !== 'undefined' ) ? wp.customize(settings + '[tablet_' + id + ']').get() : '',
mobileValue = ( typeof wp.customize(settings + '[mobile_' + id + ']') !== 'undefined' ) ? wp.customize(settings + '[mobile_' + id + ']').get() : '';
// The tablet setting exists, mobile doesn't
if ( '' !== tabletValue && '' == mobileValue ) {
media = generatepress_live_preview.desktop + ', ' + generatepress_live_preview.mobile;
}
// The tablet setting doesn't exist, mobile does
if ( '' == tabletValue && '' !== mobileValue ) {
media = generatepress_live_preview.desktop + ', ' + generatepress_live_preview.tablet;
}
// The tablet setting doesn't exist, neither does mobile
if ( '' == tabletValue && '' == mobileValue ) {
media = generatepress_live_preview.desktop + ', ' + generatepress_live_preview.tablet + ', ' + generatepress_live_preview.mobile;
}
}
// Check if media query
media_query = typeof media !== 'undefined' ? 'media="' + media + '"' : '';
jQuery( 'head' ).append( '<style id="' + id + '" ' + media_query + '>' + selector + '{' + property + ':' + newval + unit + ';}</style>' );
setTimeout(function() {
jQuery( 'style#' + id ).not( ':last' ).remove();
}, 1000);
setTimeout("jQuery('body').trigger('generate_spacing_updated');", 1000);
} );
} );
}
( function( $ ) {
// Update the site title in real time...
wp.customize( 'blogname', function( value ) {
value.bind( function( newval ) {
$( '.main-title a' ).html( newval );
} );
} );
//Update the site description in real time...
wp.customize( 'blogdescription', function( value ) {
value.bind( function( newval ) {
$( '.site-description' ).html( newval );
} );
} );
wp.customize( 'generate_settings[logo_width]', function( value ) {
value.bind( function( newval ) {
$( '.site-header .header-image' ).css( 'width', newval + 'px' );
if ( '' == newval ) {
$( '.site-header .header-image' ).css( 'width', '' );
}
} );
} );
/**
* Body background color
* Empty: white
*/
generatepress_colors_live_update( 'background_color', 'body', 'background-color', '#FFFFFF' );
/**
* Text color
* Empty: black
*/
generatepress_colors_live_update( 'text_color', 'body', 'color', '#000000' );
/**
* Link color
* Empty: initial
*/
generatepress_colors_live_update( 'link_color', 'a, a:visited', 'color', 'initial' );
/**
* Link color hover
* Empty: initial
*/
generatepress_colors_live_update( 'link_color_hover', 'a:hover', 'color', 'initial' );
/**
* Live update for content & navigation colors thanks to our preset option.
* We only want to run this if GP Premium isn't already doing it.
*/
if ( 'undefined' == typeof generate_colors_live_update ) {
/**
* Blog post title color
* Empty: Body link color
*/
generatepress_colors_live_update( 'blog_post_title_color', '.entry-title a, .entry-title a:visited', 'color', '', 'link_color' );
/**
* Blog post title color on hover
* Empty: Body link color on hover
*/
generatepress_colors_live_update( 'blog_post_title_hover_color', '.entry-title a:hover', 'color', '', 'link_color_hover' );
/**
* Navigation background color
* Empty: Transparent
*/
generatepress_colors_live_update( 'navigation_background_color', '.main-navigation', 'background-color', 'transparent' );
/**
* Primary navigation text color
* Empty: link_color
*/
generatepress_colors_live_update( 'navigation_text_color',
'.main-navigation .main-nav ul li a,\
.menu-toggle,button.menu-toggle:hover,\
button.menu-toggle:focus,\
.main-navigation .mobile-bar-items a,\
.main-navigation .mobile-bar-items a:hover,\
.main-navigation .mobile-bar-items a:focus',
'color',
'',
'link_color'
);
/**
* Primary navigation text color hover
* Empty: link_color_hover
*/
generatepress_colors_live_update( 'navigation_text_hover_color',
'.navigation-search input[type="search"],\
.navigation-search input[type="search"]:active,\
.navigation-search input[type="search"]:focus,\
.main-navigation .main-nav ul li:hover > a,\
.main-navigation .main-nav ul li:focus > a,\
.main-navigation .main-nav ul li.sfHover > a',
'color',
'',
'link_color_hover'
);
/**
* Primary navigation menu item hover
* Empty: transparent
*/
generatepress_colors_live_update( 'navigation_background_hover_color',
'.navigation-search input[type="search"],\
.navigation-search input[type="search"]:focus,\
.main-navigation .main-nav ul li:hover > a,\
.main-navigation .main-nav ul li:focus > a,\
.main-navigation .main-nav ul li.sfHover > a',
'background-color',
'transparent'
);
/**
* Primary sub-navigation color
* Empty: transparent
*/
generatepress_colors_live_update( 'subnavigation_background_color', '.main-navigation ul ul', 'background-color', 'transparent' );
/**
* Primary sub-navigation text color
* Empty: link_color
*/
generatepress_colors_live_update( 'subnavigation_text_color', '.main-navigation .main-nav ul ul li a', 'color', 'link_color' );
/**
* Primary sub-navigation hover
*/
var subnavigation_hover = '.main-navigation .main-nav ul ul li:hover > a, \
.main-navigation .main-nav ul ul li:focus > a, \
.main-navigation .main-nav ul ul li.sfHover > a';
/**
* Primary sub-navigation text hover
* Empty: link_color_hover
*/
generatepress_colors_live_update( 'subnavigation_text_hover_color', subnavigation_hover, 'color', '', 'link_color_hover' );
/**
* Primary sub-navigation background hover
* Empty: transparent
*/
generatepress_colors_live_update( 'subnavigation_background_hover_color', subnavigation_hover, 'background-color', 'transparent' );
/**
* Navigation current selectors
*/
var navigation_current = '.main-navigation .main-nav ul li[class*="current-menu-"] > a, \
.main-navigation .main-nav ul li[class*="current-menu-"]:hover > a, \
.main-navigation .main-nav ul li[class*="current-menu-"].sfHover > a';
/**
* Primary navigation current text
* Empty: link_color
*/
generatepress_colors_live_update( 'navigation_text_current_color', navigation_current, 'color', '', 'link_color' );
/**
* Primary navigation current background
* Empty: transparent
*/
generatepress_colors_live_update( 'navigation_background_current_color', navigation_current, 'background-color', 'transparent' );
/**
* Primary sub-navigation current selectors
*/
var subnavigation_current = '.main-navigation .main-nav ul ul li[class*="current-menu-"] > a,\
.main-navigation .main-nav ul ul li[class*="current-menu-"]:hover > a, \
.main-navigation .main-nav ul ul li[class*="current-menu-"].sfHover > a';
/**
* Primary sub-navigation current text
* Empty: link_color
*/
generatepress_colors_live_update( 'subnavigation_text_current_color', subnavigation_current, 'color', '', 'link_color' );
/**
* Primary navigation current item background
* Empty: transparent
*/
generatepress_colors_live_update( 'subnavigation_background_current_color', subnavigation_current, 'background-color', 'transparent' );
}
/**
* Container width
*/
wp.customize( 'generate_settings[container_width]', function( value ) {
value.bind( function( newval ) {
if ( jQuery( 'style#container_width' ).length ) {
jQuery( 'style#container_width' ).html( 'body .grid-container, .wp-block-group__inner-container{max-width:' + newval + 'px;}' );
} else {
jQuery( 'head' ).append( '<style id="container_width">body .grid-container, .wp-block-group__inner-container{max-width:' + newval + 'px;}</style>' );
setTimeout(function() {
jQuery( 'style#container_width' ).not( ':last' ).remove();
}, 100);
}
jQuery('body').trigger('generate_spacing_updated');
} );
} );
/**
* Live update for typography options.
* We only want to run this if GP Premium isn't already doing it.
*/
if ( 'undefined' == typeof gp_premium_typography_live_update ) {
/**
* Body font size, weight and transform
*/
generatepress_typography_live_update( 'body_font_size', 'body, button, input, select, textarea', 'font-size', 'px' );
generatepress_typography_live_update( 'body_line_height', 'body', 'line-height', '' );
generatepress_typography_live_update( 'paragraph_margin', 'p, .entry-content > [class*="wp-block-"]:not(:last-child)', 'margin-bottom', 'em' );
generatepress_typography_live_update( 'body_font_weight', 'body, button, input, select, textarea', 'font-weight' );
generatepress_typography_live_update( 'body_font_transform', 'body, button, input, select, textarea', 'text-transform' );
/**
* H1 font size, weight and transform
*/
generatepress_typography_live_update( 'heading_1_font_size', 'h1', 'font-size', 'px', generatepress_live_preview.desktop );
generatepress_typography_live_update( 'mobile_heading_1_font_size', 'h1', 'font-size', 'px', generatepress_live_preview.mobile );
generatepress_typography_live_update( 'heading_1_weight', 'h1', 'font-weight' );
generatepress_typography_live_update( 'heading_1_transform', 'h1', 'text-transform' );
generatepress_typography_live_update( 'heading_1_line_height', 'h1', 'line-height', 'em' );
/**
* H2 font size, weight and transform
*/
generatepress_typography_live_update( 'heading_2_font_size', 'h2', 'font-size', 'px', generatepress_live_preview.desktop );
generatepress_typography_live_update( 'mobile_heading_2_font_size', 'h2', 'font-size', 'px', generatepress_live_preview.mobile );
generatepress_typography_live_update( 'heading_2_weight', 'h2', 'font-weight' );
generatepress_typography_live_update( 'heading_2_transform', 'h2', 'text-transform' );
generatepress_typography_live_update( 'heading_2_line_height', 'h2', 'line-height', 'em' );
/**
* H3 font size, weight and transform
*/
generatepress_typography_live_update( 'heading_3_font_size', 'h3', 'font-size', 'px' );
generatepress_typography_live_update( 'heading_3_weight', 'h3', 'font-weight' );
generatepress_typography_live_update( 'heading_3_transform', 'h3', 'text-transform' );
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
*/
wp.customize( 'generate_settings[top_bar_width]', function( value ) {
value.bind( function( newval ) {
if ( 'full' == newval ) {
$( '.top-bar' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
if ( 'contained' == wp.customize.value('generate_settings[top_bar_inner_width]')() ) {
$( '.inside-top-bar' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
}
}
if ( 'contained' == newval ) {
$( '.top-bar' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
$( '.inside-top-bar' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
}
} );
} );
/**
* Inner top bar width
*/
wp.customize( 'generate_settings[top_bar_inner_width]', function( value ) {
value.bind( function( newval ) {
if ( 'full' == newval ) {
$( '.inside-top-bar' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
}
if ( 'contained' == newval ) {
$( '.inside-top-bar' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
}
} );
} );
/**
* Top bar alignment
*/
generatepress_classes_live_update( 'top_bar_alignment', [ 'left', 'center', 'right' ], '.top-bar', 'top-bar-align-' );
/**
* Header layout
*/
wp.customize( 'generate_settings[header_layout_setting]', function( value ) {
value.bind( function( newval ) {
if ( 'fluid-header' == newval ) {
$( '.site-header' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
if ( 'contained' == wp.customize.value('generate_settings[header_inner_width]')() ) {
$( '.inside-header' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
}
}
if ( 'contained-header' == newval ) {
$( '.site-header' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
$( '.inside-header' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
}
} );
} );
/**
* Inner Header layout
*/
wp.customize( 'generate_settings[header_inner_width]', function( value ) {
value.bind( function( newval ) {
if ( 'full-width' == newval ) {
$( '.inside-header' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
}
if ( 'contained' == newval ) {
$( '.inside-header' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
}
} );
} );
/**
* Header alignment
*/
generatepress_classes_live_update( 'header_alignment_setting', [ 'left', 'center', 'right' ], 'body', 'header-aligned-' );
/**
* Navigation width
*/
wp.customize( 'generate_settings[nav_layout_setting]', function( value ) {
value.bind( function( newval ) {
if ( $( 'body' ).hasClass( 'sticky-enabled' ) ) {
wp.customize.preview.send( 'refresh' );
} else {
if ( 'fluid-nav' == newval ) {
$( '.main-navigation' ).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' );
}
}
} );
} );
/**
* Inner navigation width
*/
wp.customize( 'generate_settings[nav_inner_width]', function( value ) {
value.bind( function( newval ) {
if ( 'full-width' == newval ) {
$( '.main-navigation .inside-navigation' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
}
if ( 'contained' == newval ) {
$( '.main-navigation .inside-navigation' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
}
} );
} );
/**
* Navigation position
*/
wp.customize( 'generate_settings[nav_position_setting]', function( value ) {
value.bind( function( newval ) {
$( 'body' ).trigger( 'generate_navigation_location_updated' );
// 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 ( '' !== wp.customize.value('generate_settings[nav_drop_point]')() ) {
wp.customize.preview.send( 'refresh' );
return false;
}
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();
}
}
} );
} );
/**
* Navigation alignment
*/
generatepress_classes_live_update( 'nav_alignment_setting', [ 'left', 'center', 'right' ], 'body', 'nav-aligned-' );
/**
* Footer width
*/
wp.customize( 'generate_settings[footer_layout_setting]', function( value ) {
value.bind( function( newval ) {
if ( 'fluid-footer' == newval ) {
$( '.site-footer' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
}
if ( 'contained-footer' == newval ) {
$( '.site-footer' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
}
} );
} );
/**
* Inner footer width
*/
wp.customize( 'generate_settings[footer_inner_width]', function( value ) {
value.bind( function( newval ) {
if ( 'full-width' == newval ) {
if ( $( '.footer-widgets-container' ).length ) {
$( '.footer-widgets-container' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
} else {
$( '.inside-footer-widgets' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
}
$( '.inside-site-info' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
}
if ( 'contained' == newval ) {
if ( $( '.footer-widgets-container' ).length ) {
$( '.footer-widgets-container' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
} else {
$( '.inside-footer-widgets' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
}
$( '.inside-site-info' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
}
} );
} );
/**
* Footer bar alignment
*/
generatepress_classes_live_update( 'footer_bar_alignment', [ 'left', 'center', 'right' ], '.site-footer', 'footer-bar-align-' );
jQuery( 'body' ).on( 'generate_spacing_updated', function() {
var containerAlignment = wp.customize( 'generate_settings[container_alignment]' ).get(),
containerWidth = wp.customize( 'generate_settings[container_width]' ).get(),
contentLeft = generatepress_live_preview.contentLeft,
contentRight = generatepress_live_preview.contentRight;
if ( 'text' === containerAlignment ) {
if ( typeof wp.customize( 'generate_spacing_settings[content_left]' ) !== 'undefined' ) {
contentLeft = wp.customize( 'generate_spacing_settings[content_left]' ).get();
}
if ( typeof wp.customize( 'generate_spacing_settings[content_right]' ) !== 'undefined' ) {
contentRight = wp.customize( 'generate_spacing_settings[content_right]' ).get();
}
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;}' );
} else {
jQuery( 'head' ).append( '<style id="wide_container_width">#page{max-width:' + newContainerWidth + 'px;}</style>' );
setTimeout(function() {
jQuery( 'style#wide_container_width' ).not( ':last' ).remove();
}, 100);
}
}
} );
} )( jQuery );

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,134 @@
wp.customize.controlConstructor['generatepress-range-slider'] = wp.customize.Control.extend({
ready: function() {
'use strict';
var control = this,
value,
thisInput,
inputDefault,
changeAction,
controlClass = '.customize-control-generatepress-range-slider',
footerActions = jQuery( '#customize-footer-actions' );
// Set up the sliders
jQuery( '.generatepress-slider' ).each( function() {
var _this = jQuery( this );
var _input = _this.closest( 'label' ).find( 'input[type="number"]' );
var _text = _input.next( '.value' );
_this.slider({
value: _input.val(),
min: _this.data( 'min' ),
max: _this.data( 'max' ),
step: _this.data( 'step' ),
slide: function( event, ui ) {
_input.val( ui.value ).change();
_text.text( ui.value );
}
});
});
// Update the range value based on the input value
jQuery( controlClass + ' .gp_range_value input[type=number]' ).on( 'input', function() {
value = jQuery( this ).attr( 'value' );
if ( '' == value ) {
value = -1;
}
jQuery( this ).closest( 'label' ).find( '.generatepress-slider' ).slider( 'value', parseFloat(value)).change();
});
// Handle the reset button
jQuery( controlClass + ' .generatepress-reset' ).on( 'click', function() {
var icon = jQuery( this ),
visible_area = icon.closest( '.gp-range-title-area' ).next( '.gp-range-slider-areas' ).children( 'label:visible' ),
input = visible_area.find( 'input[type=number]' ),
slider_value = visible_area.find( '.generatepress-slider' ),
visual_value = visible_area.find( '.gp_range_value' ),
reset_value = input.attr( 'data-reset_value' );
input.val( reset_value ).change();
visual_value.find( 'input' ).val( reset_value );
visual_value.find( '.value' ).text( reset_value );
if ( '' == reset_value ) {
reset_value = -1;
}
slider_value.slider( 'value', parseFloat( reset_value ) );
});
// Figure out which device icon to make active on load
jQuery( controlClass + ' .generatepress-range-slider-control' ).each( function() {
var _this = jQuery( this );
_this.find( '.gp-device-controls' ).children( 'span:first-child' ).addClass( 'selected' );
_this.find( '.range-option-area:first-child' ).show();
});
// Do stuff when device icons are clicked
jQuery( controlClass + ' .gp-device-controls > span' ).on( 'click', function( event ) {
var device = jQuery( this ).data( 'option' );
jQuery( controlClass + ' .gp-device-controls span' ).each( function() {
var _this = jQuery( this );
if ( device == _this.attr( 'data-option' ) ) {
_this.addClass( 'selected' );
_this.siblings().removeClass( 'selected' );
}
});
jQuery( controlClass + ' .gp-range-slider-areas label' ).each( function() {
var _this = jQuery( this );
if ( device == _this.attr( 'data-option' ) ) {
_this.show();
_this.siblings().hide();
}
});
// Set the device we're currently viewing
wp.customize.previewedDevice.set( jQuery( event.currentTarget ).data( 'option' ) );
} );
// Set the selected devices in our control when the Customizer devices are clicked
footerActions.find( '.devices button' ).on( 'click', function() {
var device = jQuery( this ).data( 'device' );
jQuery( controlClass + ' .gp-device-controls span' ).each( function() {
var _this = jQuery( this );
if ( device == _this.attr( 'data-option' ) ) {
_this.addClass( 'selected' );
_this.siblings().removeClass( 'selected' );
}
});
jQuery( controlClass + ' .gp-range-slider-areas label' ).each( function() {
var _this = jQuery( this );
if ( device == _this.attr( 'data-option' ) ) {
_this.show();
_this.siblings().hide();
}
});
});
// Apply changes when desktop slider is changed
control.container.on( 'input change', '.desktop-range',
function() {
control.settings['desktop'].set( jQuery( this ).val() );
}
);
// Apply changes when tablet slider is changed
control.container.on( 'input change', '.tablet-range',
function() {
control.settings['tablet'].set( jQuery( this ).val() );
}
);
// Apply changes when mobile slider is changed
control.container.on( 'input change', '.mobile-range',
function() {
control.settings['mobile'].set( jQuery( this ).val() );
}
);
}
});

View File

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

View File

@ -0,0 +1,12 @@
( function( $, api ) {
api.sectionConstructor['gp-upsell-section'] = api.Section.extend( {
// No events for this type of section.
attachEvents: function () {},
// Always make the section active.
isContextuallyActive: function () {
return true;
}
} );
} )( jQuery, wp.customize );

View File

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

View File

@ -0,0 +1,111 @@
<?php
/**
* Where old Customizer functions retire.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! function_exists( 'generate_sanitize_typography' ) ) {
/**
* Sanitize typography dropdown.
*
* @since 1.1.10
* @deprecated 1.3.45
*/
function generate_sanitize_typography( $input ) {
// Grab all of our fonts
$fonts = generate_get_all_google_fonts();
// 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
$not_google = generate_typography_default_fonts();
// Merge them both into one array
$valid = array_merge( $font_names, $not_google );
// Sanitize
if ( in_array( $input, $valid ) ) {
return $input;
} else {
return 'Open Sans';
}
}
}
if ( ! function_exists( 'generate_sanitize_font_weight' ) ) {
/**
* Sanitize font weight.
*
* @since 1.1.10
* @deprecated 1.3.40
*/
function generate_sanitize_font_weight( $input ) {
$valid = array(
'normal',
'bold',
'100',
'200',
'300',
'400',
'500',
'600',
'700',
'800',
'900',
);
if ( in_array( $input, $valid ) ) {
return $input;
} else {
return 'normal';
}
}
}
if ( ! function_exists( 'generate_sanitize_text_transform' ) ) {
/**
* Sanitize text transform.
*
* @since 1.1.10
* @deprecated 1.3.40
*/
function generate_sanitize_text_transform( $input ) {
$valid = array(
'none',
'capitalize',
'uppercase',
'lowercase',
);
if ( in_array( $input, $valid ) ) {
return $input;
} else {
return 'none';
}
}
}
if ( ! function_exists( 'generate_typography_customize_preview_css' ) ) {
/**
* Hide the hidden input control
* @since 1.3.40
*/
function generate_typography_customize_preview_css() {
?>
<style>
.customize-control-gp-hidden-input {display:none !important;}
</style>
<?php
}
}

View File

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

View File

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

@ -0,0 +1,354 @@
<?php
/**
* Sets all of our theme defaults.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! function_exists( 'generate_get_defaults' ) ) {
/**
* Set default options
*
* @since 0.1
*/
function generate_get_defaults() {
return apply_filters( 'generate_option_defaults',
array(
'hide_title' => '',
'hide_tagline' => '',
'logo' => '',
'inline_logo_site_branding' => false,
'retina_logo' => '',
'logo_width' => '',
'top_bar_width' => 'full',
'top_bar_inner_width' => 'contained',
'top_bar_alignment' => 'right',
'container_width' => '1100',
'container_alignment' => 'boxes',
'header_layout_setting' => 'fluid-header',
'header_inner_width' => 'contained',
'nav_alignment_setting' => ( is_rtl() ) ? 'right' : 'left',
'header_alignment_setting' => ( is_rtl() ) ? 'right' : 'left',
'nav_layout_setting' => 'fluid-nav',
'nav_inner_width' => 'contained',
'nav_position_setting' => 'nav-below-header',
'nav_drop_point' => '',
'nav_dropdown_type' => 'hover',
'nav_dropdown_direction' => 'right',
'nav_search' => 'disable',
'content_layout_setting' => 'separate-containers',
'layout_setting' => 'right-sidebar',
'blog_layout_setting' => 'right-sidebar',
'single_layout_setting' => 'right-sidebar',
'post_content' => 'excerpt',
'footer_layout_setting' => 'fluid-footer',
'footer_inner_width' => 'contained',
'footer_widget_setting' => '3',
'footer_bar_alignment' => 'right',
'back_to_top' => '',
'background_color' => '#efefef',
'text_color' => '#3a3a3a',
'link_color' => '#1e73be',
'link_color_hover' => '#000000',
'link_color_visited' => '',
'font_awesome_essentials' => true,
'icons' => 'font',
'combine_css' => true,
'dynamic_css_cache' => true,
)
);
}
}
if ( ! function_exists( 'generate_get_color_defaults' ) ) {
/**
* Set default options
*/
function generate_get_color_defaults() {
return apply_filters( 'generate_color_option_defaults',
array(
'top_bar_background_color' => '#636363',
'top_bar_text_color' => '#ffffff',
'top_bar_link_color' => '#ffffff',
'top_bar_link_color_hover' => '#303030',
'header_background_color' => '#ffffff',
'header_text_color' => '#3a3a3a',
'header_link_color' => '#3a3a3a',
'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_search_background_color' => '',
'navigation_search_text_color' => '',
'content_background_color' => '#ffffff',
'content_text_color' => '',
'content_link_color' => '',
'content_link_hover_color' => '',
'content_title_color' => '',
'blog_post_title_color' => '',
'blog_post_title_hover_color' => '',
'entry_meta_text_color' => '#595959',
'entry_meta_link_color' => '#595959',
'entry_meta_link_color_hover' => '#1e73be',
'h1_color' => '',
'h2_color' => '',
'h3_color' => '',
'h4_color' => '',
'h5_color' => '',
'h6_color' => '',
'sidebar_widget_background_color' => '#ffffff',
'sidebar_widget_text_color' => '',
'sidebar_widget_link_color' => '',
'sidebar_widget_link_hover_color' => '',
'sidebar_widget_title_color' => '#000000',
'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_text_color' => '#ffffff',
'footer_link_color' => '#ffffff',
'footer_link_hover_color' => '#606060',
'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_text_color' => '#ffffff',
'form_button_text_color_hover' => '#ffffff',
'back_to_top_background_color' => 'rgba( 0,0,0,0.4 )',
'back_to_top_background_color_hover' => 'rgba( 0,0,0,0.6 )',
'back_to_top_text_color' => '#ffffff',
'back_to_top_text_color_hover' => '#ffffff',
)
);
}
}
if ( ! function_exists( 'generate_get_default_fonts' ) ) {
/**
* Set default options.
*
* @since 0.1
*
* @param bool $filter Whether to return the filtered values or original values.
* @return array Option defaults.
*/
function generate_get_default_fonts( $filter = true ) {
$defaults = array(
'font_body' => 'System Stack',
'font_body_category' => '',
'font_body_variants' => '',
'body_font_weight' => 'normal',
'body_font_transform' => 'none',
'body_font_size' => '17',
'body_line_height' => '1.5', // no unit
'paragraph_margin' => '1.5', // em
'font_top_bar' => 'inherit',
'font_top_bar_category' => '',
'font_top_bar_variants' => '',
'top_bar_font_weight' => 'normal',
'top_bar_font_transform' => 'none',
'top_bar_font_size' => '13',
'font_site_title' => 'inherit',
'font_site_title_category' => '',
'font_site_title_variants' => '',
'site_title_font_weight' => 'bold',
'site_title_font_transform' => 'none',
'site_title_font_size' => '45',
'mobile_site_title_font_size' => '30',
'font_site_tagline' => 'inherit',
'font_site_tagline_category' => '',
'font_site_tagline_variants' => '',
'site_tagline_font_weight' => 'normal',
'site_tagline_font_transform' => 'none',
'site_tagline_font_size' => '15',
'font_navigation' => 'inherit',
'font_navigation_category' => '',
'font_navigation_variants' => '',
'navigation_font_weight' => 'normal',
'navigation_font_transform' => 'none',
'navigation_font_size' => '15',
'font_widget_title' => 'inherit',
'font_widget_title_category' => '',
'font_widget_title_variants' => '',
'widget_title_font_weight' => 'normal',
'widget_title_font_transform' => 'none',
'widget_title_font_size' => '20',
'widget_title_separator' => '30',
'widget_content_font_size' => '17',
'font_buttons' => 'inherit',
'font_buttons_category' => '',
'font_buttons_variants' => '',
'buttons_font_weight' => 'normal',
'buttons_font_transform' => 'none',
'buttons_font_size' => '',
'font_heading_1' => 'inherit',
'font_heading_1_category' => '',
'font_heading_1_variants' => '',
'heading_1_weight' => '300',
'heading_1_transform' => 'none',
'heading_1_font_size' => '40',
'heading_1_line_height' => '1.2', // em
'heading_1_margin_bottom' => '20',
'mobile_heading_1_font_size' => '30',
'font_heading_2' => 'inherit',
'font_heading_2_category' => '',
'font_heading_2_variants' => '',
'heading_2_weight' => '300',
'heading_2_transform' => 'none',
'heading_2_font_size' => '30',
'heading_2_line_height' => '1.2', // em
'heading_2_margin_bottom' => '20',
'mobile_heading_2_font_size' => '25',
'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_margin_bottom' => '20',
'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
'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
'font_heading_6' => 'inherit',
'font_heading_6_category' => '',
'font_heading_6_variants' => '',
'heading_6_weight' => 'normal',
'heading_6_transform' => 'none',
'heading_6_font_size' => '',
'heading_6_line_height' => '', // em
'font_footer' => 'inherit',
'font_footer_category' => '',
'font_footer_variants' => '',
'footer_weight' => 'normal',
'footer_transform' => 'none',
'footer_font_size' => '15',
);
if ( $filter ) {
return apply_filters( 'generate_font_option_defaults', $defaults );
}
return $defaults;
}
}
if ( ! function_exists( 'generate_spacing_get_defaults' ) ) {
/**
* Set the default options.
*
* @since 0.1
*
* @param bool $filter Whether to return the filtered values or original values.
* @return array Option defaults.
*/
function generate_spacing_get_defaults( $filter = true ) {
$defaults = array(
'top_bar_top' => '10',
'top_bar_right' => '10',
'top_bar_bottom' => '10',
'top_bar_left' => '10',
'header_top' => '40',
'header_right' => '40',
'header_bottom' => '40',
'header_left' => '40',
'menu_item' => '20',
'menu_item_height' => '60',
'sub_menu_item_height' => '10',
'sub_menu_width' => '200',
'content_top' => '40',
'content_right' => '40',
'content_bottom' => '40',
'content_left' => '40',
'mobile_content_top' => '30',
'mobile_content_right' => '30',
'mobile_content_bottom' => '30',
'mobile_content_left' => '30',
'separator' => '20',
'mobile_separator' => '',
'left_sidebar_width' => '25',
'right_sidebar_width' => '25',
'widget_top' => '40',
'widget_right' => '40',
'widget_bottom' => '40',
'widget_left' => '40',
'footer_widget_container_top' => '40',
'footer_widget_container_right' => '40',
'footer_widget_container_bottom' => '40',
'footer_widget_container_left' => '40',
'footer_widget_separator' => '40',
'footer_top' => '20',
'footer_right' => '20',
'footer_bottom' => '20',
'footer_left' => '20',
);
if ( $filter ) {
return apply_filters( 'generate_spacing_option_defaults', $defaults );
}
return $defaults;
}
}
if ( ! function_exists( 'generate_typography_default_fonts' ) ) {
/**
* Set the default system fonts.
*
* @since 1.3.40
*/
function generate_typography_default_fonts() {
$fonts = array(
'inherit',
'System Stack',
'Arial, Helvetica, sans-serif',
'Century Gothic',
'Comic Sans MS',
'Courier New',
'Georgia, Times New Roman, Times, serif',
'Helvetica',
'Impact',
'Lucida Console',
'Lucida Sans Unicode',
'Palatino Linotype',
'Segoe UI, Helvetica Neue, Helvetica, sans-serif',
'Tahoma, Geneva, sans-serif',
'Trebuchet MS, Helvetica, sans-serif',
'Verdana, Geneva, sans-serif',
);
return apply_filters( 'generate_typography_default_fonts', $fonts );
}
}

View File

@ -0,0 +1,712 @@
<?php
/**
* Where old functions retire.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
// 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' )
) );
}
}
}
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
}
}
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
}
}
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
*/
function generate_addons_available() {
if ( defined( 'GP_PREMIUM_VERSION' ) ) {
return false;
}
}
}
if ( ! function_exists( 'generate_no_addons' ) ) {
/**
* Check to see if no addons are activated
* @since 1.0.9
* @deprecated 1.3.47
*/
function generate_no_addons() {
if ( defined( 'GP_PREMIUM_VERSION' ) ) {
return false;
}
}
}
if ( ! function_exists( 'generate_get_min_suffix' ) ) {
/**
* Figure out if we should use minified scripts or not
* @since 1.3.29
* @deprecated 2.0
*/
function generate_get_min_suffix() {
return defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
}
}
if ( ! function_exists( 'generate_add_layout_meta_box' ) ) {
function generate_add_layout_meta_box() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_register_layout_meta_box()' );
}
}
if ( ! function_exists( 'generate_show_layout_meta_box' ) ) {
function generate_show_layout_meta_box() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_do_layout_meta_box()' );
}
}
if ( ! function_exists( 'generate_save_layout_meta' ) ) {
function generate_save_layout_meta() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_save_layout_meta_data()' );
}
}
if ( ! function_exists( 'generate_add_footer_widget_meta_box' ) ) {
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' ) ) {
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' ) ) {
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' ) ) {
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' ) ) {
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' ) ) {
function generate_save_page_builder_meta() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_save_layout_meta_data()' );
}
}
if ( ! function_exists( 'generate_add_de_meta_box' ) ) {
function generate_add_de_meta_box() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_register_layout_meta_box()' );
}
}
if ( ! function_exists( 'generate_show_de_meta_box' ) ) {
function generate_show_de_meta_box() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_do_layout_meta_box()' );
}
}
if ( ! function_exists( 'generate_save_de_meta' ) ) {
function generate_save_de_meta() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_save_layout_meta_data()' );
}
}
if ( ! function_exists( 'generate_add_base_inline_css' ) ) {
function generate_add_base_inline_css() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_enqueue_dynamic_css()' );
}
}
if ( ! function_exists( 'generate_color_scripts' ) ) {
function generate_color_scripts() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_enqueue_dynamic_css()' );
}
}
if ( ! function_exists( 'generate_typography_scripts' ) ) {
function generate_typography_scripts() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_enqueue_dynamic_css()' );
}
}
if ( ! function_exists( 'generate_spacing_scripts' ) ) {
function generate_spacing_scripts() {
_deprecated_function( __FUNCTION__, '2.0', 'generate_enqueue_dynamic_css()' );
}
}
if ( ! function_exists( 'generate_get_setting' ) ) {
/**
* A wrapper function to get our settings.
*
* @since 1.3.40
*
* @param string $option The option name to look up.
* @return string The option value.
* @todo Ability to specify different option name and defaults.
*/
function generate_get_setting( $setting ) {
return generate_get_option( $setting );
}
}
if ( ! function_exists( 'generate_right_sidebar_class' ) ) {
/**
* Display the classes for the sidebar.
*
* @since 0.1
* @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.
}
}
if ( ! function_exists( 'generate_get_right_sidebar_class' ) ) {
/**
* Retrieve the classes for the sidebar.
*
* @since 0.1
* @param string|array $class One or more classes to add to the class list.
* @return array Array of classes.
*/
function generate_get_right_sidebar_class( $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_right_sidebar_class', $classes, $class );
}
}
if ( ! function_exists( 'generate_left_sidebar_class' ) ) {
/**
* Display the classes for the sidebar.
*
* @since 0.1
* @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.
}
}
if ( ! function_exists( 'generate_get_left_sidebar_class' ) ) {
/**
* Retrieve the classes for the sidebar.
*
* @since 0.1
* @param string|array $class One or more classes to add to the class list.
* @return array Array of classes.
*/
function generate_get_left_sidebar_class( $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_left_sidebar_class', $classes, $class );
}
}
if ( ! function_exists( 'generate_content_class' ) ) {
/**
* Display the classes for the content.
*
* @since 0.1
* @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.
}
}
if ( ! function_exists( 'generate_get_content_class' ) ) {
/**
* Retrieve the classes for the content.
*
* @since 0.1
* @param string|array $class One or more classes to add to the class list.
* @return array Array of classes.
*/
function generate_get_content_class( $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_content_class', $classes, $class );
}
}
if ( ! function_exists( 'generate_header_class' ) ) {
/**
* Display the classes for the header.
*
* @since 0.1
* @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.
}
}
if ( ! function_exists( 'generate_get_header_class' ) ) {
/**
* Retrieve the classes for the content.
*
* @since 0.1
* @param string|array $class One or more classes to add to the class list.
* @return array Array of classes.
*/
function generate_get_header_class( $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_header_class', $classes, $class );
}
}
if ( ! function_exists( 'generate_inside_header_class' ) ) {
/**
* Display the classes for inside the header.
*
* @since 0.1
* @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.
}
}
if ( ! function_exists( 'generate_get_inside_header_class' ) ) {
/**
* Retrieve the classes for inside the header.
*
* @since 0.1
* @param string|array $class One or more classes to add to the class list.
* @return array Array of classes.
*/
function generate_get_inside_header_class( $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_inside_header_class', $classes, $class );
}
}
if ( ! function_exists( 'generate_container_class' ) ) {
/**
* Display the classes for the container.
*
* @since 0.1
* @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.
}
}
if ( ! function_exists( 'generate_get_container_class' ) ) {
/**
* Retrieve the classes for the content.
*
* @since 0.1
* @param string|array $class One or more classes to add to the class list.
* @return array Array of classes.
*/
function generate_get_container_class( $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_container_class', $classes, $class );
}
}
if ( ! function_exists( 'generate_navigation_class' ) ) {
/**
* Display the classes for the navigation.
*
* @since 0.1
* @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.
}
}
if ( ! function_exists( 'generate_get_navigation_class' ) ) {
/**
* Retrieve the classes for the navigation.
*
* @since 0.1
* @param string|array $class One or more classes to add to the class list.
* @return array Array of classes.
*/
function generate_get_navigation_class( $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_navigation_class', $classes, $class );
}
}
if ( ! function_exists( 'generate_inside_navigation_class' ) ) {
/**
* Display the classes for the inner navigation.
*
* @since 1.3.41
* @param string|array $class One or more classes to add to the class list.
*/
function generate_inside_navigation_class( $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_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.
}
}
if ( ! function_exists( 'generate_menu_class' ) ) {
/**
* Display the classes for the navigation.
*
* @since 0.1
* @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.
}
}
if ( ! function_exists( 'generate_get_menu_class' ) ) {
/**
* Retrieve the classes for the navigation.
*
* @since 0.1
* @param string|array $class One or more classes to add to the class list.
* @return array Array of classes.
*/
function generate_get_menu_class( $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_menu_class', $classes, $class );
}
}
if ( ! function_exists( 'generate_main_class' ) ) {
/**
* Display the classes for the <main> container.
*
* @since 1.1.0
* @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.
}
}
if ( ! function_exists( 'generate_get_main_class' ) ) {
/**
* Retrieve the classes for the footer.
*
* @since 0.1
* @param string|array $class One or more classes to add to the class list.
* @return array Array of classes.
*/
function generate_get_main_class( $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_main_class', $classes, $class );
}
}
if ( ! function_exists( 'generate_footer_class' ) ) {
/**
* Display the classes for the footer.
*
* @since 0.1
* @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.
}
}
if ( ! function_exists( 'generate_get_footer_class' ) ) {
/**
* Retrieve the classes for the footer.
*
* @since 0.1
* @param string|array $class One or more classes to add to the class list.
* @return array Array of classes.
*/
function generate_get_footer_class( $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_footer_class', $classes, $class );
}
}
if ( ! function_exists( 'generate_inside_footer_class' ) ) {
/**
* Display the classes for the footer.
*
* @since 0.1
* @param string|array $class One or more classes to add to the class list.
*/
function generate_inside_footer_class( $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_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.
}
}
if ( ! function_exists( 'generate_top_bar_class' ) ) {
/**
* Display the classes for the top bar.
*
* @since 1.3.45
* @param string|array $class One or more classes to add to the class list.
*/
function generate_top_bar_class( $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_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.
}
}
if ( ! function_exists( 'generate_body_schema' ) ) {
/**
* Figure out which schema tags to apply to the <body> element.
*
* @since 1.3.15
*/
function generate_body_schema() {
// Set up blog variable
$blog = ( is_home() || is_archive() || is_attachment() || is_tax() || is_single() ) ? true : false;
// Set up default itemtype
$itemtype = 'WebPage';
// Get itemtype for the blog
$itemtype = ( $blog ) ? 'Blog' : $itemtype;
// Get itemtype for search results
$itemtype = ( is_search() ) ? 'SearchResultsPage' : $itemtype;
// 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.
}
}
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
*/
function generate_article_schema( $type = 'CreativeWork' ) {
// 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.
}
}

View File

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

View File

@ -0,0 +1,565 @@
<?php
/**
* Adds HTML markup.
*
* @package GeneratePress
*/
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.
* @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();
// 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 ( '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 ( 'center' === $navigation_alignment ) {
$classes[] = 'nav-aligned-center';
} elseif ( 'right' === $navigation_alignment ) {
$classes[] = 'nav-aligned-right';
} elseif ( 'left' === $navigation_alignment ) {
$classes[] = 'nav-aligned-left';
}
}
if ( 'center' === $header_alignment ) {
$classes[] = 'header-aligned-center';
} elseif ( 'right' === $header_alignment ) {
$classes[] = 'header-aligned-right';
} elseif ( 'left' === $header_alignment ) {
$classes[] = 'header-aligned-left';
}
if ( 'click' === $navigation_dropdown ) {
$classes[] = 'dropdown-click';
$classes[] = 'dropdown-click-menu-item';
} elseif ( 'click-arrow' === $navigation_dropdown ) {
$classes[] = 'dropdown-click-arrow';
$classes[] = 'dropdown-click';
} else {
$classes[] = 'dropdown-hover';
}
if ( is_singular() ) {
// Page builder container metabox option.
// Used to be a single checkbox, hence the name/true value. Now it's a radio choice between full width and contained.
$content_container = get_post_meta( get_the_ID(), '_generate-full-width-content', true );
if ( $content_container ) {
if ( 'true' === $content_container ) {
$classes[] = 'full-width-content';
}
if ( 'contained' === $content_container ) {
$classes[] = 'contained-content';
}
}
if ( has_post_thumbnail() ) {
$classes[] = 'featured-image-active';
}
}
return $classes;
}
}
if ( ! function_exists( 'generate_top_bar_classes' ) ) {
add_filter( 'generate_top_bar_class', 'generate_top_bar_classes' );
/**
* Adds custom classes to the header.
*
* @since 0.1
*/
function generate_top_bar_classes( $classes ) {
$classes[] = 'top-bar';
if ( 'contained' === generate_get_option( 'top_bar_width' ) ) {
$classes[] = 'grid-container';
$classes[] = 'grid-parent';
}
$classes[] = 'top-bar-align-' . esc_attr( generate_get_option( 'top_bar_alignment' ) );
return $classes;
}
}
if ( ! function_exists( 'generate_right_sidebar_classes' ) ) {
add_filter( 'generate_right_sidebar_class', 'generate_right_sidebar_classes' );
/**
* Adds custom classes to the right sidebar.
*
* @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';
// 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;
}
}
return $classes;
}
}
if ( ! function_exists( 'generate_left_sidebar_classes' ) ) {
add_filter( 'generate_left_sidebar_class', 'generate_left_sidebar_classes' );
/**
* Adds custom classes to the left sidebar.
*
* @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';
// 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;
}
}
return $classes;
}
}
if ( ! function_exists( 'generate_content_classes' ) ) {
add_filter( 'generate_content_class', 'generate_content_classes' );
/**
* Adds custom classes to the content container.
*
* @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 ( '' !== $layout ) {
switch ( $layout ) {
case 'right-sidebar' :
$classes[] = 'grid-' . ( 100 - $right_sidebar_width );
$classes[] = 'tablet-grid-' . ( 100 - $right_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 '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;
}
}
return $classes;
}
}
if ( ! function_exists( 'generate_header_classes' ) ) {
add_filter( 'generate_header_class', 'generate_header_classes' );
/**
* Adds custom classes to the header.
*
* @since 0.1
*/
function generate_header_classes( $classes ) {
$classes[] = 'site-header';
if ( 'contained-header' === generate_get_option( 'header_layout_setting' ) ) {
$classes[] = 'grid-container';
$classes[] = 'grid-parent';
}
return $classes;
}
}
if ( ! function_exists( 'generate_inside_header_classes' ) ) {
add_filter( 'generate_inside_header_class', 'generate_inside_header_classes' );
/**
* Adds custom classes to inside the header.
*
* @since 0.1
*/
function generate_inside_header_classes( $classes ) {
$classes[] = 'inside-header';
if ( 'full-width' !== generate_get_option( 'header_inner_width' ) ) {
$classes[] = 'grid-container';
$classes[] = 'grid-parent';
}
return $classes;
}
}
if ( ! function_exists( 'generate_navigation_classes' ) ) {
add_filter( 'generate_navigation_class', 'generate_navigation_classes' );
/**
* Adds custom classes to the navigation.
*
* @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 ( '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;
}
}
return $classes;
}
}
if ( ! function_exists( 'generate_inside_navigation_classes' ) ) {
add_filter( 'generate_inside_navigation_class', 'generate_inside_navigation_classes' );
/**
* Adds custom classes to the inner navigation.
*
* @since 1.3.41
*/
function generate_inside_navigation_classes( $classes ) {
$classes[] = 'inside-navigation';
if ( 'full-width' !== generate_get_option( 'nav_inner_width' ) ) {
$classes[] = 'grid-container';
$classes[] = 'grid-parent';
}
return $classes;
}
}
if ( ! function_exists( 'generate_menu_classes' ) ) {
add_filter( 'generate_menu_class', 'generate_menu_classes' );
/**
* Adds custom classes to the menu.
*
* @since 0.1
*/
function generate_menu_classes( $classes ) {
$classes[] = 'menu';
$classes[] = 'sf-menu';
return $classes;
}
}
if ( ! function_exists( 'generate_footer_classes' ) ) {
add_filter( 'generate_footer_class', 'generate_footer_classes' );
/**
* Adds custom classes to the footer.
*
* @since 0.1
*/
function generate_footer_classes( $classes ) {
$classes[] = 'site-footer';
if ( 'contained-footer' === generate_get_option( 'footer_layout_setting' ) ) {
$classes[] = 'grid-container';
$classes[] = 'grid-parent';
}
if ( is_active_sidebar( 'footer-bar' ) ) {
$classes[] = 'footer-bar-active';
$classes[] = 'footer-bar-align-' . esc_attr( generate_get_option( 'footer_bar_alignment' ) );
}
return $classes;
}
}
if ( ! function_exists( 'generate_inside_footer_classes' ) ) {
add_filter( 'generate_inside_footer_class', 'generate_inside_footer_classes' );
/**
* Adds custom classes to the footer.
*
* @since 0.1
*/
function generate_inside_footer_classes( $classes ) {
$classes[] = 'footer-widgets-container';
if ( 'full-width' !== generate_get_option( 'footer_inner_width' ) ) {
$classes[] = 'grid-container';
$classes[] = 'grid-parent';
}
return $classes;
}
}
if ( ! function_exists( 'generate_main_classes' ) ) {
add_filter( 'generate_main_class', 'generate_main_classes' );
/**
* Adds custom classes to the <main> element
* @since 1.1.0
*/
function generate_main_classes( $classes ) {
$classes[] = 'site-main';
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.
*
* @since 1.3.39
*/
function generate_post_classes( $classes ) {
if ( 'page' == get_post_type() ) {
$classes = array_diff( $classes, array( 'hentry' ) );
}
return $classes;
}
}

View File

@ -0,0 +1,315 @@
<?php
/**
* Builds our main Layout meta box.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
add_action( 'admin_enqueue_scripts', 'generate_enqueue_meta_box_scripts' );
/**
* Adds any scripts for this meta box.
*
* @since 2.0
*
* @param string $hook The current admin page.
*/
function generate_enqueue_meta_box_scripts( $hook ) {
if ( in_array( $hook, array( 'post.php', 'post-new.php' ) ) ) {
$post_types = get_post_types( array( 'public' => true ) );
$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 );
}
}
}
add_action( 'add_meta_boxes', 'generate_register_layout_meta_box' );
/**
* Generate the layout metabox
*
* @since 2.0
*/
function generate_register_layout_meta_box() {
if ( ! current_user_can( apply_filters( 'generate_metabox_capability', 'edit_theme_options' ) ) ) {
return;
}
if ( ! defined( 'GENERATE_LAYOUT_META_BOX' ) ) {
define( 'GENERATE_LAYOUT_META_BOX', true );
}
$post_types = get_post_types( array( 'public' => true ) );
foreach ( $post_types as $type ) {
if ( 'attachment' !== $type ) {
add_meta_box(
'generate_layout_options_meta_box',
esc_html__( 'Layout', 'generatepress' ),
'generate_do_layout_meta_box',
$type,
'side'
);
}
}
}
/**
* Build our meta box.
*
* @since 2.0
*
* @param object $post All post information.
*/
function generate_do_layout_meta_box( $post ) {
wp_nonce_field( basename( __FILE__ ), 'generate_layout_nonce' );
$stored_meta = (array) get_post_meta( $post->ID );
$stored_meta['_generate-sidebar-layout-meta'][0] = ( isset( $stored_meta['_generate-sidebar-layout-meta'][0] ) ) ? $stored_meta['_generate-sidebar-layout-meta'][0] : '';
$stored_meta['_generate-footer-widget-meta'][0] = ( isset( $stored_meta['_generate-footer-widget-meta'][0] ) ) ? $stored_meta['_generate-footer-widget-meta'][0] : '';
$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',
array(
'sidebars' => array(
'title' => esc_html__( 'Sidebars', 'generatepress' ),
'target' => '#generate-layout-sidebars',
'class' => 'current',
),
'footer_widgets' => array(
'title' => esc_html__( 'Footer Widgets', 'generatepress' ),
'target' => '#generate-layout-footer-widgets',
'class' => '',
),
'disable_elements' => array(
'title' => esc_html__( 'Disable Elements', 'generatepress' ),
'target' => '#generate-layout-disable-elements',
'class' => '',
),
'container' => array(
'title' => esc_html__( 'Page Builder Container', 'generatepress' ),
'target' => '#generate-layout-page-builder-container',
'class' => '',
),
)
);
?>
<script>
jQuery(document).ready(function($) {
$( '.generate-meta-box-menu li a' ).on( 'click', function( event ) {
event.preventDefault();
$( this ).parent().addClass( 'current' );
$( this ).parent().siblings().removeClass( 'current' );
var tab = $( this ).attr( 'data-target' );
// Page header module still using href.
if ( ! tab ) {
tab = $( this ).attr( 'href' );
}
$( '.generate-meta-box-content' ).children( 'div' ).not( tab ).css( 'display', 'none' );
$( tab ).fadeIn( 100 );
});
});
</script>
<div id="generate-meta-box-container">
<ul class="generate-meta-box-menu">
<?php
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>';
}
do_action( 'generate_layout_meta_box_menu_item' );
?>
</ul>
<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="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>
</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="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>
</div>
</div>
<div id="generate-layout-page-builder-container" style="display: none;">
<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' ) ;?>
</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>
</div>
<div id="generate-layout-disable-elements" style="display: none;">
<?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' );?>">
<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' );?>
</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>
</span>
<?php endif; ?>
</div>
<?php endif; ?>
<?php do_action( 'generate_layout_disable_elements_section', $stored_meta ); ?>
</div>
<?php do_action( 'generate_layout_meta_box_content', $stored_meta ); ?>
</div>
</div>
<?php
}
add_action( 'save_post', 'generate_save_layout_meta_data' );
/**
* Saves the sidebar layout meta data.
*
* @since 2.0
*
* @param int Post ID.
*/
function generate_save_layout_meta_data( $post_id ) {
$is_autosave = wp_is_post_autosave( $post_id );
$is_revision = wp_is_post_revision( $post_id );
$is_valid_nonce = ( isset( $_POST['generate_layout_nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['generate_layout_nonce'] ), basename( __FILE__ ) ) ) ? true : false;
if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
return;
}
if ( ! current_user_can( 'edit_post', $post_id ) ) {
return $post_id;
}
$sidebar_layout_key = '_generate-sidebar-layout-meta';
$sidebar_layout_value = filter_input( INPUT_POST, $sidebar_layout_key, FILTER_SANITIZE_STRING );
if ( $sidebar_layout_value ) {
update_post_meta( $post_id, $sidebar_layout_key, $sidebar_layout_value );
} else {
delete_post_meta( $post_id, $sidebar_layout_key );
}
$footer_widget_key = '_generate-footer-widget-meta';
$footer_widget_value = filter_input( INPUT_POST, $footer_widget_key, FILTER_SANITIZE_STRING );
// Check for empty string to allow 0 as a value.
if ( '' !== $footer_widget_value ) {
update_post_meta( $post_id, $footer_widget_key, $footer_widget_value );
} else {
delete_post_meta( $post_id, $footer_widget_key );
}
$page_builder_container_key = '_generate-full-width-content';
$page_builder_container_value = filter_input( INPUT_POST, $page_builder_container_key, FILTER_SANITIZE_STRING );
if ( $page_builder_container_value ) {
update_post_meta( $post_id, $page_builder_container_key, $page_builder_container_value );
} else {
delete_post_meta( $post_id, $page_builder_container_key );
}
// 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 );
if ( $disable_content_title_value ) {
update_post_meta( $post_id, $disable_content_title_key, $disable_content_title_value );
} else {
delete_post_meta( $post_id, $disable_content_title_key );
}
}
do_action( 'generate_layout_meta_box_save', $post_id );
}

View File

@ -0,0 +1,341 @@
<?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

@ -0,0 +1,268 @@
<?php
/**
* Add compatibility for some popular third party plugins.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
add_action( 'after_setup_theme', 'generate_setup_woocommerce' );
/**
* Set up WooCommerce
*
* @since 1.3.47
*/
function generate_setup_woocommerce() {
if ( ! class_exists( 'WooCommerce' ) ) {
return;
}
// Add support for WC features.
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
// Remove default WooCommerce wrappers.
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
add_action( 'woocommerce_sidebar', 'generate_construct_sidebars' );
}
if ( ! function_exists( 'generate_woocommerce_start' ) ) {
add_action( 'woocommerce_before_main_content', 'generate_woocommerce_start', 10 );
/**
* Add WooCommerce starting wrappers
*
* @since 1.3.22
*/
function generate_woocommerce_start() {
?>
<div id="primary" <?php generate_do_element_classes( 'content' );?>>
<main id="main" <?php generate_do_element_classes( 'main' ); ?>>
<?php
/**
* generate_before_main_content hook.
*
* @since 0.1
*/
do_action( 'generate_before_main_content' );
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
<div class="inside-article">
<?php
/**
* generate_before_content hook.
*
* @since 0.1
*
* @hooked generate_featured_page_header_inside_single - 10
*/
do_action( 'generate_before_content' );
?>
<div class="entry-content" itemprop="text">
<?php
}
}
if ( ! function_exists( 'generate_woocommerce_end' ) ) {
add_action( 'woocommerce_after_main_content', 'generate_woocommerce_end', 10 );
/**
* Add WooCommerce ending wrappers
*
* @since 1.3.22
*/
function generate_woocommerce_end() {
?>
</div><!-- .entry-content -->
<?php
/**
* generate_after_content hook.
*
* @since 0.1
*/
do_action( 'generate_after_content' );
?>
</div><!-- .inside-article -->
</article><!-- #post-## -->
<?php
/**
* generate_after_main_content hook.
*
* @since 0.1
*/
do_action( 'generate_after_main_content' );
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
}
}
if ( ! function_exists( 'generate_woocommerce_css' ) ) {
add_action( 'wp_enqueue_scripts', 'generate_woocommerce_css', 100 );
/**
* Add WooCommerce CSS
*
* @since 1.3.45
*/
function generate_woocommerce_css() {
if ( ! class_exists( 'WooCommerce' ) ) {
return;
}
$mobile = generate_get_media_query( 'mobile' );
$css = '.woocommerce .page-header-image-single {
display: none;
}
.woocommerce .entry-content,
.woocommerce .product .entry-summary {
margin-top: 0;
}
.related.products {
clear: both;
}
.checkout-subscribe-prompt.clear {
visibility: visible;
height: initial;
width: initial;
}
@media ' . esc_attr( $mobile ) . ' {
.woocommerce .woocommerce-ordering,
.woocommerce-page .woocommerce-ordering {
float: none;
}
.woocommerce .woocommerce-ordering select {
max-width: 100%;
}
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product,
.woocommerce-page[class*=columns-] ul.products li.product,
.woocommerce[class*=columns-] ul.products li.product {
width: 100%;
float: none;
}
}';
$css = str_replace( array( "\r", "\n", "\t" ), '', $css );
wp_add_inline_style( 'woocommerce-general', $css );
}
}
if ( ! function_exists( 'generate_bbpress_css' ) ) {
add_action( 'wp_enqueue_scripts', 'generate_bbpress_css', 100 );
/**
* Add bbPress CSS
*
* @since 1.3.45
*/
function generate_bbpress_css() {
if ( ! class_exists( 'bbPress' ) ) {
return;
}
$css = '#bbpress-forums ul.bbp-lead-topic,
#bbpress-forums ul.bbp-topics,
#bbpress-forums ul.bbp-forums,
#bbpress-forums ul.bbp-replies,
#bbpress-forums ul.bbp-search-results,
#bbpress-forums,
div.bbp-breadcrumb,
div.bbp-topic-tags {
font-size: inherit;
}
.single-forum #subscription-toggle {
display: block;
margin: 1em 0;
clear: left;
}
#bbpress-forums .bbp-search-form {
margin-bottom: 10px;
}
.bbp-login-form fieldset {
border: 0;
padding: 0;
}';
$css = str_replace( array( "\r", "\n", "\t" ), '', $css );
wp_add_inline_style( 'bbp-default', $css );
}
}
if ( ! function_exists( 'generate_buddypress_css' ) ) {
add_action( 'wp_enqueue_scripts', 'generate_buddypress_css', 100 );
/**
* Add BuddyPress CSS
*
* @since 1.3.45
*/
function generate_buddypress_css() {
if ( ! class_exists( 'BuddyPress' ) ) {
return;
}
$css = '#buddypress form#whats-new-form #whats-new-options[style] {
min-height: 6rem;
overflow: visible;
}';
$css = str_replace( array( "\r", "\n", "\t" ), '', $css );
wp_add_inline_style( 'bp-legacy-css', $css );
}
}
if ( ! function_exists( 'generate_beaver_builder_css' ) ) {
add_action( 'wp_enqueue_scripts', 'generate_beaver_builder_css', 100 );
/**
* Add Beaver Builder CSS
*
* Beaver Builder pages set to no sidebar used to automatically be full width, however
* now that we have the Page Builder Container meta box, we want to give the user
* the option to set the page to full width or contained.
*
* We can't remove this CSS as people who are depending on it will lose their full
* width layout when they update.
*
* So instead, we only apply this CSS to posts older than the date of this update.
*
* @since 1.3.45
*/
function generate_beaver_builder_css() {
// 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() ) ) {
global $post;
if ( ! isset( $post ) ) {
return;
}
$compare_date = strtotime( '2017-03-14' );
$post_date = strtotime( $post->post_date );
if ( $post_date < $compare_date ) {
$css = '.fl-builder.no-sidebar .container.grid-container {
max-width: 100%;
}
.fl-builder.one-container.no-sidebar .site-content {
padding:0;
}';
$css = str_replace( array( "\r", "\n", "\t" ), '', $css );
wp_add_inline_style( 'generate-style', $css );
}
}
}
}

View File

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

View File

@ -0,0 +1,161 @@
<?php
/**
* Comment structure.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! function_exists( 'generate_comment' ) ) {
/**
* Template for comments and pingbacks.
*
* Used as a callback by wp_list_comments() for displaying the comments.
*/
function generate_comment( $comment, $args, $depth ) {
$args['avatar_size'] = apply_filters( 'generate_comment_avatar_size', 50 );
if ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) : ?>
<li id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
<div class="comment-body">
<?php _e( 'Pingback:', 'generatepress' ); // WPCS: XSS OK. ?> <?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' ); ?>>
<footer class="comment-meta">
<?php
if ( 0 != $args['avatar_size'] ) {
echo get_avatar( $comment, $args['avatar_size'] );
}
?>
<div class="comment-author-info">
<div class="comment-author vcard" <?php generate_do_microdata( 'comment-author' ); ?>>
<?php printf( '<cite itemprop="name" class="fn">%s</cite>', get_comment_author_link() ); ?>
</div><!-- .comment-author -->
<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()
); ?>
</time>
</a>
<?php edit_comment_link( __( 'Edit', 'generatepress' ), '<span class="edit-link">| ', '</span>' ); ?>
</div><!-- .comment-metadata -->
</div><!-- .comment-author-info -->
<?php if ( '0' == $comment->comment_approved ) : ?>
<p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'generatepress' ); // WPCS: XSS OK. ?></p>
<?php endif; ?>
</footer><!-- .comment-meta -->
<div class="comment-content" itemprop="text">
<?php
/**
* generate_before_comment_content hook.
*
* @since 2.4
*
*/
do_action( 'generate_before_comment_text', $comment, $args, $depth );
comment_text();
/**
* generate_after_comment_content hook.
*
* @since 2.4
*
*/
do_action( 'generate_after_comment_text', $comment, $args, $depth );
?>
</div><!-- .comment-content -->
</article><!-- .comment-body -->
<?php
endif;
}
}
add_action( 'generate_after_comment_text', 'generate_do_comment_reply_link', 10, 3 );
/**
* Add our comment reply link after the comment text.
*
* @since 2.4
*/
function generate_do_comment_reply_link( $comment, $args, $depth ) {
comment_reply_link( array_merge( $args, array(
'add_below' => 'div-comment',
'depth' => $depth,
'max_depth' => $args['max_depth'],
'before' => '<span class="reply">',
'after' => '</span>',
) ) );
}
add_filter( 'comment_form_defaults', 'generate_set_comment_form_defaults' );
/**
* Set the default settings for our comments.
*
* @since 2.3
*
* @param array $defaults
* @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>',
esc_html__( 'Comment', 'generatepress' )
);
$defaults['comment_notes_before'] = null;
$defaults['comment_notes_after'] = null;
$defaults['id_form'] = 'commentform';
$defaults['id_submit'] = 'submit';
$defaults['title_reply'] = apply_filters( 'generate_leave_comment', __( 'Leave a Comment', 'generatepress' ) );
$defaults['label_submit'] = apply_filters( 'generate_post_comment', __( 'Post Comment', 'generatepress' ) );
return $defaults;
}
add_filter( 'comment_form_default_fields', 'generate_filter_comment_fields' );
/**
* Customizes the existing comment fields.
*
* @since 2.1.2
* @param array $fields
* @return array
*/
function generate_filter_comment_fields( $fields ) {
$commenter = wp_get_current_commenter();
$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" />',
esc_html__( 'Name', 'generatepress' ),
esc_attr( $commenter['comment_author'] )
);
$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" />',
esc_html__( 'Email', 'generatepress' ),
esc_attr( $commenter['comment_author_email'] )
);
$fields['url'] = sprintf(
'<label for="url" class="screen-reader-text">%1$s</label><input placeholder="%1$s" id="url" name="url" type="url" value="%2$s" size="30" />',
esc_html__( 'Website', 'generatepress' ),
esc_attr( $commenter['comment_author_url'] )
);
return $fields;
}

View File

@ -0,0 +1,112 @@
<?php
/**
* Featured image elements.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! function_exists( 'generate_post_image' ) ) {
add_action( 'generate_after_entry_header', 'generate_post_image' );
/**
* Prints the Post Image to post excerpts
*/
function generate_post_image() {
// If there's no featured image, return.
if ( ! has_post_thumbnail() ) {
return;
}
// If we're not on any single post/page or the 404 template, we must be showing excerpts.
if ( ! is_singular() && ! is_404() ) {
echo apply_filters( 'generate_featured_image_output', sprintf( // WPCS: XSS ok.
'<div class="post-image">
%3$s
<a href="%1$s">
%2$s
</a>
</div>',
esc_url( get_permalink() ),
get_the_post_thumbnail(
get_the_ID(),
apply_filters( 'generate_page_header_default_size', 'full' ),
array(
'itemprop' => 'image',
)
),
apply_filters( 'generate_inside_featured_image_output', '' )
) );
}
}
}
if ( ! function_exists( 'generate_featured_page_header_area' ) ) {
/**
* Build the page header.
*
* @since 1.0.7
*
* @param string The featured image container class
*/
function generate_featured_page_header_area( $class ) {
// Don't run the function unless we're on a page it applies to.
if ( ! is_singular() ) {
return;
}
// Don't run the function unless we have a post thumbnail.
if ( ! has_post_thumbnail() ) {
return;
}
?>
<div class="<?php echo esc_attr( $class ); ?> grid-container grid-parent">
<?php the_post_thumbnail(
apply_filters( 'generate_page_header_default_size', 'full' ),
array(
'itemprop' => 'image',
)
); ?>
</div>
<?php
}
}
if ( ! function_exists( 'generate_featured_page_header' ) ) {
add_action( 'generate_after_header', 'generate_featured_page_header', 10 );
/**
* Add page header above content.
*
* @since 1.0.2
*/
function generate_featured_page_header() {
if ( function_exists( 'generate_page_header' ) ) {
return;
}
if ( is_page() ) {
generate_featured_page_header_area( 'page-header-image' );
}
}
}
if ( ! function_exists( 'generate_featured_page_header_inside_single' ) ) {
add_action( 'generate_before_content', 'generate_featured_page_header_inside_single', 10 );
/**
* Add post header inside content.
* Only add to single post.
*
* @since 1.0.7
*/
function generate_featured_page_header_inside_single() {
if ( function_exists( 'generate_page_header' ) ) {
return;
}
if ( is_single() ) {
generate_featured_page_header_area( 'page-header-image-single' );
}
}
}

View File

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

View File

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

View File

@ -0,0 +1,397 @@
<?php
/**
* Navigation elements.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! function_exists( 'generate_navigation_position' ) ) {
/**
* Build the navigation.
*
* @since 0.1
*/
function generate_navigation_position() {
?>
<nav id="site-navigation" <?php generate_do_element_classes( 'navigation' ); ?> <?php generate_do_microdata( 'navigation' ); ?>>
<div <?php generate_do_element_classes( 'inside_navigation' ); ?>>
<?php
/**
* generate_inside_navigation hook.
*
* @since 0.1
*
* @hooked generate_navigation_search - 10
* @hooked generate_mobile_menu_search_icon - 10
*/
do_action( 'generate_inside_navigation' );
?>
<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false">
<?php
/**
* generate_inside_mobile_menu hook.
*
* @since 0.1
*/
do_action( 'generate_inside_mobile_menu' );
generate_do_svg_icon( 'menu-bars', true );
$mobile_menu_label = apply_filters( 'generate_mobile_menu_label', __( 'Menu', 'generatepress' ) );
if ( $mobile_menu_label ) {
printf(
'<span class="mobile-menu">%s</span>',
$mobile_menu_label
);
} else {
printf(
'<span class="screen-reader-text">%s</span>',
__( 'Menu', 'generatepress' )
);
}
?>
</button>
<?php
wp_nav_menu(
array(
'theme_location' => 'primary',
'container' => 'div',
'container_class' => 'main-nav',
'container_id' => 'primary-menu',
'menu_class' => '',
'fallback_cb' => 'generate_menu_fallback',
'items_wrap' => '<ul id="%1$s" class="%2$s ' . join( ' ', generate_get_element_classes( 'menu' ) ) . '">%3$s</ul>',
)
);
/**
* generate_after_primary_menu hook.
*
* @since 2.3
*/
do_action( 'generate_after_primary_menu' );
?>
</div><!-- .inside-navigation -->
</nav><!-- #site-navigation -->
<?php
}
}
if ( ! function_exists( 'generate_menu_fallback' ) ) {
/**
* Menu fallback.
*
* @since 1.1.4
*
* @param array $args
* @return string
*/
function generate_menu_fallback( $args ) {
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
?>
<div id="primary-menu" class="main-nav">
<ul <?php generate_do_element_classes( 'menu' ); ?>>
<?php
$args = array(
'sort_column' => 'menu_order',
'title_li' => '',
'walker' => new Generate_Page_Walker(),
);
wp_list_pages( $args );
if ( 'enable' === $generate_settings['nav_search'] ) {
printf(
'<li class="search-item"><a aria-label="%1$s" href="#">%2$s</a></li>',
esc_attr__( 'Open Search Bar', 'generatepress' ),
generate_get_svg_icon( 'search', true )
);
}
?>
</ul>
</div><!-- .main-nav -->
<?php
}
}
/**
* Generate the navigation based on settings
*
* It would be better to have all of these inside one action, but these
* are kept this way to maintain backward compatibility for people
* un-hooking and moving the navigation/changing the priority.
*
* @since 0.1
*/
if ( ! function_exists( 'generate_add_navigation_after_header' ) ) {
add_action( 'generate_after_header', 'generate_add_navigation_after_header', 5 );
function generate_add_navigation_after_header() {
if ( 'nav-below-header' == generate_get_navigation_location() ) {
generate_navigation_position();
}
}
}
if ( ! function_exists( 'generate_add_navigation_before_header' ) ) {
add_action( 'generate_before_header', 'generate_add_navigation_before_header', 5 );
function generate_add_navigation_before_header() {
if ( 'nav-above-header' == generate_get_navigation_location() ) {
generate_navigation_position();
}
}
}
if ( ! function_exists( 'generate_add_navigation_float_right' ) ) {
add_action( 'generate_after_header_content', 'generate_add_navigation_float_right', 5 );
function generate_add_navigation_float_right() {
if ( 'nav-float-right' == generate_get_navigation_location() || 'nav-float-left' == generate_get_navigation_location() ) {
generate_navigation_position();
}
}
}
if ( ! function_exists( 'generate_add_navigation_before_right_sidebar' ) ) {
add_action( 'generate_before_right_sidebar_content', 'generate_add_navigation_before_right_sidebar', 5 );
function generate_add_navigation_before_right_sidebar() {
if ( 'nav-right-sidebar' == generate_get_navigation_location() ) {
echo '<div class="gen-sidebar-nav">';
generate_navigation_position();
echo '</div>';
}
}
}
if ( ! function_exists( 'generate_add_navigation_before_left_sidebar' ) ) {
add_action( 'generate_before_left_sidebar_content', 'generate_add_navigation_before_left_sidebar', 5 );
function generate_add_navigation_before_left_sidebar() {
if ( 'nav-left-sidebar' == generate_get_navigation_location() ) {
echo '<div class="gen-sidebar-nav">';
generate_navigation_position();
echo '</div>';
}
}
}
if ( ! class_exists( 'Generate_Page_Walker' ) && class_exists( 'Walker_Page' ) ) {
/**
* Add current-menu-item to the current item if no theme location is set
* This means we don't have to duplicate CSS properties for current_page_item and current-menu-item
*
* @since 1.3.21
*/
class Generate_Page_Walker extends Walker_Page {
function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) {
$css_class = array( 'page_item', 'page-item-' . $page->ID );
$button = '';
if ( isset( $args['pages_with_children'][ $page->ID ] ) ) {
$css_class[] = 'menu-item-has-children';
$icon = generate_get_svg_icon( 'arrow' );
$button = '<span role="presentation" class="dropdown-menu-toggle">' . $icon . '</span>';
}
if ( ! empty( $current_page ) ) {
$_current_page = get_post( $current_page );
if ( $_current_page && in_array( $page->ID, $_current_page->ancestors ) ) {
$css_class[] = 'current-menu-ancestor';
}
if ( $page->ID == $current_page ) {
$css_class[] = 'current-menu-item';
} elseif ( $_current_page && $page->ID == $_current_page->post_parent ) {
$css_class[] = 'current-menu-parent';
}
} elseif ( $page->ID == get_option( 'page_for_posts' ) ) {
$css_class[] = 'current-menu-parent';
}
$css_classes = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) );
$args['link_before'] = empty( $args['link_before'] ) ? '' : $args['link_before'];
$args['link_after'] = empty( $args['link_after'] ) ? '' : $args['link_after'];
$output .= sprintf(
'<li class="%s"><a href="%s">%s%s%s%s</a>',
$css_classes,
get_permalink( $page->ID ),
$args['link_before'],
apply_filters( 'the_title', $page->post_title, $page->ID ),
$args['link_after'],
$button
);
}
}
}
if ( ! function_exists( 'generate_dropdown_icon_to_menu_link' ) ) {
add_filter( 'nav_menu_item_title', 'generate_dropdown_icon_to_menu_link', 10, 4 );
/**
* Add dropdown icon if menu item has children.
*
* @since 1.3.42
*
* @param string $title The menu item title.
* @param WP_Post $item All of our menu item data.
* @param stdClass $args All of our menu item args.
* @param int $dept Depth of menu item.
* @return string The menu item.
*/
function generate_dropdown_icon_to_menu_link( $title, $item, $args, $depth ) {
$role = 'presentation';
$tabindex = '';
if ( 'click-arrow' === generate_get_option( 'nav_dropdown_type' ) ) {
$role = 'button';
$tabindex = ' tabindex="0"';
}
if ( isset( $args->container_class ) && 'main-nav' === $args->container_class ) {
foreach ( $item->classes as $value ) {
if ( 'menu-item-has-children' === $value ) {
$icon = generate_get_svg_icon( 'arrow' );
$title = $title . '<span role="' . $role . '" class="dropdown-menu-toggle"' . $tabindex . '>' . $icon . '</span>';
}
}
}
return $title;
}
}
if ( ! function_exists( 'generate_navigation_search' ) ) {
add_action( 'generate_inside_navigation', 'generate_navigation_search' );
/**
* Add the search bar to the navigation.
*
* @since 1.1.4
*/
function generate_navigation_search() {
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
if ( 'enable' !== $generate_settings['nav_search'] ) {
return;
}
echo apply_filters( 'generate_navigation_search_output', sprintf( // WPCS: XSS ok, sanitization ok.
'<form method="get" class="search-form navigation-search" action="%1$s">
<input type="search" class="search-field" value="%2$s" name="s" title="%3$s" />
</form>',
esc_url( home_url( '/' ) ),
esc_attr( get_search_query() ),
esc_attr_x( 'Search', 'label', 'generatepress' )
));
}
}
if ( ! function_exists( 'generate_menu_search_icon' ) ) {
add_filter( 'wp_nav_menu_items', 'generate_menu_search_icon', 10, 2 );
/**
* Add search icon to primary menu if set
*
* @since 1.2.9.7
*
* @param string $nav The HTML list content for the menu items.
* @param stdClass $args An object containing wp_nav_menu() arguments.
* @return string The search icon menu item.
*/
function generate_menu_search_icon( $nav, $args ) {
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
// If the search icon isn't enabled, return the regular nav.
if ( 'enable' !== $generate_settings['nav_search'] ) {
return $nav;
}
// If our primary menu is set, add the search icon.
if ( isset( $args->theme_location ) && 'primary' === $args->theme_location ) {
return sprintf(
'%1$s<li class="search-item"><a aria-label="%2$s" href="#">%3$s</a></li>',
$nav,
esc_attr__( 'Open Search Bar', 'generatepress' ),
generate_get_svg_icon( 'search', true )
);
}
// Our primary menu isn't set, return the regular nav.
// In this case, the search icon is added to the generate_menu_fallback() function in navigation.php.
return $nav;
}
}
if ( ! function_exists( 'generate_mobile_menu_search_icon' ) ) {
add_action( 'generate_inside_navigation', 'generate_mobile_menu_search_icon' );
/**
* Add search icon to mobile menu bar
*
* @since 1.3.12
*/
function generate_mobile_menu_search_icon() {
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
// If the search icon isn't enabled, return the regular nav.
if ( 'enable' !== $generate_settings['nav_search'] ) {
return;
}
?>
<div class="mobile-bar-items">
<?php do_action( 'generate_inside_mobile_menu_bar' ); ?>
<span class="search-item">
<a aria-label="<?php _e( 'Open Search Bar', 'generatepress' ); ?>" href="#">
<?php generate_do_svg_icon( 'search', true ); ?>
</a>
</span>
</div><!-- .mobile-bar-items -->
<?php
}
}
add_action( 'wp_footer', 'generate_clone_sidebar_navigation' );
/**
* Clone our sidebar navigation and place it below the header.
* This places our mobile menu in a more user-friendly location.
*
* We're not using wp_add_inline_script() as this needs to happens
* before menu.js is enqueued.
*
* @since 2.0
*/
function generate_clone_sidebar_navigation() {
if ( 'nav-left-sidebar' !== generate_get_navigation_location() && 'nav-right-sidebar' !== generate_get_navigation_location() ) {
return;
}
?>
<script>
var target, nav, clone;
nav = document.getElementById( 'site-navigation' );
if ( nav ) {
clone = nav.cloneNode( true );
clone.className += ' sidebar-nav-mobile';
clone.setAttribute( 'aria-label', '<?php esc_attr_e( 'Mobile Menu', 'generatepress' ); ?>' );
target = document.getElementById( 'masthead' );
if ( target ) {
target.insertAdjacentHTML( 'afterend', clone.outerHTML );
} else {
document.body.insertAdjacentHTML( 'afterbegin', clone.outerHTML )
}
}
</script>
<?php
}

View File

@ -0,0 +1,388 @@
<?php
/**
* Post meta elements.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! function_exists( 'generate_content_nav' ) ) {
/**
* Display navigation to next/previous pages when applicable.
*
* @since 0.1
*
* @param string $nav_id The id of our navigation.
*/
function generate_content_nav( $nav_id ) {
if ( ! apply_filters( 'generate_show_post_navigation', true ) ) {
return;
}
global $wp_query, $post;
// Don't print empty markup on single pages if there's nowhere to navigate.
if ( is_single() ) {
$previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true );
$next = get_adjacent_post( false, '', false );
if ( ! $next && ! $previous ) {
return;
}
}
// Don't print empty markup in archives if there's only one page.
if ( $wp_query->max_num_pages < 2 && ( is_home() || is_archive() || is_search() ) ) {
return;
}
$nav_class = ( is_single() ) ? 'post-navigation' : 'paging-navigation';
?>
<nav id="<?php echo esc_attr( $nav_id ); ?>" class="<?php echo esc_attr( $nav_class ); ?>">
<span class="screen-reader-text"><?php esc_html_e( 'Post navigation', 'generatepress' ); ?></span>
<?php if ( is_single() ) : // navigation links for single posts.
$post_navigation_args = apply_filters( 'generate_post_navigation_args', array(
'previous_format' => '<div class="nav-previous">' . generate_get_svg_icon( 'arrow' ) . '<span class="prev" title="' . esc_attr__( 'Previous', 'generatepress' ) . '">%link</span></div>',
'next_format' => '<div class="nav-next">' . generate_get_svg_icon( 'arrow' ) . '<span class="next" title="' . esc_attr__( 'Next', 'generatepress' ) . '">%link</span></div>',
'link' => '%title',
'in_same_term' => apply_filters( 'generate_category_post_navigation', false ),
'excluded_terms' => '',
'taxonomy' => 'category',
) );
previous_post_link(
$post_navigation_args['previous_format'],
$post_navigation_args['link'],
$post_navigation_args['in_same_term'],
$post_navigation_args['excluded_terms'],
$post_navigation_args['taxonomy']
);
next_post_link(
$post_navigation_args['next_format'],
$post_navigation_args['link'],
$post_navigation_args['in_same_term'],
$post_navigation_args['excluded_terms'],
$post_navigation_args['taxonomy']
);
elseif ( is_home() || is_archive() || is_search() ) : // navigation links for home, archive, and search pages.
if ( get_next_posts_link() ) : ?>
<div class="nav-previous">
<?php generate_do_svg_icon( 'arrow' ); ?>
<span class="prev" title="<?php esc_attr_e( 'Previous', 'generatepress' );?>"><?php next_posts_link( __( 'Older posts', 'generatepress' ) ); ?></span>
</div>
<?php endif;
if ( get_previous_posts_link() ) : ?>
<div class="nav-next">
<?php generate_do_svg_icon( 'arrow' ); ?>
<span class="next" title="<?php esc_attr_e( 'Next', 'generatepress' );?>"><?php previous_posts_link( __( 'Newer posts', 'generatepress' ) ); ?></span>
</div>
<?php endif;
if ( function_exists( 'the_posts_pagination' ) ) {
the_posts_pagination( array(
'mid_size' => apply_filters( 'generate_pagination_mid_size', 1 ),
'prev_text' => apply_filters( 'generate_previous_link_text', __( '&larr; Previous', 'generatepress' ) ),
'next_text' => apply_filters( 'generate_next_link_text', __( 'Next &rarr;', 'generatepress' ) ),
) );
}
/**
* generate_paging_navigation hook.
*
* @since 0.1
*/
do_action( 'generate_paging_navigation' );
endif; ?>
</nav><!-- #<?php echo esc_html( $nav_id ); ?> -->
<?php
}
}
if ( ! function_exists( 'generate_modify_posts_pagination_template' ) ) {
add_filter( 'navigation_markup_template', 'generate_modify_posts_pagination_template', 10, 2 );
/**
* Remove the container and screen reader text from the_posts_pagination()
* We add this in ourselves in generate_content_nav()
*
* @since 1.3.45
*
* @param string $template The default template.
* @param string $class The class passed by the calling function.
* @return string The HTML for the post navigation.
*/
function generate_modify_posts_pagination_template( $template, $class ) {
if ( ! empty( $class ) && false !== strpos( $class, 'pagination' ) ) {
$template = '<div class="nav-links">%3$s</div>';
}
return $template;
}
}
/**
* Output requested post meta.
*
* @since 2.3
*
* @param string $item The post meta item we're requesting
* @return The requested HTML.
*/
function generate_do_post_meta_item( $item ) {
if ( 'date' === $item ) {
$date = apply_filters( 'generate_post_date', true );
$time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '<time class="updated" datetime="%3$s" itemprop="dateModified">%4$s</time>' . $time_string;
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);
// If our date is enabled, show it.
if ( $date ) {
echo apply_filters( 'generate_post_date_output',
sprintf( // WPCS: XSS ok, sanitization ok.
'<span class="posted-on">%1$s<a href="%2$s" title="%3$s" rel="bookmark">%4$s</a></span> ',
apply_filters( 'generate_inside_post_meta_item_output', '', 'date' ),
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
$time_string
),
$time_string );
}
}
if ( 'author' === $item ) {
$author = apply_filters( 'generate_post_author', true );
if ( $author ) {
echo apply_filters( 'generate_post_author_output',
sprintf( '<span class="byline">%1$s<span class="author vcard" %5$s><a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span></span> ',
apply_filters( 'generate_inside_post_meta_item_output', '', 'author' ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
/* translators: 1: Author name */
esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ),
esc_html( get_the_author() ),
generate_get_microdata( 'post-author' )
)
);
}
}
if ( 'categories' === $item ) {
$categories = apply_filters( 'generate_show_categories', true );
$term_separator = apply_filters( 'generate_term_separator', _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ), 'categories' );
$categories_list = get_the_category_list( $term_separator );
if ( $categories_list && $categories ) {
echo apply_filters( 'generate_category_list_output',
sprintf( '<span class="cat-links">%3$s<span class="screen-reader-text">%1$s </span>%2$s</span> ', // WPCS: XSS ok, sanitization ok.
esc_html_x( 'Categories', 'Used before category names.', 'generatepress' ),
$categories_list,
apply_filters( 'generate_inside_post_meta_item_output', '', 'categories' )
)
);
}
}
if ( 'tags' === $item ) {
$tags = apply_filters( 'generate_show_tags', true );
$term_separator = apply_filters( 'generate_term_separator', _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ), 'tags' );
$tags_list = get_the_tag_list( '', $term_separator );
if ( $tags_list && $tags ) {
echo apply_filters( 'generate_tag_list_output',
sprintf( '<span class="tags-links">%3$s<span class="screen-reader-text">%1$s </span>%2$s</span> ', // WPCS: XSS ok, sanitization ok.
esc_html_x( 'Tags', 'Used before tag names.', 'generatepress' ),
$tags_list,
apply_filters( 'generate_inside_post_meta_item_output', '', 'tags' )
)
);
}
}
if ( 'comments-link' === $item ) {
$comments = apply_filters( 'generate_show_comments', true );
if ( $comments && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '<span class="comments-link">';
echo apply_filters( 'generate_inside_post_meta_item_output', '', 'comments-link' );
comments_popup_link( __( 'Leave a comment', 'generatepress' ), __( '1 Comment', 'generatepress' ), __( '% Comments', 'generatepress' ) );
echo '</span> ';
}
}
/**
* generate_post_meta_items hook.
*
* @since 2.4
*/
do_action( 'generate_post_meta_items', $item );
}
add_filter( 'generate_inside_post_meta_item_output', 'generate_do_post_meta_prefix', 10, 2 );
/**
* Add svg icons or text to our post meta output.
*
* @since 2.4
*/
function generate_do_post_meta_prefix( $output, $item ) {
if ( 'author' === $item ) {
$output = __( 'by', 'generatepress' ) . ' ';
}
if ( 'categories' === $item ) {
$output = generate_get_svg_icon( 'categories' );
}
if ( 'tags' === $item ) {
$output = generate_get_svg_icon( 'tags' );
}
if ( 'comments-link' === $item ) {
$output = generate_get_svg_icon( 'comments' );
}
return $output;
}
if ( ! function_exists( 'generate_posted_on' ) ) {
/**
* Prints HTML with meta information for the current post-date/time and author.
*
* @since 0.1
*/
function generate_posted_on() {
$items = apply_filters( 'generate_header_entry_meta_items', array(
'date',
'author',
) );
foreach ( $items as $item ) {
generate_do_post_meta_item( $item );
}
}
}
if ( ! function_exists( 'generate_entry_meta' ) ) {
/**
* Prints HTML with meta information for the categories, tags.
*
* @since 1.2.5
*/
function generate_entry_meta() {
$items = apply_filters( 'generate_footer_entry_meta_items', array(
'categories',
'tags',
'comments-link',
) );
foreach ( $items as $item ) {
generate_do_post_meta_item( $item );
}
}
}
if ( ! function_exists( 'generate_excerpt_more' ) ) {
add_filter( 'excerpt_more', 'generate_excerpt_more' );
/**
* Prints the read more HTML to post excerpts.
*
* @since 0.1
*
* @param string $more The string shown within the more link.
* @return string The HTML for the more link.
*/
function generate_excerpt_more( $more ) {
return apply_filters( 'generate_excerpt_more_output', sprintf( ' ... <a title="%1$s" class="read-more" href="%2$s">%3$s %4$s</a>',
the_title_attribute( 'echo=0' ),
esc_url( get_permalink( get_the_ID() ) ),
__( 'Read more', 'generatepress' ),
'<span class="screen-reader-text">' . get_the_title() . '</span>'
) );
}
}
if ( ! function_exists( 'generate_content_more' ) ) {
add_filter( 'the_content_more_link', 'generate_content_more' );
/**
* Prints the read more HTML to post content using the more tag.
*
* @since 0.1
*
* @param string $more The string shown within the more link.
* @return string The HTML for the more link
*/
function generate_content_more( $more ) {
return apply_filters( 'generate_content_more_link_output', sprintf( '<p class="read-more-container"><a title="%1$s" class="read-more content-read-more" href="%2$s">%3$s%4$s</a></p>',
the_title_attribute( 'echo=0' ),
esc_url( get_permalink( get_the_ID() ) . apply_filters( 'generate_more_jump','#more-' . get_the_ID() ) ),
__( 'Read more', 'generatepress' ),
'<span class="screen-reader-text">' . get_the_title() . '</span>'
) );
}
}
if ( ! function_exists( 'generate_post_meta' ) ) {
add_action( 'generate_after_entry_title', 'generate_post_meta' );
/**
* Build the post meta.
*
* @since 1.3.29
*/
function generate_post_meta() {
$post_types = apply_filters( 'generate_entry_meta_post_types', array(
'post',
) );
if ( in_array( get_post_type(), $post_types ) ) : ?>
<div class="entry-meta">
<?php generate_posted_on(); ?>
</div><!-- .entry-meta -->
<?php endif;
}
}
if ( ! function_exists( 'generate_footer_meta' ) ) {
add_action( 'generate_after_entry_content', 'generate_footer_meta' );
/**
* Build the footer post meta.
*
* @since 1.3.30
*/
function generate_footer_meta() {
$post_types = apply_filters( 'generate_footer_meta_post_types', array(
'post',
) );
if ( in_array( get_post_type(), $post_types ) ) : ?>
<footer class="entry-meta">
<?php
generate_entry_meta();
if ( is_single() ) {
generate_content_nav( 'nav-below' );
}
?>
</footer><!-- .entry-meta -->
<?php endif;
}
}

View File

@ -0,0 +1,83 @@
<?php
/**
* Build the sidebars.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! function_exists( 'generate_construct_sidebars' ) ) {
/**
* Construct the sidebars.
*
* @since 0.1
*/
function generate_construct_sidebars() {
$layout = generate_get_layout();
// When to show the right sidebar.
$rs = array( 'right-sidebar', 'both-sidebars', 'both-right', 'both-left' );
// When to show the left sidebar.
$ls = array( 'left-sidebar', 'both-sidebars', 'both-right', 'both-left' );
// If left sidebar, show it.
if ( in_array( $layout, $ls ) ) {
get_sidebar( 'left' );
}
// If right sidebar, show it.
if ( in_array( $layout, $rs ) ) {
get_sidebar();
}
}
/**
* The below hook was removed in 2.0, but we'll keep the call here so child themes
* don't lose their sidebar when they update the theme.
*/
add_action( 'generate_sidebars', 'generate_construct_sidebars' );
}
/**
* Show sidebar widgets if no widgets are added to the sidebar area.
*
* @since 2.2
*
* @param string $area Left or right sidebar.
*/
function generate_do_default_sidebar_widgets( $area ) {
if ( 'nav-' . $area === generate_get_navigation_location() ) {
return;
}
if ( function_exists( 'generate_secondary_nav_get_defaults' ) ) {
$secondary_nav = wp_parse_args(
get_option( 'generate_secondary_nav_settings', array() ),
generate_secondary_nav_get_defaults()
);
if ( 'secondary-nav-' . $area === $secondary_nav['secondary_nav_position_setting'] ) {
return;
}
}
if ( ! apply_filters( 'generate_show_default_sidebar_widgets', true ) ) {
return;
}
?>
<aside id="search" class="widget widget_search">
<?php get_search_form(); ?>
</aside>
<aside id="archives" class="widget">
<h2 class="widget-title"><?php esc_html_e( 'Archives', 'generatepress' ); ?></h2>
<ul>
<?php wp_get_archives( array( 'type' => 'monthly' ) ); ?>
</ul>
</aside>
<?php
}

View File

@ -0,0 +1,343 @@
<?php
/**
* Main theme functions.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* A wrapper function to get our options.
*
* @since 2.2
*
* @param string $option The option name to look up.
* @return string The option value.
*/
function generate_get_option( $option ) {
$defaults = generate_get_defaults();
if ( ! isset( $defaults[ $option ] ) ) {
return;
}
$options = wp_parse_args(
get_option( 'generate_settings', array() ),
$defaults
);
return $options[ $option ];
}
if ( ! function_exists( 'generate_get_layout' ) ) {
/**
* Get the layout for the current page.
*
* @since 0.1
*
* @return string The sidebar layout location.
*/
function generate_get_layout() {
$layout = generate_get_option( 'layout_setting' );
if ( is_single() ) {
$layout = generate_get_option( 'single_layout_setting' );
}
if ( is_singular() ) {
$layout_meta = get_post_meta( get_the_ID(), '_generate-sidebar-layout-meta', true );
if ( $layout_meta ) {
$layout = $layout_meta;
}
}
if ( is_home() || is_archive() || is_search() || is_tax() ) {
$layout = generate_get_option( 'blog_layout_setting' );
}
return apply_filters( 'generate_sidebar_layout', $layout );
}
}
if ( ! function_exists( 'generate_get_footer_widgets' ) ) {
/**
* Get the footer widgets for the current page
*
* @since 0.1
*
* @return int The number of footer widgets.
*/
function generate_get_footer_widgets() {
$widgets = generate_get_option( 'footer_widget_setting' );
if ( is_singular() ) {
$widgets_meta = get_post_meta( get_the_ID(), '_generate-footer-widget-meta', true );
if ( $widgets_meta || '0' === $widgets_meta ) {
$widgets = $widgets_meta;
}
}
return apply_filters( 'generate_footer_widgets', $widgets );
}
}
if ( ! function_exists( 'generate_show_excerpt' ) ) {
/**
* Figure out if we should show the blog excerpts or full posts
* @since 1.3.15
*/
function generate_show_excerpt() {
global $post;
// Check to see if the more tag is being used.
$more_tag = apply_filters( 'generate_more_tag', strpos( $post->post_content, '<!--more-->' ) );
$format = ( false !== get_post_format() ) ? get_post_format() : 'standard';
$show_excerpt = ( 'excerpt' === generate_get_option( 'post_content' ) ) ? true : false;
$show_excerpt = ( 'standard' !== $format ) ? false : $show_excerpt;
$show_excerpt = ( $more_tag ) ? false : $show_excerpt;
$show_excerpt = ( is_search() ) ? true : $show_excerpt;
return apply_filters( 'generate_show_excerpt', $show_excerpt );
}
}
if ( ! function_exists( 'generate_show_title' ) ) {
/**
* Check to see if we should show our page/post title or not.
*
* @since 1.3.18
*
* @return bool Whether to show the content title.
*/
function generate_show_title() {
return apply_filters( 'generate_show_title', true );
}
}
if ( ! function_exists( 'generate_get_premium_url' ) ) {
/**
* Generate a URL to our premium add-ons.
* Allows the use of a referral ID and campaign.
*
* @since 1.3.42
*
* @param string $url URL to premium page.
* @param bool $trailing_slash Whether we want to include a trailing slash.
* @return string The URL to generatepress.com.
*/
function generate_get_premium_url( $url = 'https://generatepress.com/premium', $trailing_slash = true ) {
if ( $trailing_slash ) {
$url = trailingslashit( $url );
}
$args = apply_filters( 'generate_premium_url_args', array(
'ref' => null,
'campaign' => null,
) );
if ( isset( $args['ref'] ) ) {
$url = add_query_arg( 'ref', absint( $args['ref'] ), $url );
}
if ( isset( $args['campaign'] ) ) {
$url = add_query_arg( 'campaign', sanitize_text_field( $args['campaign'] ), $url );
}
return esc_url( $url );
}
}
if ( ! function_exists( 'generate_padding_css' ) ) {
/**
* Shorten our padding/margin values into shorthand form.
*
* @since 0.1
*
* @param int $top Top spacing.
* @param int $right Right spacing.
* @param int $bottom Bottom spacing.
* @param int $left Left spacing.
* @return string Element spacing values.
*/
function generate_padding_css( $top, $right, $bottom, $left ) {
$padding_top = ( isset( $top ) && '' !== $top ) ? absint( $top ) . 'px ' : '0px ';
$padding_right = ( isset( $right ) && '' !== $right ) ? absint( $right ) . 'px ' : '0px ';
$padding_bottom = ( isset( $bottom ) && '' !== $bottom ) ? absint( $bottom ) . 'px ' : '0px ';
$padding_left = ( isset( $left ) && '' !== $left ) ? absint( $left ) . 'px' : '0px';
if ( ( absint( $padding_top ) === absint( $padding_right ) ) && ( absint( $padding_right ) === absint( $padding_bottom ) ) && ( absint( $padding_bottom ) === absint( $padding_left ) ) ) {
return $padding_left;
}
return $padding_top . $padding_right . $padding_bottom . $padding_left;
}
}
if ( ! function_exists( 'generate_get_link_url' ) ) {
/**
* Return the post URL.
*
* Falls back to the post permalink if no URL is found in the post.
*
* @since 1.2.5
*
* @see get_url_in_content()
* @return string The Link format URL.
*/
function generate_get_link_url() {
$has_url = get_url_in_content( get_the_content() );
return $has_url ? $has_url : apply_filters( 'the_permalink', get_permalink() );
}
}
if ( ! function_exists( 'generate_get_navigation_location' ) ) {
/**
* Get the location of the navigation and filter it.
*
* @since 1.3.41
*
* @return string The primary menu location.
*/
function generate_get_navigation_location() {
return apply_filters( 'generate_navigation_location', generate_get_option( 'nav_position_setting' ) );
}
}
/**
* Check if the logo and site branding are active.
*
* @since 2.3
*/
function generate_has_logo_site_branding() {
if ( get_theme_mod( 'custom_logo' ) && ( ! generate_get_option( 'hide_title' ) || ! generate_get_option( 'hide_tagline' ) ) ) {
return true;
}
return false;
}
/**
* Create SVG icons.
*
* @since 2.3
*/
function generate_get_svg_icon( $icon, $replace = false ) {
if ( 'svg' !== generate_get_option( 'icons' ) ) {
return;
}
$output = '';
if ( 'menu-bars' === $icon ) {
$output = '<svg viewBox="0 0 512 512" aria-hidden="true" role="img" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1em" height="1em">
<path d="M0 96c0-13.255 10.745-24 24-24h464c13.255 0 24 10.745 24 24s-10.745 24-24 24H24c-13.255 0-24-10.745-24-24zm0 160c0-13.255 10.745-24 24-24h464c13.255 0 24 10.745 24 24s-10.745 24-24 24H24c-13.255 0-24-10.745-24-24zm0 160c0-13.255 10.745-24 24-24h464c13.255 0 24 10.745 24 24s-10.745 24-24 24H24c-13.255 0-24-10.745-24-24z" />
</svg>';
}
if ( 'close' === $icon ) {
$output = '<svg viewBox="0 0 512 512" aria-hidden="true" role="img" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1em" height="1em">
<path d="M71.029 71.029c9.373-9.372 24.569-9.372 33.942 0L256 222.059l151.029-151.03c9.373-9.372 24.569-9.372 33.942 0 9.372 9.373 9.372 24.569 0 33.942L289.941 256l151.03 151.029c9.372 9.373 9.372 24.569 0 33.942-9.373 9.372-24.569 9.372-33.942 0L256 289.941l-151.029 151.03c-9.373 9.372-24.569 9.372-33.942 0-9.372-9.373-9.372-24.569 0-33.942L222.059 256 71.029 104.971c-9.372-9.373-9.372-24.569 0-33.942z" />
</svg>';
}
if ( 'search' === $icon ) {
$output = '<svg viewBox="0 0 512 512" aria-hidden="true" role="img" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1em" height="1em">
<path fill-rule="evenodd" clip-rule="evenodd" d="M208 48c-88.366 0-160 71.634-160 160s71.634 160 160 160 160-71.634 160-160S296.366 48 208 48zM0 208C0 93.125 93.125 0 208 0s208 93.125 208 208c0 48.741-16.765 93.566-44.843 129.024l133.826 134.018c9.366 9.379 9.355 24.575-.025 33.941-9.379 9.366-24.575 9.355-33.941-.025L337.238 370.987C301.747 399.167 256.839 416 208 416 93.125 416 0 322.875 0 208z"/>
</svg>';
}
if ( 'categories' === $icon ) {
$output = '<svg viewBox="0 0 512 512" aria-hidden="true" role="img" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1em" height="1em">
<path d="M0 112c0-26.51 21.49-48 48-48h110.014a48 48 0 0 1 43.592 27.907l12.349 26.791A16 16 0 0 0 228.486 128H464c26.51 0 48 21.49 48 48v224c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V112z" fill-rule="nonzero"/>
</svg>';
}
if ( 'tags' === $icon ) {
$output = '<svg viewBox="0 0 512 512" aria-hidden="true" role="img" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1em" height="1em">
<path d="M20 39.5c-8.836 0-16 7.163-16 16v176c0 4.243 1.686 8.313 4.687 11.314l224 224c6.248 6.248 16.378 6.248 22.626 0l176-176c6.244-6.244 6.25-16.364.013-22.615l-223.5-224A15.999 15.999 0 0 0 196.5 39.5H20zm56 96c0-13.255 10.745-24 24-24s24 10.745 24 24-10.745 24-24 24-24-10.745-24-24z"/>
<path d="M259.515 43.015c4.686-4.687 12.284-4.687 16.97 0l228 228c4.686 4.686 4.686 12.284 0 16.97l-180 180c-4.686 4.687-12.284 4.687-16.97 0-4.686-4.686-4.686-12.284 0-16.97L479.029 279.5 259.515 59.985c-4.686-4.686-4.686-12.284 0-16.97z" fill-rule="nonzero"/>
</svg>';
}
if ( 'comments' === $icon ) {
$output = '<svg viewBox="0 0 512 512" aria-hidden="true" role="img" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1em" height="1em">
<path d="M132.838 329.973a435.298 435.298 0 0 0 16.769-9.004c13.363-7.574 26.587-16.142 37.419-25.507 7.544.597 15.27.925 23.098.925 54.905 0 105.634-15.311 143.285-41.28 23.728-16.365 43.115-37.692 54.155-62.645 54.739 22.205 91.498 63.272 91.498 110.286 0 42.186-29.558 79.498-75.09 102.828 23.46 49.216 75.09 101.709 75.09 101.709s-115.837-38.35-154.424-78.46c-9.956 1.12-20.297 1.758-30.793 1.758-88.727 0-162.927-43.071-181.007-100.61z" fill-rule="nonzero"/>
<path d="M383.371 132.502c0 70.603-82.961 127.787-185.216 127.787-10.496 0-20.837-.639-30.793-1.757-38.587 40.093-154.424 78.429-154.424 78.429s51.63-52.472 75.09-101.67c-45.532-23.321-75.09-60.619-75.09-102.79C12.938 61.9 95.9 4.716 198.155 4.716 300.41 4.715 383.37 61.9 383.37 132.502z" fill-rule="nonzero" />
</svg>';
}
if ( 'arrow' === $icon ) {
$output = '<svg viewBox="0 0 330 512" aria-hidden="true" role="img" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1em" height="1em">
<path d="M305.913 197.085c0 2.266-1.133 4.815-2.833 6.514L171.087 335.593c-1.7 1.7-4.249 2.832-6.515 2.832s-4.815-1.133-6.515-2.832L26.064 203.599c-1.7-1.7-2.832-4.248-2.832-6.514s1.132-4.816 2.832-6.515l14.162-14.163c1.7-1.699 3.966-2.832 6.515-2.832 2.266 0 4.815 1.133 6.515 2.832l111.316 111.317 111.316-111.317c1.7-1.699 4.249-2.832 6.515-2.832s4.815 1.133 6.515 2.832l14.162 14.163c1.7 1.7 2.833 4.249 2.833 6.515z" fill-rule="nonzero"/>
</svg>';
}
if ( $replace ) {
$output .= '<svg viewBox="0 0 512 512" aria-hidden="true" role="img" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1em" height="1em">
<path d="M71.029 71.029c9.373-9.372 24.569-9.372 33.942 0L256 222.059l151.029-151.03c9.373-9.372 24.569-9.372 33.942 0 9.372 9.373 9.372 24.569 0 33.942L289.941 256l151.03 151.029c9.372 9.373 9.372 24.569 0 33.942-9.373 9.372-24.569 9.372-33.942 0L256 289.941l-151.029 151.03c-9.373 9.372-24.569 9.372-33.942 0-9.372-9.373-9.372-24.569 0-33.942L222.059 256 71.029 104.971c-9.372-9.373-9.372-24.569 0-33.942z" />
</svg>';
}
$output = apply_filters( 'generate_svg_icon_element', $output, $icon );
$classes = array(
'gp-icon',
'icon-' . $icon,
);
$output = sprintf(
'<span class="%1$s">%2$s</span>',
implode( ' ', $classes ),
$output
);
return apply_filters( 'generate_svg_icon', $output, $icon );
}
/**
* Out our icon HTML.
*
* @since 2.3
*
* @param string $icon
* @param bool $replace Whether to include the close icon to be shown using JS.
* @return string
*/
function generate_do_svg_icon( $icon, $replace = false ) {
echo generate_get_svg_icon( $icon, $replace );
}
/**
* Get our media queries.
*
* @since 2.4
*
* @param string $name
* @return string The full media query.
*/
function generate_get_media_query( $name ) {
$desktop = apply_filters( 'generate_desktop_media_query', '(min-width:1025px)' );
$tablet = apply_filters( 'generate_tablet_media_query', '(min-width: 769px) and (max-width: 1024px)' );
$mobile = apply_filters( 'generate_mobile_media_query', '(max-width:768px)' );
$mobile_menu = apply_filters( 'generate_mobile_menu_media_query', $mobile );
$queries = apply_filters( 'generate_media_queries', array(
'desktop' => $desktop,
'tablet' => $tablet,
'mobile' => $mobile,
'mobile-menu' => $mobile_menu,
) );
return $queries[ $name ];
}

File diff suppressed because one or more lines are too long

View File

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

View File

@ -0,0 +1,137 @@
/**
* File skip-link-focus-fix.js.
*
* Helps with accessibility for keyboard only users.
*
* Learn more: https://git.io/vWdr2
*/
( function() {
var isIe = /(trident|msie)/i.test( navigator.userAgent );
if ( isIe && document.getElementById && window.addEventListener ) {
window.addEventListener( 'hashchange', function() {
var id = location.hash.substring( 1 ),
element;
if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) {
return;
}
element = document.getElementById( id );
if ( element ) {
if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) {
element.tabIndex = -1;
}
element.focus();
}
}, 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' );
} );
}
} )();
( function() {
'use strict';
if ( 'querySelector' in document && 'addEventListener' in window && document.body.classList.contains( 'dropdown-hover' ) ) {
var navLinks = document.querySelectorAll( 'nav .main-nav ul 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() ) {
if ( -1 !== self.className.indexOf( 'sfHover' ) ) {
self.className = self.className.replace( ' sfHover', '' );
} else {
self.className += ' sfHover';
}
}
self = self.parentElement;
}
}
for ( var i = 0; i < navLinks.length; i++ ) {
navLinks[i].addEventListener( 'focus', toggleFocus );
navLinks[i].addEventListener( 'blur', toggleFocus );
}
}
/**
* 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();
}
// Close other sub-menus
var openedSubMenus = this.closest( 'nav' ).querySelectorAll( 'ul.toggled-on' );
if ( openedSubMenus && ! this.closest( 'ul' ).classList.contains( 'toggled-on' ) && ! this.closest( 'li' ).classList.contains( 'sfHover' ) ) {
for ( var o = 0; o < openedSubMenus.length; o++ ) {
openedSubMenus[o].classList.remove( 'toggled-on' );
openedSubMenus[o].closest( 'li' ).classList.remove( 'sfHover' );
}
}
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 @@
/(trident|msie)/i.test(navigator.userAgent)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",function(){var e,t=location.hash.substring(1);/^[A-z0-9_-]+$/.test(t)&&(e=document.getElementById(t))&&(/^(?:a|select|input|button|textarea)$/i.test(e.tagName)||(e.tabIndex=-1),e.focus())},!1),function(){"use strict";if("querySelector"in document&&"addEventListener"in window){var e=document.body;e.addEventListener("mousedown",function(){e.classList.add("using-mouse")}),e.addEventListener("keydown",function(){e.classList.remove("using-mouse")})}}(),function(){"use strict";if("querySelector"in document&&"addEventListener"in window&&document.body.classList.contains("dropdown-hover"))for(var e=document.querySelectorAll("nav .main-nav ul a"),t=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()&&(-1!==e.className.indexOf("sfHover")?e.className=e.className.replace(" sfHover",""):e.className+=" sfHover"),e=e.parentElement},s=0;s<e.length;s++)e[s].addEventListener("focus",t),e[s].addEventListener("blur",t);if("ontouchend"in document.documentElement&&document.body.classList.contains("dropdown-hover")){var n=document.querySelectorAll(".sf-menu .menu-item-has-children");for(s=0;s<n.length;s++)n[s].addEventListener("touchend",function(e){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();var t=this.closest("nav").querySelectorAll("ul.toggled-on");if(t&&!this.closest("ul").classList.contains("toggled-on")&&!this.closest("li").classList.contains("sfHover"))for(var s=0;s<t.length;s++)t[s].classList.remove("toggled-on"),t[s].closest("li").classList.remove("sfHover");this.classList.add("sfHover");var n,o=this;document.addEventListener("touchend",n=function(e){e.stopPropagation(),o.classList.remove("sfHover"),document.removeEventListener("touchend",n)})}})}}();

View File

@ -0,0 +1,97 @@
jQuery( document ).ready( function( $ ) {
var container_width_elements = 'body .wp-block,\
html body.gutenberg-editor-page .editor-post-title__block,\
html body.gutenberg-editor-page .editor-default-block-appender,\
html body.gutenberg-editor-page .editor-block-list__block,\
.edit-post-visual-editor .editor-block-list__block[data-align=wide]';
$( 'input[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>' );
} else {
$( 'style#container_width' ).remove();
}
} );
$( 'input[name="_generate-sidebar-layout-meta"]' ).on( 'change', function() {
if ( 'true' !== $( 'input[name="_generate-full-width-content"]:checked' ).val() ) {
var this_value = this.value,
content_width = '',
calc = '',
container_width = generate_block_editor.container_width,
right_sidebar_width = generate_block_editor.right_sidebar_width,
left_sidebar_width = generate_block_editor.left_sidebar_width,
right_content_padding = generate_block_editor.content_padding_right,
left_content_padding = generate_block_editor.content_padding_left;
if ( '' === this_value ) {
this_value = generate_block_editor.global_sidebar_layout;
}
if ( 'left-sidebar' == this_value ) {
content_width = container_width * ( ( 100 - left_sidebar_width ) / 100 );
} else if ( 'right-sidebar' == this_value ) {
content_width = container_width * ( ( 100 - right_sidebar_width ) / 100 );
} else if ( 'no-sidebar' == this_value ) {
content_width = container_width;
} else {
content_width = container_width * ( ( 100 - ( Number( left_sidebar_width ) + Number( right_sidebar_width ) ) ) / 100 );
}
calc = 'max-width: calc(' + content_width + 'px - ' + right_content_padding + ' - ' + left_content_padding + ')';
$( 'style#content-width' ).remove();
$( 'head' ).append( '<style id="content-width">' + container_width_elements + '{' + calc + '}</style>' );
$( 'style#wide-width' ).remove();
$( 'head' ).append( '<style id="wide-width">.edit-post-visual-editor .editor-block-list__block[data-align=wide]{max-width:' + content_width + 'px}' );
}
} );
var disable_content_title_input = $( '#meta-generate-disable-headline' );
var disable_content_title_button = $( 'button.content-title-visibility' );
var body = $( 'body' );
if ( 'false' === generate_block_editor.content_title ) {
body.addClass( 'content-title-hidden' );
}
disable_content_title_input.on( 'change', function() {
if ( this.checked ) {
body.addClass( 'content-title-hidden' );
} else {
body.removeClass( 'content-title-hidden' );
}
} );
$( document ).on( 'click', 'button.content-title-visibility', function() {
var _this = $( this );
if ( disable_content_title_input.prop( 'checked' ) ) {
disable_content_title_input.prop( 'checked', false );
body.removeClass( 'content-title-hidden' );
} else {
disable_content_title_input.prop( 'checked', true );
body.addClass( 'content-title-hidden' );
}
} );
if ( generate_block_editor.show_editor_styles ) {
var text_color = tinycolor( generate_block_editor.text_color ).toHex8(),
isTextDark = tinycolor( text_color ).isDark();
if ( ! isTextDark ) {
$( 'body' ).addClass( 'is-dark-theme' );
}
}
} );
jQuery( window ).load( function() {
var post_title_block = jQuery( '.editor-post-title__block' );
if ( post_title_block ) {
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>' );
}
} );

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -0,0 +1 @@
!function(){"use strict";if("querySelector"in document&&"addEventListener"in window){var t=document.querySelector(".generate-back-to-top");t&&(window.addEventListener("scroll",function(){var e=window.pageYOffset,i=t.getAttribute("data-start-scroll");e>i&&(t.style.opacity="1",t.style.visibility="visible"),e<i&&(t.style.opacity="0",t.style.visibility="hidden")}),t.addEventListener("click",function(e){e.preventDefault(),function(t,e){var i,n=window.pageYOffset,o=document.body.offsetTop,r=(o-n)/(e/16);i=function(){window.pageYOffset<=(o||0)&&clearInterval(a)};var a=setInterval(function(){window.scrollBy(0,r),i()},16)}(document.body,t.getAttribute("data-scroll-speed")||400)},!1))}}();

View File

@ -0,0 +1,240 @@
/*
* classList.js: Cross-browser full element.classList implementation.
* 1.1.20170427
*
* By Eli Grey, http://eligrey.com
* License: Dedicated to the public domain.
* See https://github.com/eligrey/classList.js/blob/master/LICENSE.md
*/
/*global self, document, DOMException */
/*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js */
if ("document" in self) {
// Full polyfill for browsers with no classList support
// Including IE < Edge missing SVGElement.classList
if (!("classList" in document.createElement("_"))
|| document.createElementNS && !("classList" in document.createElementNS("http://www.w3.org/2000/svg","g"))) {
(function (view) {
"use strict";
if (!('Element' in view)) return;
var
classListProp = "classList"
, protoProp = "prototype"
, elemCtrProto = view.Element[protoProp]
, objCtr = Object
, strTrim = String[protoProp].trim || function () {
return this.replace(/^\s+|\s+$/g, "");
}
, arrIndexOf = Array[protoProp].indexOf || function (item) {
var
i = 0
, len = this.length
;
for (; i < len; i++) {
if (i in this && this[i] === item) {
return i;
}
}
return -1;
}
// Vendors: please allow content code to instantiate DOMExceptions
, DOMEx = function (type, message) {
this.name = type;
this.code = DOMException[type];
this.message = message;
}
, checkTokenAndGetIndex = function (classList, token) {
if (token === "") {
throw new DOMEx(
"SYNTAX_ERR"
, "An invalid or illegal string was specified"
);
}
if (/\s/.test(token)) {
throw new DOMEx(
"INVALID_CHARACTER_ERR"
, "String contains an invalid character"
);
}
return arrIndexOf.call(classList, token);
}
, ClassList = function (elem) {
var
trimmedClasses = strTrim.call(elem.getAttribute("class") || "")
, classes = trimmedClasses ? trimmedClasses.split(/\s+/) : []
, i = 0
, len = classes.length
;
for (; i < len; i++) {
this.push(classes[i]);
}
this._updateClassName = function () {
elem.setAttribute("class", this.toString());
};
}
, classListProto = ClassList[protoProp] = []
, classListGetter = function () {
return new ClassList(this);
}
;
// Most DOMException implementations don't allow calling DOMException's toString()
// on non-DOMExceptions. Error's toString() is sufficient here.
DOMEx[protoProp] = Error[protoProp];
classListProto.item = function (i) {
return this[i] || null;
};
classListProto.contains = function (token) {
token += "";
return checkTokenAndGetIndex(this, token) !== -1;
};
classListProto.add = function () {
var
tokens = arguments
, i = 0
, l = tokens.length
, token
, updated = false
;
do {
token = tokens[i] + "";
if (checkTokenAndGetIndex(this, token) === -1) {
this.push(token);
updated = true;
}
}
while (++i < l);
if (updated) {
this._updateClassName();
}
};
classListProto.remove = function () {
var
tokens = arguments
, i = 0
, l = tokens.length
, token
, updated = false
, index
;
do {
token = tokens[i] + "";
index = checkTokenAndGetIndex(this, token);
while (index !== -1) {
this.splice(index, 1);
updated = true;
index = checkTokenAndGetIndex(this, token);
}
}
while (++i < l);
if (updated) {
this._updateClassName();
}
};
classListProto.toggle = function (token, force) {
token += "";
var
result = this.contains(token)
, method = result ?
force !== true && "remove"
:
force !== false && "add"
;
if (method) {
this[method](token);
}
if (force === true || force === false) {
return force;
} else {
return !result;
}
};
classListProto.toString = function () {
return this.join(" ");
};
if (objCtr.defineProperty) {
var classListPropDesc = {
get: classListGetter
, enumerable: true
, configurable: true
};
try {
objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
} catch (ex) { // IE 8 doesn't support enumerable:true
// adding undefined to fight this issue https://github.com/eligrey/classList.js/issues/36
// modernie IE8-MSW7 machine has IE8 8.0.6001.18702 and is affected
if (ex.number === undefined || ex.number === -0x7FF5EC54) {
classListPropDesc.enumerable = false;
objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
}
}
} else if (objCtr[protoProp].__defineGetter__) {
elemCtrProto.__defineGetter__(classListProp, classListGetter);
}
}(self));
}
// There is full or partial native classList support, so just check if we need
// to normalize the add/remove and toggle APIs.
(function () {
"use strict";
var testElement = document.createElement("_");
testElement.classList.add("c1", "c2");
// Polyfill for IE 10/11 and Firefox <26, where classList.add and
// classList.remove exist but support only one argument at a time.
if (!testElement.classList.contains("c2")) {
var createMethod = function(method) {
var original = DOMTokenList.prototype[method];
DOMTokenList.prototype[method] = function(token) {
var i, len = arguments.length;
for (i = 0; i < len; i++) {
token = arguments[i];
original.call(this, token);
}
};
};
createMethod('add');
createMethod('remove');
}
testElement.classList.toggle("c3", false);
// Polyfill for IE 10 and Firefox <24, where classList.toggle does not
// support the second argument.
if (testElement.classList.contains("c3")) {
var _toggle = DOMTokenList.prototype.toggle;
DOMTokenList.prototype.toggle = function(token, force) {
if (1 in arguments && !this.contains(token) === !force) {
return force;
} else {
return _toggle.call(this, token);
}
};
}
testElement = null;
}());
}

View File

@ -0,0 +1,2 @@
/*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js */
"document"in self&&("classList"in document.createElement("_")&&(!document.createElementNS||"classList"in document.createElementNS("http://www.w3.org/2000/svg","g"))||!function(t){"use strict";if("Element"in t){var e="classList",n="prototype",i=t.Element[n],s=Object,r=String[n].trim||function(){return this.replace(/^\s+|\s+$/g,"")},o=Array[n].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},a=function(t,e){this.name=t,this.code=DOMException[t],this.message=e},c=function(t,e){if(""===e)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(e))throw new a("INVALID_CHARACTER_ERR","String contains an invalid character");return o.call(t,e)},l=function(t){for(var e=r.call(t.getAttribute("class")||""),n=e?e.split(/\s+/):[],i=0,s=n.length;s>i;i++)this.push(n[i]);this._updateClassName=function(){t.setAttribute("class",""+this)}},u=l[n]=[],h=function(){return new l(this)};if(a[n]=Error[n],u.item=function(t){return this[t]||null},u.contains=function(t){return t+="",-1!==c(this,t)},u.add=function(){var t,e=arguments,n=0,i=e.length,s=!1;do t=e[n]+"",-1===c(this,t)&&(this.push(t),s=!0);while(++n<i);s&&this._updateClassName()},u.remove=function(){var t,e,n=arguments,i=0,s=n.length,r=!1;do for(t=n[i]+"",e=c(this,t);-1!==e;)this.splice(e,1),r=!0,e=c(this,t);while(++i<s);r&&this._updateClassName()},u.toggle=function(t,e){t+="";var n=this.contains(t),i=n?e!==!0&&"remove":e!==!1&&"add";return i&&this[i](t),e===!0||e===!1?e:!n},u.toString=function(){return this.join(" ")},s.defineProperty){var f={get:h,enumerable:!0,configurable:!0};try{s.defineProperty(i,e,f)}catch(g){(void 0===g.number||-2146823252===g.number)&&(f.enumerable=!1,s.defineProperty(i,e,f))}}else s[n].__defineGetter__&&i.__defineGetter__(e,h)}}(self),function(){"use strict";var t=document.createElement("_");if(t.classList.add("c1","c2"),!t.classList.contains("c2")){var e=function(t){var e=DOMTokenList.prototype[t];DOMTokenList.prototype[t]=function(t){var n,i=arguments.length;for(n=0;i>n;n++)t=arguments[n],e.call(this,t)}};e("add"),e("remove")}if(t.classList.toggle("c3",!1),t.classList.contains("c3")){var n=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(t,e){return 1 in arguments&&!this.contains(t)==!e?e:n.call(this,t)}}t=null}());

View File

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

View File

@ -0,0 +1 @@
!function(){"use strict";if("querySelector"in document&&"addEventListener"in window){var c=document.body,t=function(e,t){if(e.preventDefault(),e.stopPropagation(),!t)t=this;var n=t.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=n.querySelector(".dropdown-menu-toggle");if("false"!==r.getAttribute("aria-expanded")&&r.getAttribute("aria-expanded")?r.setAttribute("aria-expanded","false"):r.setAttribute("aria-expanded","true"),n.querySelector(".sub-menu"))var i=".sub-menu";else i=".children";c.classList.contains("dropdown-click-menu-item")?t.parentNode.querySelector(i).classList.toggle("toggled-on"):c.classList.contains("dropdown-click-arrow")&&n.querySelector(i).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");var o=document.querySelectorAll(".main-nav .menu-item-has-children > a .dropdown-menu-toggle");for(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,219 @@
( 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 allNavToggles = document.querySelectorAll( '.menu-toggle' ),
dropdownToggle = document.querySelectorAll( 'nav .dropdown-menu-toggle' ),
navLinks = document.querySelectorAll( 'nav ul a' ),
body = document.body,
htmlEl = document.documentElement;
/**
* Start mobile menu toggle.
*
* @param e The event.
* @param _this The clicked item.
*/
var toggleNav = function( e, _this ) {
if ( ! _this ) {
var _this = this;
}
if ( _this.getAttribute( 'data-nav' ) ) {
var parentContainer = document.getElementById( _this.getAttribute( 'data-nav' ) );
} else {
var parentContainer = document.getElementById( _this.closest( 'nav' ).getAttribute( 'id' ) );
}
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 ( 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' );
}
}
} else {
parentContainer.classList.add( 'toggled' );
htmlEl.classList.add( 'mobile-menu-open' );
nav.setAttribute( 'aria-hidden', 'false' );
_this.setAttribute( 'aria-expanded', 'true' );
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' );
}
}
}
}
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' );
var dropdownToggle = closestLi.querySelector( '.dropdown-menu-toggle' );
if ( 'false' === dropdownToggle.getAttribute( 'aria-expanded' ) || ! dropdownToggle.getAttribute( 'aria-expanded' ) ) {
dropdownToggle.setAttribute( 'aria-expanded', 'true' );
} else {
dropdownToggle.setAttribute( 'aria-expanded', 'false' );
}
if ( closestLi.querySelector( '.sub-menu' ) ) {
var subMenu = closestLi.querySelector( '.sub-menu' );
} else {
var subMenu = closestLi.querySelector( '.children' );
}
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() {
for ( var i = 0; i < allNavToggles.length; i++ ) {
if ( allNavToggles[i].offsetParent === null ) {
var closestParent = allNavToggles[i].closest( 'nav' );
if ( closestParent && closestParent.classList.contains( 'toggled' ) ) {
var closestNav = closestParent.getElementsByTagName( 'ul' )[0];
var closestNavItems = closestNav.getElementsByTagName( 'li' );
var closestSubMenus = closestNav.getElementsByTagName( 'ul' );
document.activeElement.blur();
closestParent.classList.remove( 'toggled' );
htmlEl.classList.remove( 'mobile-menu-open' );
allNavToggles[i].setAttribute( 'aria-expanded', 'false' );
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' );
}
if ( body.classList.contains( 'dropdown-hover' ) ) {
var dropdownItems = closestParent.querySelectorAll( 'li.menu-item-has-children' );
for ( var d = 0; d < dropdownItems.length; d++ ) {
dropdownItems[d].querySelector( '.dropdown-menu-toggle' ).removeAttribute( 'tabindex' );
dropdownItems[d].querySelector( '.dropdown-menu-toggle' ).setAttribute( 'role', 'presentation' );
dropdownItems[d].querySelector( '.dropdown-menu-toggle' ).removeAttribute( 'aria-expanded' );
}
}
}
}
}
}
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 );
}
}
}
})();

View File

@ -0,0 +1 @@
!function(){"use strict";if("querySelector"in document&&"addEventListener"in window){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;if(!document.documentElement.contains(this))return null;do{if(t.matches(e))return t;t=t.parentElement}while(null!==t);return null});for(var d=document.querySelectorAll(".menu-toggle"),e=document.querySelectorAll("nav .dropdown-menu-toggle"),t=document.querySelectorAll("nav ul a"),c=document.body,u=document.documentElement,o=function(e,t){if(!t)t=this;if(t.getAttribute("data-nav"))var o=document.getElementById(t.getAttribute("data-nav"));else o=document.getElementById(t.closest("nav").getAttribute("id"));var n=o.getElementsByTagName("ul")[0];if(o.classList.contains("toggled")){if(o.classList.remove("toggled"),u.classList.remove("mobile-menu-open"),n.setAttribute("aria-hidden","true"),t.setAttribute("aria-expanded","false"),c.classList.contains("dropdown-hover"))for(var r=n.querySelectorAll("li.menu-item-has-children"),l=0;l<r.length;l++)r[l].querySelector(".dropdown-menu-toggle").removeAttribute("tabindex"),r[l].querySelector(".dropdown-menu-toggle").setAttribute("role","presentation"),r[l].querySelector(".dropdown-menu-toggle").removeAttribute("aria-expanded")}else if(o.classList.add("toggled"),u.classList.add("mobile-menu-open"),n.setAttribute("aria-hidden","false"),t.setAttribute("aria-expanded","true"),c.classList.contains("dropdown-hover"))for(r=n.querySelectorAll("li.menu-item-has-children"),l=0;l<r.length;l++)r[l].querySelector(".dropdown-menu-toggle").setAttribute("tabindex","0"),r[l].querySelector(".dropdown-menu-toggle").setAttribute("role","button"),r[l].querySelector(".dropdown-menu-toggle").setAttribute("aria-expanded","false")},n=0;n<d.length;n++)d[n].addEventListener("click",o,!1);var r=function(e,t){if(!t)t=this;if((t.closest("nav").classList.contains("toggled")||u.classList.contains("slide-opened"))&&!c.classList.contains("dropdown-click")){e.preventDefault();var o=t.closest("li"),n=o.querySelector(".dropdown-menu-toggle");if("false"!==n.getAttribute("aria-expanded")&&n.getAttribute("aria-expanded")?n.setAttribute("aria-expanded","false"):n.setAttribute("aria-expanded","true"),o.querySelector(".sub-menu"))var r=o.querySelector(".sub-menu");else r=o.querySelector(".children");o.classList.toggle("sfHover"),r.classList.toggle("toggled-on")}e.stopPropagation()};for(n=0;n<e.length;n++)e[n].addEventListener("click",r,!1),e[n].addEventListener("keypress",function(e){13===(e.which||e.keyCode)&&r(e,this)},!1);var l=function(){for(var e=0;e<d.length;e++)if(null===d[e].offsetParent){var t=d[e].closest("nav");if(t&&t.classList.contains("toggled")){var o=t.getElementsByTagName("ul")[0],n=o.getElementsByTagName("li"),r=o.getElementsByTagName("ul");document.activeElement.blur(),t.classList.remove("toggled"),u.classList.remove("mobile-menu-open"),d[e].setAttribute("aria-expanded","false");for(var l=0;l<n.length;l++)n[l].classList.remove("sfHover");for(var s=0;s<r.length;s++)r[s].classList.remove("toggled-on");if(o&&o.removeAttribute("aria-hidden"),c.classList.contains("dropdown-hover"))for(var i=t.querySelectorAll("li.menu-item-has-children"),a=0;a<i.length;a++)i[a].querySelector(".dropdown-menu-toggle").removeAttribute("tabindex"),i[a].querySelector(".dropdown-menu-toggle").setAttribute("role","presentation"),i[a].querySelector(".dropdown-menu-toggle").removeAttribute("aria-expanded")}}};if(window.addEventListener("resize",l,!1),window.addEventListener("orientationchange",l,!1),c.classList.contains("dropdown-hover"))for(n=0;n<t.length;n++)t[n].addEventListener("click",function(e){if(this.hostname!==window.location.hostname&&document.activeElement.blur(),this.closest("nav").classList.contains("toggled")||u.classList.contains("slide-opened")){var t=this.getAttribute("href");if("#"==t||""==t){e.preventDefault();var o=this.closest("li");o.classList.toggle("sfHover");var n=o.querySelector(".sub-menu");n&&n.classList.toggle("toggled-on")}}},!1)}}();

View File

@ -0,0 +1,113 @@
( 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 nav = item.closest( 'nav' ),
link = item.querySelector( 'a' );
if ( item.getAttribute( 'data-nav' ) ) {
nav = document.querySelector( this.getAttribute( 'data-nav' ) );
}
var form = nav.querySelector( '.navigation-search' );
var focusableEls = document.querySelectorAll('a[href], area[href], input:not([disabled]):not(.navigation-search), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]');
if ( form.classList.contains( 'nav-search-active' ) ) {
item.classList.remove( 'close-search' );
item.classList.remove( 'active' );
document.activeElement.blur();
item.classList.remove( 'sfHover' );
form.classList.remove( 'nav-search-active' );
link.setAttribute( 'aria-label', generatepressNavSearch.open );
item.style.float = '';
// Allow tabindex on items again.
for ( var i = 0; i < focusableEls.length; i++ ) {
if ( ! focusableEls[i].closest( '.navigation-search' ) && ! focusableEls[i].closest( '.search-item' ) ) {
focusableEls[i].removeAttribute( 'tabindex' );
}
};
} else {
item.classList.add( 'active' );
form.classList.add( 'nav-search-active' );
link.setAttribute( 'aria-label', generatepressNavSearch.close );
form.querySelector( '.search-field' ).focus();
// Trap tabindex within the search element
for ( var i = 0; i < focusableEls.length; i++ ) {
if ( ! focusableEls[i].closest( '.navigation-search' ) && ! focusableEls[i].closest( '.search-item' ) ) {
focusableEls[i].setAttribute( 'tabindex', '-1' );
}
};
// Set a delay to stop conflict with toggleFocus() in a11y.js
setTimeout( function() {
item.classList.add( 'sfHover' );
}, 50 );
if ( ! document.body.classList.contains( 'nav-aligned-center' ) ) {
item.classList.add( 'close-search' );
} else {
item.style.opacity = 0;
setTimeout( function() {
item.classList.add( 'close-search' );
item.style.opacity = 1;
if ( document.body.classList.contains ( 'rtl' ) ) {
item.style.float = 'left';
} else {
item.style.float = 'right';
}
}, 250 );
}
}
}
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 click elsewhere
document.addEventListener( 'click', function ( event ) {
if ( document.querySelector( '.navigation-search.nav-search-active' ) ) {
if ( ! event.target.closest( '.navigation-search' ) && ! event.target.closest( '.search-item' ) ) {
var activeSearchItems = document.querySelectorAll( '.search-item.active' );
for ( var i = 0; i < activeSearchItems.length; i++ ) {
toggleSearch( event, activeSearchItems[i] );
}
}
}
}, 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] );
}
}
}
}, false );
}
}
})();

View File

@ -0,0 +1 @@
!function(){"use strict";if("querySelector"in document&&"addEventListener"in window){var s=function(e,t){if(e.preventDefault(),!t)t=this;var a=t.closest("nav"),s=t.querySelector("a");t.getAttribute("data-nav")&&(a=document.querySelector(this.getAttribute("data-nav")));var c=a.querySelector(".navigation-search"),i=document.querySelectorAll('a[href], area[href], input:not([disabled]):not(.navigation-search), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]');if(c.classList.contains("nav-search-active")){t.classList.remove("close-search"),t.classList.remove("active"),document.activeElement.blur(),t.classList.remove("sfHover"),c.classList.remove("nav-search-active"),s.setAttribute("aria-label",generatepressNavSearch.open),t.style.float="";for(var r=0;r<i.length;r++)i[r].closest(".navigation-search")||i[r].closest(".search-item")||i[r].removeAttribute("tabindex")}else{t.classList.add("active"),c.classList.add("nav-search-active"),s.setAttribute("aria-label",generatepressNavSearch.close),c.querySelector(".search-field").focus();for(r=0;r<i.length;r++)i[r].closest(".navigation-search")||i[r].closest(".search-item")||i[r].setAttribute("tabindex","-1");setTimeout(function(){t.classList.add("sfHover")},50),document.body.classList.contains("nav-aligned-center")?(t.style.opacity=0,setTimeout(function(){t.classList.add("close-search"),t.style.opacity=1,document.body.classList.contains("rtl")?t.style.float="left":t.style.float="right"},250)):t.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("click",function(e){if(document.querySelector(".navigation-search.nav-search-active")&&!e.target.closest(".navigation-search")&&!e.target.closest(".search-item"))for(var t=document.querySelectorAll(".search-item.active"),a=0;a<t.length;a++)s(e,t[a])},!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])},!1)}}}();

View File

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

View File

@ -0,0 +1,72 @@
<?php
/**
* The template for displaying all pages.
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
get_header(); ?>
<div id="primary" <?php generate_do_element_classes( 'content' ); ?>>
<main id="main" <?php generate_do_element_classes( 'main' ); ?>>
<?php
/**
* generate_before_main_content hook.
*
* @since 0.1
*/
do_action( 'generate_before_main_content' );
while ( have_posts() ) : the_post();
get_template_part( 'content', 'page' );
// If comments are open or we have at least one comment, load up the comment template.
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;
endwhile;
/**
* generate_after_main_content hook.
*
* @since 0.1
*/
do_action( 'generate_after_main_content' );
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
/**
* generate_after_primary_content_area hook.
*
* @since 2.0
*/
do_action( 'generate_after_primary_content_area' );
generate_construct_sidebars();
get_footer();

View File

@ -0,0 +1,450 @@
=== GeneratePress ===
Contributors: edge22
Donate link: https://generatepress.com/ongoing-development/
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: two-columns, three-columns, one-column, right-sidebar, left-sidebar, footer-widgets, blog, e-commerce, flexible-header, full-width-template, buddypress, custom-header, custom-background, custom-menu, custom-colors, sticky-post, threaded-comments, translation-ready, rtl-language-support, featured-images, theme-options
Requires at least: 4.5
Tested up to: 5.4
Stable tag: 2.4.2
GeneratePress is a lightweight WordPress theme built with a focus on speed and usability.
== Description ==
GeneratePress is a lightweight WordPress theme built with a focus on speed and usability. Performance is important to us, which is why a fresh GeneratePress install adds less than 15kb (gzipped) to your page size.
We take full advantage of the new block editor (Gutenberg), which gives you more control over creating your content.
If you use page builders, GeneratePress is the right theme for you. It is completely compatible with all major page builders, including Beaver Builder and Elementor.
Thanks to our emphasis on WordPress coding standards, we can boast full compatibility with all well-coded plugins, including WooCommerce.
GeneratePress is fully responsive, uses valid HTML/CSS and is translated into over 25 languages by our amazing community of users.
A few of our many features include microdata integration, 9 widget areas, 5 navigation locations, 5 sidebar layouts, dropdown menus (click or hover) and navigation color presets.
Learn more and check out our [powerful premium version](https://generatepress.com).
== Installation ==
= From within WordPress =
1. Visit "Appearance > Themes > Add New"
1. Search for "GeneratePress"
1. Install and activate
== Frequently Asked Questions ==
= Is GeneratePress Free? =
Yes! GeneratePress is a free theme, and always will be.
= Does GeneratePress have a pro version? =
It does! GeneratePress has a premium plugin which extends the available options in the theme.
You can learn more about GP Premium [here](https://generatepress.com/premium).
= Where can I find documentation? =
GeneratePress has extensive documentation you can find [here](https://docs.generatepress.com).
= Do you offer support? =
Definitely. We offer support for the free theme in the [WordPress.org forums](https://wordpress.org/support/theme/generatepress).
Premium customers have access to our very own [support forum](https://generatepress.com/support).
We try to answer all questions - free or premium - within 24 hours.
= Where can I find the theme options? =
All of our options can be found in the Customizer in 'Appearance > Customize'.
= Does GeneratePress have any widget areas? =
GeneratePress has up to 9 widget areas which you can add widgets to in Appearance > Widgets.
= How can I make my site look like your screenshot? =
If you want to replicate the screenshot you see on WordPress.org, please refer to [this article](https://docs.generatepress.com/article/replicating-the-screenshot/).
== License ==
GeneratePress is licensed under the GNU General Public License v2 or later
More details [here](http://www.gnu.org/licenses/gpl-2.0.html).
= Unsemantic Framework =
http://opensource.org/licenses/mit-license.php
http://www.gnu.org/licenses/gpl.html
= Font Awesome =
Font License: SIL OFL 1.1 - http://scripts.sil.org/OFL
Code License: MIT License - http://opensource.org/licenses/mit-license.html
= classList =
By Eli Grey, http://eligrey.com
License: Dedicated to the public domain.
See https://github.com/eligrey/classList.js/blob/master/LICENSE.md
= selectWoo =
MIT License: https://github.com/woocommerce/selectWoo/blob/master/LICENSE.md
= TinyColor =
By Brian Grinstead, http://briangrinstead.com
MIT License: https://github.com/bgrins/TinyColor/blob/master/LICENSE
== Changelog ==
= 2.4.2 =
Release date: March 17, 2020
* Fix: Block editor classes changed in WordPress 5.4
* Fix: More specific heading selectors in block editor
= 2.4.1 =
Release date: November 26, 2019
* Tweak: Use mobile content padding in Group block on mobile
* Fix: Captions in the block editor
= 2.4.0 =
Release date: November 20, 2019
* New: generate_inside_site_container hook
* New: generate_before_comments_container hook to pages
* New: generate_after_comment_text hook
* New: generate_after_comment_text hook
* New: generate_inside_featured_image_output filter
* New: generate_inside_post_meta_item_output filter
* New: generate_term_separator filter
* New: generate_svg_icon_element filter
* New: generate_before_page_title hook
* New: generate_after_page_title hook
* New: generate_media_queries filter
* New: generate_post_navigation_args filter
* New: aria-label added to navigation search button (a11y)
* New: Add support for navigation search colors
* New: Apply container width to group block inner container
* Tweak: Allow for custom post meta items
* Tweak: Add screen reader text to mobile menu button if no text exists (a11y)
* Tweak: Move comment reply link to below comment text
* Tweak: Remove margin from .blocks-gallery-grid class
* Tweak: Clean up rtl.css
* Tweak: Get all Google fonts only once in Customizer
* Tweak: Set variable with get_template_directory() in functions.php
* Tweak: Remove comments link on single posts using CSS only
* Tweak: Add line-height to headings in block editor
* Tweak: Use featured image alt instead of post title (a11y)
* Tweak: Add space between read more and screen reader text (a11y)
* Tweak: Improve Customizer control styling
* Tweak: Hide comments link on single posts using CSS only
* Tweak: Increase space between mobile menu icon + text when using SVG
* Tweak: Use default block editor color palette
* Fix: Sidebar spacing in rtl.css
* Fix: Inability to set "Default" as sidebar layout in Gutenberg
= 2.3.2 =
Release date: June 25, 2019
* Fix: Don't include font icon requests in cached CSS
= 2.3.1 =
Release date: June 25, 2019
* Fix: Touch issue with sub-menus using "Click - Menu Item" option
= 2.3 =
Release date: June 18, 2019
* New: Add SVG icon option
* New: Add option to inline the logo and site branding
* New: Add combine CSS option
* New: Add container alignment option
* New: Add generate_header_entry_meta_items filter for defining/ordering header entry meta
* New: Add generate_footer_entry_meta_items filter for defining/ordering footer entry meta
* New: Add generate_header_items_order filter to order header elements
* New: Add wp_body_open hook
* New: Add generate_after_primary_menu hook
* New: Add generate_mobile_menu_media_query filter
* New: Add generate_after_loop hook
* New: Add generate_show_block_editor_styles filter
* New: Add generate_google_font_display filter
* New: Add support for future mobile separating space option
* Tweak: Remove footer widget placeholders
* Tweak: Properly filter comment_form() defaults
* Tweak: Check for container_class variable existence
* Tweak: Align header to center on mobile even if aligned right
* Tweak: Check for option existence in generate_get_option()
* Tweak: Simplify separate container margin CSS
* Tweak: Make navLinks a11y selector more specific
* Tweak: Hook archive description in so it can be moved
* Tweak: Set X-UA-Compatible in wp_headers filter
* Tweak: Move Layout metabox to the sidebar by default
* Tweak: Use generate_not_mobile_menu_media_query filter in nav drop point
* Tweak: Target headings in blocks not necessarily in core heading block
* Tweak: Increase tap targets of entry meta on mobile
* Tweak: Remove negative margin from align-wide/full items when they're first block
* Fix: generate_search_label filter
* Fix: Sub-menu direction in right sidebar
* Fix: Heading selector in block editor
* Fix: Sub-menu dropdown on tablets/touch screens
* Fix: Sub-menu dropdown click issue when no menu location is set
= 2.2.2 =
Release date: January 30, 2019
* New: Add support for responsive embeds (videos etc..)
* Fix: Background/text color conflict in block editor if content background is using rgba
* Fix: Remove aria-expanded attribute from menu dropdown arrows when no menu is set
* Fix: Notice in block editor when h5 font size is set
* Fix: Notice if right/left content padding values are non-numeric
* Fix: Microdata spelling of WPSideBar
* Fix: Align-full alignment issue in block editor when Gutenberg plugin is active
* Fix: Shortcode block label text color when using light text
* Fix: Content title color in Gutenberg while in code editor
= 2.2.1 =
Release date: November 21, 2018
* Fix: Change h4-h6 margin-bottom back to 20px
* Fix: Prevent content link option from applying to block editor button
* Tweak: Change dropdown menu arrow role when no menu is set
* Tweak: Replace last generate_get_setting() instance with generate_get_option()
= 2.2 =
Release date: November 19, 2018
* New: Sub-menu direction option
* New: Floated navigation drop point option
* New: Logo width option
* New: Content title color option
* New: Blog post title color option
* New: H1-H3 typography options
* New: generate_comment_form_title filter
* New: Header Presets control inside the Customizer
* New: Navigation Color Presets control inside the Customizer
* New: generate_entry_meta_post_types filter
* New: generate_footer_meta_posts_types filter
* New: Add paragraph bottom margin to Gutenberg blocks
* New: Add .alignwide and .alignfull class for Gutenberg blocks
* New: Styling for Gutenberg gallery block
* New: Add frontend styling to Gutenberg editor
* New: Add defaults for H1-H3 bottom margin options
* New: generate_show_default_sidebar_widgets filter
* New: generate_schema_type filter
* New: generate_{context}_microdata filters
* Tweak: Output theme microdata using generate_do_microdata()
* Tweak: Replace individual element class functions with generate_do_element_classes()
* Tweak: Major PHP code cleanup
* Tweak: Replace generate_get_setting() with generate_get_option()
* Tweak: Remove default text-align: left from site header
* Tweak: Only add navigation alignment class to body if necessary
* Tweak: Major style.css cleanup
* Tweak: Remove different sub-menu width if in sidebar
* Tweak: Set navigation search height (fixes full height nav search on mobile/in sidebars)
* Tweak: Change Delete Customizer Settings button text to Reset
* Tweak: Add quick Customize links to GP Dashboard
* Tweak: Give H4-H6 elements the paragraph bottom margin
* Tweak: Don't close mobile menu when item is tapped
* Tweak: Simplify a11y outline script
* Tweak: Keep mobile sub-menus open if mobile toggle is closed
* Tweak: Replace default sidebar widget content in template files with generate_do_default_sidebar_widgets()
* Tweak: Clean up extra spaces in footer class attribute
* Fix: screen-reader-text class conflicts with some plugins
* Deprecated: generate_get_setting()
* Deprecated: generate_right_sidebar_class()
* Deprecated: generate_get_right_sidebar_class()
* Deprecated: generate_left_sidebar_class()
* Deprecated: generate_get_left_sidebar_class()
* Deprecated: generate_content_class()
* Deprecated: generate_get_content_class()
* Deprecated: generate_header_class()
* Deprecated: generate_get_header_class()
* Deprecated: generate_inside_header_class()
* Deprecated: generate_get_inside_header_class()
* Deprecated: generate_container_class()
* Deprecated: generate_get_container_class()
* Deprecated: generate_navigation_class()
* Deprecated: generate_get_navigation_class()
* Deprecated: generate_inside_navigation_class()
* Deprecated: generate_menu_class()
* Deprecated: generate_get_menu_class()
* Deprecated: generate_main_class()
* Deprecated: generate_get_main_class()
* Deprecated: generate_footer_class()
* Deprecated: generate_get_footer_class()
* Deprecated: generate_inside_footer_class()
* Deprecated: generate_top_bar_class()
* Deprecated: generate_body_schema()
* Deprecated: generate_article_schema()
= 2.1.4 =
Release date: August 21, 2018
* Tweak: Update theme screenshot to be within new WordPress.org rules
= 2.1.3 =
Release date: July 3, 2018
* Tweak: Set blog index content to show excerpts by default
* Tweak: Darken default post meta colors for better contrast (a11y)
* Tweak: Darken default site tagline color for better contrast (a11y)
* Tweak: Add slight opacity to post meta icons
* Tweak: Set post meta font size to 100% on mobile (SEO)
* Tweak: Various WP Coding Standard tweaks
* Tweak: Update default copyright message
* Tweak: Reduce author archives avatar margin
= 2.1.2 =
Release date: May 16, 2018
* Tweak: Add support for new comment cookie checkbox in WP 4.9.6
= 2.1.1 =
Release date: May 7, 2018
* Tweak: Improve baseline of theme icons
* Tweak: Prevent JS error if back to top button HTML doesn't exist
* Fix: Mobile menu item alignment on RTL sites
* Fix: Clearing issue in full width footer bar areas
= 2.1 =
Release date: May 2, 2018
* New: Structured data to comments
* New: aria-label to sidebar navigation mobile menu
* New: Update all theme icons
* New: generate_metabox_tabs filter
* New: generate_after_footer hook
* New: generate_before_comments_container hook
* Tweak: Simplify mobile menu CSS
* Tweak: Load updated date before published date
* Tweak: Force array in Layout metabox to prevent PHP notices
* Tweak: Use https for schema.org references
* Tweak: Replace wildcard CSS selectors with specific selectors
* Tweak: Remove list item bullets in sidebar and footer widgets only
* Tweak: Make button/input line height consistent with link buttons
* Tweak: Add version to database for future migrations
* Tweak: Move back to top button to generate_after_footer
* Tweak: Remove focus class from menu items on click if leaving site
* Tweak: Keep tab focus inside navigation search when open
* Tweak: Remove roles from sidebars
* Fix: Sidebar sub-menu positioning after click
* Fix: Rare Customizer JS error related to typography
* Fix: Various small W3 errors
* Fix: Navigation aria-hidden issue
* Remove: Font Awesome Essentials HTTP request
* Remove: dropdown.js HTTP request
* Remove: IE6 CSS
* Remove: Secondary navigation CSS added to GPP 1.6
* Remove: Secondary navigation JS
= 2.0.2 =
Release date: January 17, 2018
* Fix: Double tap issue in sub-menus on iOS devices
* Fix: Secondary nav sub-menu positioning in sidebars
= 2.0.1 =
Release date: December 14, 2017
* Fix: PHP notice in Customizer using multisite
* Fix: Retina logo container width in Firefox
* Fix: RTL dropdown menu issue
* Fix: undefined .closest() error
* Fix: Mobile sub-menu issue when no theme location is set
* Fix: Various small dropdown menu issues
= 2.0 =
Release date: December 6, 2017
* New: Full web accessibility
* New: All jQuery replaced with vanilla javascript
* New: System stack font set to default
* New: H6 typography options
* New: Option to turn on Font Awesome essentials
* New: Font Awesome set to essentials by default
* New: Retina logo option
* New: Cache dynamic CSS
* New: Option to enable/disable dynamic CSS caching
* New: Merge all separate metaboxes into one master metabox
* New: generate_dashboard_page_capability filter
* New: generate_dashboard_inside_container hook
* New: generate_dashboard_after_header hook
* New: generate_after_primary_content_area hook
* New: generate_show_post_navigation filter
* Tweak: PHP performance profiled and improved
* Tweak: generate_sidebars hook removed ** Update your child themes *
* Tweak: Style select inputs the same as other inputs
* Tweak: Archive titles same font size as other h1 elements
* Tweak: Add accessibility to read more links
* Tweak: Add alt tag to featured images
* Tweak: Remove title tag from featured images
* Tweak: Make mobile menu keyboard accessible
* Tweak: Make dropdown menu types keyboard accessible
* Tweak: Make dropdown toggle arrow larger on mobile
* Tweak: Load style.min.css instead of style.css
* Tweak: Clean up minified Font Awesome file
* Tweak: Comments title screen reader text set to h2
* Tweak: Remove margin from last author info paragraph
* Tweak: Adjust mobile menu icon position
* Tweak: Load admin-specific files in the admin only
* Tweak: Move skip to content link into hook and remove from header.php
* Tweak: Add screen reader labels to comment form fields
* Tweak: Change widget titles to h2 elements
* Tweak: Remove existing separate meta boxes
* Tweak: File structure completely re-organized
* Tweak: Code re-written to adhere to WordPress coding standards
* Tweak: Fix mobile nav search position on RTL sites
* Tweak: Make footer bar menu widget RTL compatible
* Tweak: Set comment website field as URL input type
* Tweak: Set comment email field as email input type
* Tweak: Use WP defaults for comment must_log_in and logged_in_as messages
* Tweak: Fix admin notice position in GP Dashboard
* Tweak: Let WP figure out featured image alt attribute
* Fix: Button text color in content when content link is set
* Fix: Left aligned footer bar alignment
* Fix: Spacing when sticky nav is activated
* Fix: Header alignment in RTL languages
* Fix: Tablet/desktop grid bug
* Fix: Header inner width live preview bug
* Deprecated: generate_get_min_suffix()
* Deprecated: generate_add_layout_meta_box()
* Deprecated: generate_show_layout_meta_box()
* Deprecated: generate_save_layout_meta()
* Deprecated: generate_add_footer_widget_meta_box()
* Deprecated: generate_show_footer_widget_meta_box()
* Deprecated: generate_save_footer_widget_meta()
* Deprecated: generate_add_page_builder_meta_box()
* Deprecated: generate_show_page_builder_meta_box()
* Deprecated: generate_save_page_builder_meta()
* Deprecated: generate_add_de_meta_box()
* Deprecated: generate_show_de_meta_box()
* Deprecated: generate_save_de_meta()
* Deprecated: generate_add_base_inline_css()
* Deprecated: generate_color_scripts()
* Deprecated: generate_typography_scripts()
* Deprecated: generate_spacing_scripts()
* Deprecated: generate_leave_reply
* Deprecated: generate_cancel_reply
= Earlier versions =
For the changelog of earlier versions, please refer to our [development log](https://generatepress.com/category/development/).

View File

@ -0,0 +1,197 @@
caption,
td,
th {
text-align: right;
}
.main-navigation ul ul {
float: right;
left: auto;
right: 0;
text-align: right;
}
.main-navigation ul ul ul {
left: auto;
right: 100%;
}
.menu-item-has-children .dropdown-menu-toggle {
float: left !important;
}
.rtl .main-navigation ul ul, .rtl .secondary-navigation ul ul.sub-menu {
right: -999999px;
}
.rtl.dropdown-hover .main-navigation ul li.sfHover > ul,
.rtl.dropdown-hover .main-navigation ul li:hover > ul,
.rtl.dropdown-hover .secondary-navigation ul li.sfHover > ul,
.rtl.dropdown-hover .secondary-navigation ul li:hover > ul {
right: 0;
}
.rtl.dropdown-hover .main-navigation ul ul li.sfHover > ul,
.rtl.dropdown-hover .main-navigation ul ul li:hover > ul,
.rtl.dropdown-hover .secondary-navigation ul ul li.sfHover > ul,
.rtl.dropdown-hover .secondary-navigation ul ul li:hover > ul {
right: 100%;
}
.alignleft {
float: right;
margin-left: 1.5em;
}
.alignright {
float: left;
margin-right: 1.5em;
}
.main-navigation li {
float: 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;
}
.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: 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;
}
@media (max-width: 768px) {
.rtl .mobile-bar-items {
position: absolute;
left: 0;
top: 0;
}
}
@media (min-width: 768px) {
.inside-footer-widgets > div {
float: right;
}
.menu-item-has-children ul .dropdown-menu-toggle {
transform: rotate(180deg);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

View File

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

View File

@ -0,0 +1,18 @@
<?php
/**
* The template for displaying search forms in Generate
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
?>
<form method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<label>
<span class="screen-reader-text"><?php echo apply_filters( 'generate_search_label', _x( 'Search for:', 'label', 'generatepress' ) ); // WPCS: XSS ok, sanitization ok. ?></span>
<input type="search" class="search-field" placeholder="<?php echo esc_attr( apply_filters( 'generate_search_placeholder', _x( 'Search &hellip;', 'placeholder', 'generatepress' ) ) ); // WPCS: XSS ok, sanitization ok. ?>" value="<?php echo esc_attr( get_search_query() ); ?>" name="s" title="<?php echo esc_attr( apply_filters( 'generate_search_label', _x( 'Search for:', 'label', 'generatepress' ) ) ); // WPCS: XSS ok, sanitization ok. ?>">
</label>
<input type="submit" class="search-submit" value="<?php echo apply_filters( 'generate_search_button', _x( 'Search', 'submit button', 'generatepress' ) ); // WPCS: XSS ok, sanitization ok. ?>">
</form>

View File

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

View File

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

View File

@ -0,0 +1,67 @@
<?php
/**
* The Template for displaying all single posts.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
get_header(); ?>
<div id="primary" <?php generate_do_element_classes( 'content' ); ?>>
<main id="main" <?php generate_do_element_classes( 'main' ); ?>>
<?php
/**
* generate_before_main_content hook.
*
* @since 0.1
*/
do_action( 'generate_before_main_content' );
while ( have_posts() ) : the_post();
get_template_part( 'content', 'single' );
// If comments are open or we have at least one comment, load up the comment template.
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;
endwhile;
/**
* generate_after_main_content hook.
*
* @since 0.1
*/
do_action( 'generate_after_main_content' );
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
/**
* generate_after_primary_content_area hook.
*
* @since 2.0
*/
do_action( 'generate_after_primary_content_area' );
generate_construct_sidebars();
get_footer();

File diff suppressed because it is too large Load Diff

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