1
0
Fork 0

Initial commit

This commit is contained in:
bmen 2019-09-22 09:36:54 +02:00
commit 220112614f
98 changed files with 21540 additions and 0 deletions

26
README.md Normal file
View File

@ -0,0 +1,26 @@
# Pyramidengarten Berlin
Die Website des Gemeinschaftsgartens in Berlin Neukölln läuft auf der Basis von Wordpress mit dem Front-End Builder Beaverbuilder.
<table>
<tr>
<td>Auftraggeber:</td>
<td>Multikultureller Nachbarschaftsgarten Neukölln e.V.</td>
</tr>
<tr>
<td>Juli 2016</td>
<td>Start des Projekts</td>
</tr>
<tr>
<td>September 2018</td>
<td>Veröffentlichung der Website</td>
</tr>
</table>
## Theme
* generatepress
* generatepress-pyramidengarten (Child-Theme)
## Plugins
* Beaverbuilder Pro https://www.wpbeaverbuilder.com/
* Events-Manager https://de.wordpress.org/plugins/events-manager/
* the-events-calendar https://de.wordpress.org/plugins/the-events-calendar/

View File

@ -0,0 +1,8 @@
<?php
/**
* Generate child theme functions and definitions
*
* @package Generate
*/

View File

@ -0,0 +1,13 @@
/*
Theme Name: Generatepress Child
Theme URI: http://bmen.eu
Description: Generatepress Child-Theme for Pyramidengarten
Author: bmen
Author URI: http://bmen.eu
Template: generatepress
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: generatepress-child
*/

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_content_class(); ?>>
<main id="main" <?php generate_main_class(); ?>>
<?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,74 @@
<?php
/**
* The template for displaying Archive pages.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
get_header(); ?>
<div id="primary" <?php generate_content_class(); ?>>
<main id="main" <?php generate_main_class(); ?>>
<?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_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,129 @@
<?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();
if ( 1 === $comments_number ) {
printf(
/* translators: %s: post title */
esc_html_x( 'One thought on &ldquo;%s&rdquo;', 'comments title', 'generatepress' ),
'<span>' . get_the_title() . '</span>'
);
} else {
printf( // 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 ),
'<span>' . get_the_title() . '</span>'
);
}
?>
</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;
$defaults = array(
'comment_field' => '<p class="comment-form-comment"><label for="comment" class="screen-reader-text">' . esc_html__( 'Comment', 'generatepress' ) . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
'comment_notes_before' => null,
'comment_notes_after' => null,
'id_form' => 'commentform',
'id_submit' => 'submit',
'title_reply' => apply_filters( 'generate_leave_comment', __( 'Leave a Comment', 'generatepress' ) ),
'label_submit' => apply_filters( 'generate_post_comment', __( 'Post Comment', 'generatepress' ) ),
);
comment_form( $defaults );
?>
</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_article_schema( 'CreativeWork' ); ?>>
<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,63 @@
<?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_article_schema( 'CreativeWork' ); ?>>
<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 the_title( '<h1 class="entry-title" itemprop="headline">', '</h1>' ); ?>
</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_article_schema( 'CreativeWork' ); ?>>
<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_article_schema( 'CreativeWork' ); ?>>
<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,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,77 @@
.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;
}
#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%;
}

View File

@ -0,0 +1,211 @@
.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;
}
@media (min-width: 768px) {
.hide-on-desktop {
display: none;
}
.grid-70 {
float: left;
width: 70%;
box-sizing: border-box;
padding-right: 20px;
}
.grid-30 {
float: left;
width: 30%;
box-sizing: border-box;
padding-left: 20px;
}
.grid-parent {
padding-left: 0;
padding-right: 0;
}
}
@media (max-width: 767px) {
.hide-on-mobile {
display: none;
}
.gp-masthead .gp-masthead-links,
.gp-masthead .gp-title {
float: none;
text-align: center;
}
.gp-masthead .gp-title {
margin-bottom: 20px;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,260 @@
button.menu-toggle {
background-color: transparent;
width: 100%;
border: 0;
text-align: center;
}
.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;
}
.mobile-bar-items .search-item.active {
transition: opacity 300ms ease-in-out;
}
.main-navigation.toggled ul ul {
transition: 0s;
}
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 {
visibility: hidden;
}
.main-navigation.toggled ul ul.toggled-on {
visibility: visible;
}
.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;
}
.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 .dropdown-menu-toggle:before {
content: "\f107" !important;
}
.main-navigation.toggled .sfHover > a .dropdown-menu-toggle:before {
content: "\f106" !important;
}
.main-navigation.toggled .menu-item-has-children .dropdown-menu-toggle {
float: right;
}
.main-navigation.toggled .menu li.search-item {
display: none !important;
}
.main-navigation.toggled .sf-menu > li.menu-item-float-right {
float: none !important;
display: inline-block !important;
}
@media (max-width: 768px) {
.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;
}
.sidebar,
.content-area,
.inside-footer-widgets > div {
float: none;
width: 100%;
left: 0;
right: 0;
}
.inside-footer-widgets > div:not(:last-child) {
margin-bottom: 40px;
}
.one-container .sidebar {
margin-top: 40px;
}
.separate-containers #left-sidebar + #right-sidebar .inside-right-sidebar {
margin-top: 0;
}
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;
}
.inside-header > *:not(:last-child):not(.main-navigation) {
margin-bottom: 20px;
}
/* Start mobile navigation */
.main-navigation .menu-toggle,
.main-navigation .mobile-bar-items,
.sidebar-nav-mobile:not(#sticky-placeholder) {
display: block;
}
.main-navigation ul,
.gen-sidebar-nav {
display: none;
}
[class*="nav-float-"] .site-header .inside-header > * {
float: none;
clear: both;
}
/* End mobile navigation */
.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;
}
.site-main {
margin-left: 0 !important;
margin-right: 0 !important;
}
body:not(.no-sidebar) .site-main {
margin-bottom: 0 !important;
}
.fluid-header .inside-header {
text-align: center;
}
.header-widget {
float: none;
max-width: 100%;
text-align: center;
}
.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;
}
.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;
}
.site-footer .footer-widgets .footer-widgets-container .inside-footer-widgets {
margin: 0;
}
.site-footer .footer-widgets .footer-widgets-container .inner-padding {
padding: 0;
}
.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;
}
}

View File

@ -0,0 +1 @@
button.menu-toggle{background-color:transparent;width:100%;border:0;text-align:center}.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}.mobile-bar-items .search-item.active{transition:opacity 300ms ease-in-out}.main-navigation.toggled ul ul{transition:0s;visibility:hidden}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.toggled-on{visibility:visible}.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}.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 .dropdown-menu-toggle:before{content:"\f107"!important}.main-navigation.toggled .sfHover>a .dropdown-menu-toggle:before{content:"\f106"!important}.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){.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}.content-area,.inside-footer-widgets>div,.sidebar{float:none;width:100%;left:0;right:0}.inside-footer-widgets>div:not(:last-child){margin-bottom:40px}.one-container .sidebar{margin-top:40px}.separate-containers #left-sidebar+#right-sidebar .inside-right-sidebar{margin-top:0}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}.inside-header>:not(:last-child):not(.main-navigation){margin-bottom:20px}.main-navigation .menu-toggle,.main-navigation .mobile-bar-items,.sidebar-nav-mobile:not(#sticky-placeholder){display:block}.gen-sidebar-nav,.main-navigation ul{display:none}[class*=nav-float-] .site-header .inside-header>*{float:none;clear:both}.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}.site-main{margin-left:0!important;margin-right:0!important}body:not(.no-sidebar) .site-main{margin-bottom:0!important}.fluid-header .inside-header,.header-widget{text-align:center}.header-widget{float:none;max-width:100%}.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}.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}.site-footer .footer-widgets .footer-widgets-container .inside-footer-widgets{margin:0}.site-footer .footer-widgets .footer-widgets-container .inner-padding{padding:0}.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}}

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.

Binary file not shown.

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

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_footer_class(); ?>>
<?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,94 @@
<?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.1.4' );
if ( ! function_exists( 'generate_setup' ) ) {
add_action( 'after_setup_theme', 'generate_setup' );
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* @since 0.1
*/
function generate_setup() {
// Make theme available for translation.
load_theme_textdomain( 'generatepress' );
// Add theme support for various features.
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'status' ) );
add_theme_support( 'woocommerce' );
add_theme_support( 'title-tag' );
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );
add_theme_support( 'customize-selective-refresh-widgets' );
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
*/
require get_template_directory() . '/inc/theme-functions.php';
require get_template_directory() . '/inc/defaults.php';
require get_template_directory() . '/inc/class-css.php';
require get_template_directory() . '/inc/css-output.php';
require get_template_directory() . '/inc/general.php';
require get_template_directory() . '/inc/customizer.php';
require get_template_directory() . '/inc/markup.php';
require get_template_directory() . '/inc/element-classes.php';
require get_template_directory() . '/inc/typography.php';
require get_template_directory() . '/inc/plugin-compat.php';
require get_template_directory() . '/inc/migrate.php';
require get_template_directory() . '/inc/deprecated.php';
if ( is_admin() ) {
require get_template_directory() . '/inc/meta-box.php';
require get_template_directory() . '/inc/dashboard.php';
}
/**
* Load our theme structure
*/
require get_template_directory() . '/inc/structure/archives.php';
require get_template_directory() . '/inc/structure/comments.php';
require get_template_directory() . '/inc/structure/featured-images.php';
require get_template_directory() . '/inc/structure/footer.php';
require get_template_directory() . '/inc/structure/header.php';
require get_template_directory() . '/inc/structure/navigation.php';
require get_template_directory() . '/inc/structure/post-meta.php';
require get_template_directory() . '/inc/structure/sidebars.php';

View File

@ -0,0 +1,61 @@
<?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' ); ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="profile" href="http://gmpg.org/xfn/11">
<?php wp_head(); ?>
</head>
<body <?php generate_body_schema();?> <?php body_class(); ?>>
<?php
/**
* 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">
<div id="content" class="site-content">
<?php
/**
* generate_inside_container hook.
*
* @since 0.1
*/
do_action( 'generate_inside_container' );

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,786 @@
<?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() {
// Get our settings
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
// Initiate our class
$css = new GeneratePress_CSS;
// Body
$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'] ) );
// Links
$css->set_selector( 'a, a:visited' );
$css->add_property( 'color', esc_attr( $generate_settings['link_color'] ) );
$css->add_property( 'text-decoration', 'none' ); // Temporary until people can get their browser caches cleared
// Visited links
$css->set_selector( 'a:visited' )->add_property( 'color', esc_attr( $generate_settings['link_color_visited'] ) );
// Hover/focused links
$css->set_selector( 'a:hover, a:focus, a:active' );
$css->add_property( 'color', esc_attr( $generate_settings['link_color_hover'] ) );
$css->add_property( 'text-decoration', 'none' ); // Temporary until people can get their browser caches cleared
// Container width
$css->set_selector( 'body .grid-container' )->add_property( 'max-width', absint( $generate_settings['container_width'] ), false, 'px' );
// Allow us to hook CSS into our output
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() {
// Get our settings
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_color_defaults()
);
// Initiate our CSS class
$css = new GeneratePress_CSS;
// Top bar
$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'] ) );
// Top bar link
$css->set_selector( '.top-bar a,.top-bar a:visited' );
$css->add_property( 'color', esc_attr( $generate_settings['top_bar_link_color'] ) );
// Top bar link hover
$css->set_selector( '.top-bar a:hover' );
$css->add_property( 'color', esc_attr( $generate_settings['top_bar_link_color_hover'] ) );
// Header
$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'] ) );
// Header link
$css->set_selector( '.site-header a,.site-header a:visited' );
$css->add_property( 'color', esc_attr( $generate_settings['header_link_color'] ) );
// Header link hover
$css->set_selector( '.site-header a:hover' );
$css->add_property( 'color', esc_attr( $generate_settings['header_link_hover_color'] ) );
// Site title
$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'] ) );
// Site description
$css->set_selector( '.site-description' );
$css->add_property( 'color', esc_attr( $generate_settings['site_tagline_color'] ) );
// Navigation background
$css->set_selector( '.main-navigation,.main-navigation ul ul' );
$css->add_property( 'background-color', esc_attr( $generate_settings['navigation_background_color'] ) );
// Navigation text
$css->set_selector( '.main-navigation .main-nav ul li a,.menu-toggle' );
$css->add_property( 'color', esc_attr( $generate_settings['navigation_text_color'] ) );
// Navigation background/text on hover
$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'] ) );
// Mobile button text
$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'] ) );
// Navigation background/text current
$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'] ) );
// Navigation background text current text hover
$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 input
$css->set_selector( '.navigation-search input[type="search"],.navigation-search input[type="search"]:active' );
$css->add_property( 'color', esc_attr( $generate_settings['navigation_background_hover_color'] ) );
$css->add_property( 'background-color', esc_attr( $generate_settings['navigation_background_hover_color'] ) );
// Navigation search input on focus
$css->set_selector( '.navigation-search input[type="search"]:focus' );
$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'] ) );
// Sub-navigation background
$css->set_selector( '.main-navigation ul ul' );
$css->add_property( 'background-color', esc_attr( $generate_settings['subnavigation_background_color'] ) );
// Sub-navigation text
$css->set_selector( '.main-navigation .main-nav ul ul li a' );
$css->add_property( 'color', esc_attr( $generate_settings['subnavigation_text_color'] ) );
// Sub-Navigation background/text on hover
$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'] ) );
// Sub-Navigation background / text current
$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'] ) );
// Sub-Navigation current background / text current
$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'] ) );
// Content
$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'] ) );
// Content links
$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'] ) );
// Content links on hover
$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'] ) );
// Entry header
$css->set_selector( '.entry-header h1,.page-header h1' );
$css->add_property( 'color', esc_attr( $generate_settings['content_title_color'] ) );
// Blog post title
$css->set_selector( '.entry-title a,.entry-title a:visited' );
$css->add_property( 'color', esc_attr( $generate_settings['blog_post_title_color'] ) );
// Blog post title on hover
$css->set_selector( '.entry-title a:hover' );
$css->add_property( 'color', esc_attr( $generate_settings['blog_post_title_hover_color'] ) );
// Entry meta text
$css->set_selector( '.entry-meta' );
$css->add_property( 'color', esc_attr( $generate_settings['entry_meta_text_color'] ) );
// Entry meta links
$css->set_selector( '.entry-meta a,.entry-meta a:visited' );
$css->add_property( 'color', esc_attr( $generate_settings['entry_meta_link_color'] ) );
// Entry meta links on hover
$css->set_selector( '.entry-meta a:hover' );
$css->add_property( 'color', esc_attr( $generate_settings['entry_meta_link_color_hover'] ) );
// H1 color
$css->set_selector( 'h1' );
$css->add_property( 'color', esc_attr( $generate_settings['h1_color'] ) );
// H2 color
$css->set_selector( 'h2' );
$css->add_property( 'color', esc_attr( $generate_settings['h2_color'] ) );
// H3 color
$css->set_selector( 'h3' );
$css->add_property( 'color', esc_attr( $generate_settings['h3_color'] ) );
// H4 color
$css->set_selector( 'h4' );
$css->add_property( 'color', esc_attr( $generate_settings['h4_color'] ) );
// H5 color
$css->set_selector( 'h5' );
$css->add_property( 'color', esc_attr( $generate_settings['h5_color'] ) );
// H6 color
$css->set_selector( 'h6' );
$css->add_property( 'color', esc_attr( $generate_settings['h6_color'] ) );
// Sidebar widget
$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'] ) );
// Sidebar widget links
$css->set_selector( '.sidebar .widget a,.sidebar .widget a:visited' );
$css->add_property( 'color', esc_attr( $generate_settings['sidebar_widget_link_color'] ) );
// Sidebar widget links on hover
$css->set_selector( '.sidebar .widget a:hover' );
$css->add_property( 'color', esc_attr( $generate_settings['sidebar_widget_link_hover_color'] ) );
// Sidebar widget title
$css->set_selector( '.sidebar .widget .widget-title' );
$css->add_property( 'color', esc_attr( $generate_settings['sidebar_widget_title_color'] ) );
// Footer widget
$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'] ) );
// Footer widget links
$css->set_selector( '.footer-widgets a,.footer-widgets a:visited' );
$css->add_property( 'color', esc_attr( $generate_settings['footer_widget_link_color'] ) );
// Footer widget links on hover
$css->set_selector( '.footer-widgets a:hover' );
$css->add_property( 'color', esc_attr( $generate_settings['footer_widget_link_hover_color'] ) );
// Footer widget title
$css->set_selector( '.footer-widgets .widget-title' );
$css->add_property( 'color', esc_attr( $generate_settings['footer_widget_title_color'] ) );
// Footer
$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'] ) );
// Footer links
$css->set_selector( '.site-info a,.site-info a:visited' );
$css->add_property( 'color', esc_attr( $generate_settings['footer_link_color'] ) );
// Footer links on hover
$css->set_selector( '.site-info a:hover' );
$css->add_property( 'color', esc_attr( $generate_settings['footer_link_hover_color'] ) );
// Footer bar widget menu
$css->set_selector( '.footer-bar .widget_nav_menu .current-menu-item a' );
$css->add_property( 'color', esc_attr( $generate_settings['footer_link_hover_color'] ) );
// Form input
$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'] ) );
// Form input on focus
$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'] ) );
// Form button
$css->set_selector( 'button,html input[type="button"],input[type="reset"],input[type="submit"],a.button,a.button:visited' );
$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'] ) );
// Form button on hover
$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' );
$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'] ) );
// Back to top button
$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'] ) );
// Allow us to hook CSS into our output
do_action( 'generate_colors_css', $css );
// Return our dynamic 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;
// Get our sub-navigation font size
$subnav_font_size = $generate_settings['navigation_font_size'] >= 17 ? $generate_settings['navigation_font_size'] - 3 : $generate_settings['navigation_font_size'] - 1;
// Create all of our font family entries
$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() );
// Body
$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' );
// Line hieght
$css->set_selector( 'body' );
$css->add_property( 'line-height', floatval( $generate_settings['body_line_height'] ), $og_defaults['body_line_height'] );
// Paragraph margin
$css->set_selector( 'p' );
$css->add_property( 'margin-bottom', floatval( $generate_settings['paragraph_margin'] ), $og_defaults['paragraph_margin'], 'em' );
// Top bar
$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' );
// Site title
$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' );
// Site description
$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' );
// Navigation
$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' );
// Sub-navigation font size
$css->set_selector( '.main-navigation .main-nav ul ul li a' );
$css->add_property( 'font-size', absint( $subnav_font_size ), false, 'px' );
// Widget title
$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' );
// Widget font size
$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' );
// Form button
$css->set_selector( 'button:not(.menu-toggle),html input[type="button"],input[type="reset"],input[type="submit"],.button,.button:visited' );
$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' );
}
// H1
$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' );
// H2
$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' );
// H3
$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' );
// H4
$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' );
}
// H5
$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' );
}
// H6
$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' );
}
// Footer
$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' );
// Mobile
$css->start_media_query( apply_filters( 'generate_mobile_media_query', '(max-width:768px)' ) );
// Site title
$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' );
// H1
$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' );
// H2
$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();
// Allow us to hook CSS into our output
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;
// Top bar padding
$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'] ) );
// Header padding
$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'] ) );
// Content padding
$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' );
$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'] ) );
// Mobile Content padding
$css->start_media_query( apply_filters( 'generate_mobile_media_query', '(max-width:768px)' ) );
$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' );
$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'] ) );
$css->stop_media_query();
// One container
$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'] ) );
// Separate containers
// Container bottom margins
$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' );
// Right sidebar
$css->set_selector( '.right-sidebar.separate-containers .site-main' );
$css->add_property( 'margin', generate_padding_css( $spacing_settings['separator'], $spacing_settings['separator'], $spacing_settings['separator'], '0' ), generate_padding_css( $og_defaults['separator'], $og_defaults['separator'], $og_defaults['separator'], '0' ) );
// Left sidebar
$css->set_selector( '.left-sidebar.separate-containers .site-main' );
$css->add_property( 'margin', generate_padding_css( $spacing_settings['separator'], '0', $spacing_settings['separator'], $spacing_settings['separator'] ), generate_padding_css( $og_defaults['separator'], '0', $og_defaults['separator'], $og_defaults['separator'] ) );
// Both sidebars
$css->set_selector( '.both-sidebars.separate-containers .site-main' );
$css->add_property( 'margin', absint( $spacing_settings['separator'] ), absint( $og_defaults['separator'] ), 'px' );
// Both right sidebar content separating space
$css->set_selector( '.both-right.separate-containers .site-main' );
$css->add_property( 'margin', generate_padding_css( $spacing_settings['separator'], $spacing_settings['separator'], $spacing_settings['separator'], '0' ), generate_padding_css( $og_defaults['separator'], $og_defaults['separator'], $og_defaults['separator'], '0' ) );
// Both right sidebar - left sidebar separating space
$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' );
// Both right sidebar - right sidebar separating space
$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' );
// Both left sidebar content separating space
$css->set_selector( '.both-left.separate-containers .site-main' );
$css->add_property( 'margin', generate_padding_css( $spacing_settings['separator'], '0', $spacing_settings['separator'], $spacing_settings['separator'] ), generate_padding_css( $og_defaults['separator'], '0', $og_defaults['separator'], $og_defaults['separator'] ) );
// Both left sidebar - left sidebar separating space
$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' );
// Both left sidebar - right sidebar separating space
$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' );
// Site main separators
$css->set_selector( '.separate-containers .site-main' );
$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' );
// Page header top margin
$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' );
// Sidebar separator
$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' );
// Navigation spacing
// Menu item size
$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' );
// Sub-menu item size
$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'] ) );
// Sub-menu positioning
$css->set_selector( '.main-navigation ul ul' );
$css->add_property( 'top', 'auto' ); // Added for compatibility purposes on 22/12/2016
// Navigation search
$css->set_selector( '.navigation-search, .navigation-search input' );
$css->add_property( 'height', '100%' ); // Added to give browser caches a chance to clear
// Dropdown arrow spacing
$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' );
// Sub-menu dropdown arrow spacing
$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' );
// RTL menu item padding
$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' );
// Sidebar widget padding
$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'] ) );
// Footer widget padding
$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'] ) );
// Footer widget separator
$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' );
// Footer padding
$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'] ) );
// 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 = '';
// Get color settings
$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;}';
}
// Allow us to hook CSS into our output
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() {
// Initiate our class.
$css = new GeneratePress_CSS;
// Content margin if there's no title.
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' );
}
}
}
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();
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 );
}

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,170 @@
<?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 = '';
/**
* 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;
}
/**
* 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="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 class="generatepress-slider" data-step="{{ data.choices['desktop']['step'] }}" data-min="{{ data.choices['desktop']['min'] }}" data-max="{{ data.choices['desktop']['max'] }}"></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="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 class="generatepress-slider" data-step="{{ data.choices['tablet']['step'] }}" data-min="{{ data.choices['tablet']['min'] }}" data-max="{{ data.choices['tablet']['max'] }}"></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="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 class="generatepress-slider" data-step="{{ data.choices['mobile']['step'] }}" data-min="{{ data.choices['mobile']['min'] }}" data-max="{{ data.choices['mobile']['max'] }}"></div>
</div>
</label>
<# } #>
</div>
</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();
$number_of_fonts = apply_filters( 'generate_number_of_fonts', 200 );
$this->json['default_fonts_title'] = __( 'System fonts', 'generatepress' );
$this->json['google_fonts_title'] = __( 'Google fonts', '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();
$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 data.google_fonts ) { #>
<option value="{{ data.google_fonts[ key ].name }}" <# if ( data.google_fonts[ key ].name === data.family.value ) { #>selected="selected"<# } #>>{{ data.google_fonts[ 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 = data.google_fonts[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>
<# } #>
<# 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>
<# } #>
<?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,136 @@
.customize-control-generatepress-range-slider .generatepress-slider {
display: inline-block;
position: relative;
width: calc(100% - 60px);
height: 6px;
margin-top: 12px;
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;
}
.customize-control-generatepress-range-slider .gp_range_value .unit {
width: 30px;
display:inline-block;
}
.customize-control-generatepress-range-slider .gp_range_value {
display: inline-block;
font-size: 14px;
padding: 0;
font-weight: 400;
float: right;
width: 50px;
}
.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;
height: 22px;
background: #FFF;
line-height: 22px;
border: 1px solid #DDD;
}
.customize-control-generatepress-range-slider .has-unit .gp_range_value span.value {
width: calc(100% - 32px);
float: left;
display: block;
}
.customize-control-generatepress-range-slider .gp_range_value .unit {
width: 29px;
display: block;
float: left;
background: #FFF;
height: 22px;
border-top: 1px solid #DDD;
border-bottom: 1px solid #DDD;
border-right: 1px solid #DDD;
text-align: center;
text-transform: uppercase;
font-size: 10px;
line-height: 22px;
}
.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;
height: 24px;
}
.customize-control-generatepress-range-slider .has-unit .gp_range_value input {
width: calc(100% - 30px);
float: left;
}
.customize-control-generatepress-range-slider .gp-range-title-info {
display: inline-block;
}
.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-range-slider-controls {
float:right;
}
.customize-control-generatepress-range-slider .gp-device-controls > span:first-child:last-child {
display: none;
}

View File

@ -0,0 +1,33 @@
.generatepress-font-weight,
.generatepress-font-transform {
float: left;
width: 50%
}
.generatepress-font-weight select {
border-right: 0;
}
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);
}

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,382 @@
/**
* 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 ) {
default_value = typeof default_value !== 'undefined' ? default_value : 'initial';
wp.customize( 'generate_settings[' + id + ']', function( value ) {
value.bind( function( newval ) {
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( $ ) {
// 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 );
} );
} );
/**
* 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' );
/**
* 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{max-width:' + newval + 'px;}' );
} else {
jQuery( 'head' ).append( '<style id="container_width">body .grid-container{max-width:' + newval + 'px;}</style>' );
setTimeout(function() {
jQuery( 'style#container_width' ).not( ':last' ).remove();
}, 100);
}
jQuery('body').trigger('generate_spacing_updated');
} );
} );
/**
* Body font size
*/
wp.customize( 'generate_settings[body_font_size]', function( value ) {
value.bind( function( newval ) {
if ( jQuery( 'style#body_font_size' ).length ) {
jQuery( 'style#body_font_size' ).html( 'body, button, input, select, textarea{font-size:' + newval + 'px;}' );
} else {
jQuery( 'head' ).append( '<style id="body_font_size">body, button, input, select, textarea{font-size:' + newval + 'px;}</style>' );
setTimeout(function() {
jQuery( 'style#body_font_size' ).not( ':last' ).remove();
}, 100);
}
setTimeout("jQuery('body').trigger('generate_spacing_updated');", 1000);
} );
} );
/**
* Body line height
*/
wp.customize( 'generate_settings[body_line_height]', function( value ) {
value.bind( function( newval ) {
if ( jQuery( 'style#body_line_height' ).length ) {
jQuery( 'style#body_line_height' ).html( 'body{line-height:' + newval + ';}' );
} else {
jQuery( 'head' ).append( '<style id="body_line_height">body{line-height:' + newval + ';}</style>' );
setTimeout(function() {
jQuery( 'style#body_line_height' ).not( ':last' ).remove();
}, 100);
}
setTimeout("jQuery('body').trigger('generate_spacing_updated');", 1000);
} );
} );
/**
* Paragraph margin
*/
wp.customize( 'generate_settings[paragraph_margin]', function( value ) {
value.bind( function( newval ) {
if ( jQuery( 'style#paragraph_margin' ).length ) {
jQuery( 'style#paragraph_margin' ).html( 'p{margin-bottom:' + newval + 'em;}' );
} else {
jQuery( 'head' ).append( '<style id="paragraph_margin">p{margin-bottom:' + newval + 'em;}</style>' );
setTimeout(function() {
jQuery( 'style#paragraph_margin' ).not( ':last' ).remove();
}, 100);
}
setTimeout("jQuery('body').trigger('generate_spacing_updated');", 1000);
} );
} );
/**
* Body font weight
*/
wp.customize( 'generate_settings[body_font_weight]', function( value ) {
value.bind( function( newval ) {
jQuery( 'head' ).append( '<style id="body_font_weight">body, button, input, select, textarea{font-weight:' + newval + ';}</style>' );
setTimeout(function() {
jQuery( 'style#body_font_weight' ).not( ':last' ).remove();
}, 100);
} );
} );
/**
* Body text transform
*/
wp.customize( 'generate_settings[body_font_transform]', function( value ) {
value.bind( function( newval ) {
jQuery( 'head' ).append( '<style id="body_font_transform">body, button, input, select, textarea{text-transform:' + newval + ';}</style>' );
setTimeout(function() {
jQuery( 'style#body_font_transform' ).not( ':last' ).remove();
}, 100);
} );
} );
/**
* 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 ) {
jQuery('body').trigger('generate_navigation_location_updated');
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;
}
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 ) {
$( '#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 );

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,151 @@
( 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($) {
jQuery( '.generatepress-font-family select' ).selectWoo();
jQuery( '.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' ).selectWoo().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,248 @@
<?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 ) );
}
}
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 '';
}
}
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' )
)
);
wp_localize_script( 'generatepress-typography-customizer', 'typography_defaults', generate_typography_default_fonts() );
}
/**
* 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;
}

View File

@ -0,0 +1,325 @@
<?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/downloads/generate-backgrounds/' ),
),
'Blog' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/downloads/generate-blog/' ),
),
'Colors' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/downloads/generate-colors/' ),
),
'Copyright' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/downloads/generate-copyright/' ),
),
'Disable Elements' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/downloads/generate-disable-elements/' ),
),
'Hooks' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/downloads/generate-hooks/' ),
),
'Import / Export' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/downloads/generate-import-export/' ),
),
'Menu Plus' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/downloads/generate-menu-plus/' ),
),
'Page Header' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/downloads/generate-page-header/' ),
),
'Secondary Nav' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/downloads/generate-secondary-nav/' ),
),
'Sections' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/downloads/generate-sections/' ),
),
'Spacing' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/downloads/generate-spacing/' ),
),
'Typography' => array(
'url' => generate_get_premium_url( 'https://generatepress.com/downloads/generate-typography/' ),
),
);
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' );
?>
</div>
<div class="generate-right-sidebar grid-30" style="padding-right: 0;">
<div class="customize-button hide-on-mobile">
<?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_admin_right_panel hook.
*
* @since 0.1
*/
do_action( 'generate_admin_right_panel' );
if ( ! defined( 'GP_PREMIUM_VERSION' ) ) : ?>
<div class="postbox generate-metabox popular-articles">
<h3 class="hndle"><a href="https://docs.generatepress.com" target="_blank"><?php esc_html_e( 'View all', 'generatepress' ); ?></a><?php esc_html_e( 'Documentation', 'generatepress' ); ?></h3>
<div class="inside">
<ul>
<li><a href="https://docs.generatepress.com/article/adding-header-logo/" target="_blank"><?php esc_html_e( 'Adding a Logo', 'generatepress' ); ?></a></li>
<li><a href="https://docs.generatepress.com/article/sidebar-layout/" target="_blank"><?php esc_html_e( 'Sidebar Layout', 'generatepress' ); ?></a></li>
<li><a href="https://docs.generatepress.com/article/container-width/" target="_blank"><?php esc_html_e( 'Container Width', 'generatepress' ); ?></a></li>
<li><a href="https://docs.generatepress.com/article/navigation-location/" target="_blank"><?php esc_html_e( 'Navigation Location', 'generatepress' ); ?></a></li>
<li><a href="https://docs.generatepress.com/article/footer-widgets/" target="_blank"><?php esc_html_e( 'Footer Widgets', 'generatepress' ); ?></a></li>
</ul>
</div>
</div>
<?php endif; ?>
<div class="postbox generate-metabox" id="gen-delete">
<h3 class="hndle"><?php esc_html_e( 'Delete Customizer 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__( 'Delete Default Settings', 'generatepress' ), 'button', '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,340 @@
<?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() {
$generate_defaults = array(
'hide_title' => '',
'hide_tagline' => '',
'logo' => '',
'retina_logo' => '',
'top_bar_width' => 'full',
'top_bar_inner_width' => 'contained',
'top_bar_alignment' => 'right',
'container_width' => '1100',
'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_dropdown_type' => 'hover',
'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,
'dynamic_css_cache' => true,
);
return apply_filters( 'generate_option_defaults', $generate_defaults );
}
}
if ( ! function_exists( 'generate_get_color_defaults' ) ) {
/**
* Set default options
*/
function generate_get_color_defaults() {
$generate_color_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',
'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',
);
return apply_filters( 'generate_color_option_defaults', $generate_color_defaults );
}
}
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 ) {
$generate_font_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
'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
'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
'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', $generate_font_defaults );
}
return $generate_font_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 ) {
$generate_spacing_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',
'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',
'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', $generate_spacing_defaults );
}
return $generate_spacing_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,185 @@
<?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()' );
}
}

View File

@ -0,0 +1,455 @@
<?php
/**
* Builds filterable classes throughout the theme.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
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.
}
}

View File

@ -0,0 +1,322 @@
<?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() {
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
$dir_uri = get_template_directory_uri();
wp_enqueue_style( 'generate-style-grid', $dir_uri . "/css/unsemantic-grid{$suffix}.css", false, GENERATE_VERSION, 'all' );
wp_enqueue_style( 'generate-style', $dir_uri . "/style{$suffix}.css", array( 'generate-style-grid' ), 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_settings['nav_dropdown_type'] || 'click-arrow' == $generate_settings['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_settings['nav_search'] ) {
wp_enqueue_script( 'generate-navigation-search', $dir_uri . "/js/navigation-search{$suffix}.js", array( 'generate-menu' ), GENERATE_VERSION, true );
}
if ( 'enable' == $generate_settings['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_setting( '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
*
* @return bool Whether to display the content title.
*/
function generate_disable_title() {
global $post;
$disable_headline = ( isset( $post ) ) ? get_post_meta( $post->ID, '_generate-disable-headline', true ) : '';
if ( ! empty( $disable_headline ) && false !== $disable_headline ) {
return false;
}
return true;
}
}
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_setting( '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_setting( 'dynamic_css_cache' ) ) {
return true;
}
return $cache;
}

View File

@ -0,0 +1,491 @@
<?php
/**
* Adds HTML markup.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
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.
}
}
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 ) {
// Get Customizer settings
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
// Get the layout
$layout = generate_get_layout();
// Get the navigation location
$navigation_location = generate_get_navigation_location();
// Get the footer widgets
$widgets = generate_get_footer_widgets();
// Full width content
// Used for page builders, sets the content to full width and removes the padding
$full_width = get_post_meta( get_the_ID(), '_generate-full-width-content', true );
$classes[] = ( '' !== $full_width && false !== $full_width && is_singular() && 'true' == $full_width ) ? 'full-width-content' : '';
// Contained content
// Used for page builders, basically just removes the content padding
$classes[] = ( '' !== $full_width && false !== $full_width && is_singular() && 'contained' == $full_width ) ? 'contained-content' : '';
// Let us know if a featured image is being used
if ( has_post_thumbnail() ) {
$classes[] = 'featured-image-active';
}
// Layout classes
$classes[] = ( $layout ) ? $layout : 'right-sidebar';
$classes[] = ( $navigation_location ) ? $navigation_location : 'nav-below-header';
$classes[] = ( $generate_settings['header_layout_setting'] ) ? $generate_settings['header_layout_setting'] : 'fluid-header';
$classes[] = ( $generate_settings['content_layout_setting'] ) ? $generate_settings['content_layout_setting'] : 'separate-containers';
$classes[] = ( '' !== $widgets ) ? 'active-footer-widgets-' . $widgets : 'active-footer-widgets-3';
$classes[] = ( 'enable' == $generate_settings['nav_search'] ) ? 'nav-search-enabled' : '';
// Navigation alignment class
if ( $generate_settings['nav_alignment_setting'] == 'left' ) {
$classes[] = 'nav-aligned-left';
} elseif ( $generate_settings['nav_alignment_setting'] == 'center' ) {
$classes[] = 'nav-aligned-center';
} elseif ( $generate_settings['nav_alignment_setting'] == 'right' ) {
$classes[] = 'nav-aligned-right';
} else {
$classes[] = 'nav-aligned-left';
}
// Header alignment class
if ( $generate_settings['header_alignment_setting'] == 'left' ) {
$classes[] = 'header-aligned-left';
} elseif ( $generate_settings['header_alignment_setting'] == 'center' ) {
$classes[] = 'header-aligned-center';
} elseif ( $generate_settings['header_alignment_setting'] == 'right' ) {
$classes[] = 'header-aligned-right';
} else {
$classes[] = 'header-aligned-left';
}
// Navigation dropdown type
if ( 'click' == $generate_settings['nav_dropdown_type'] ) {
$classes[] = 'dropdown-click';
$classes[] = 'dropdown-click-menu-item';
} elseif ( 'click-arrow' == $generate_settings['nav_dropdown_type'] ) {
$classes[] = 'dropdown-click-arrow';
$classes[] = 'dropdown-click';
} else {
$classes[] = 'dropdown-hover';
}
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_setting( 'top_bar_width' ) ) {
$classes[] = 'grid-container';
$classes[] = 'grid-parent';
}
$classes[] = 'top-bar-align-' . generate_get_setting( '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';
// Get theme options
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
$header_layout = $generate_settings['header_layout_setting'];
if ( $header_layout == 'contained-header' ) {
$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';
$inner_header_width = generate_get_setting( 'header_inner_width' );
if ( $inner_header_width !== 'full-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';
// Get theme options
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
$nav_layout = $generate_settings['nav_layout_setting'];
if ( $nav_layout == 'contained-nav' ) {
$classes[] = 'grid-container';
$classes[] = 'grid-parent';
}
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';
$inner_nav_width = generate_get_setting( 'nav_inner_width' );
if ( $inner_nav_width !== 'full-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';
// Get theme options
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
$footer_layout = $generate_settings['footer_layout_setting'];
if ( $footer_layout == 'contained-footer' ) {
$classes[] = 'grid-container';
$classes[] = 'grid-parent';
}
// Footer bar
$classes[] = ( is_active_sidebar( 'footer-bar' ) ) ? 'footer-bar-active' : '';
$classes[] = ( is_active_sidebar( 'footer-bar' ) ) ? 'footer-bar-align-' . $generate_settings['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';
$inside_footer_width = generate_get_setting( 'footer_inner_width' );
if ( $inside_footer_width !== 'full-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,
'normal',
'high'
);
}
}
}
/**
* 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,319 @@
<?php
/**
* Migrates old options on update.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
add_action( 'admin_init', 'generate_do_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_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 );
}
}
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,259 @@
<?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_content_class();?>>
<main id="main" <?php generate_main_class(); ?>>
<?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_article_schema( 'CreativeWork' ); ?>>
<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 = apply_filters( 'generate_mobile_media_query', '(max-width:768px)' );
$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() {
$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() {
$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,105 @@
<?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; ?>">
<?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
*/
do_action( 'generate_after_archive_title' );
// Show an optional term 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' ); ?>
</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;
}
}

View File

@ -0,0 +1,97 @@
<?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" itemscope itemtype="https://schema.org/Comment">
<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" itemprop="author" itemscope itemtype="https://schema.org/Person">
<?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>' ); ?>
<?php
comment_reply_link( array_merge( $args, array(
'add_below' => 'div-comment',
'depth' => $depth,
'max_depth' => $args['max_depth'],
'before' => '<span class="reply">| ',
'after' => '</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 comment_text(); ?>
</div><!-- .comment-content -->
</article><!-- .comment-body -->
<?php
endif;
}
}
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'] = '<label for="author" class="screen-reader-text">' . esc_html__( 'Name', 'generatepress' ) . '</label><input placeholder="' . esc_attr__( 'Name', 'generatepress' ) . ' *" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" />';
$fields['email'] = '<label for="email" class="screen-reader-text">' . esc_html__( 'Email', 'generatepress' ) . '</label><input placeholder="' . esc_attr__( 'Email', 'generatepress' ) . ' *" id="email" name="email" type="email" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" />';
$fields['url'] = '<label for="url" class="screen-reader-text">' . esc_html__( 'Website', 'generatepress' ) . '</label><input placeholder="' . esc_attr__( 'Website', 'generatepress' ) . '" id="url" name="url" type="url" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" />';
return $fields;
}

View File

@ -0,0 +1,111 @@
<?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">
<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',
)
)
) );
}
}
}
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',
'alt' => the_title_attribute( 'echo=0' ),
)
); ?>
</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,235 @@
<?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" itemtype="https://schema.org/WPFooter" itemscope="itemscope">
<div class="inside-site-info <?php if ( 'full-width' !== generate_get_setting( '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 if ( ! dynamic_sidebar( 'footer-' . absint( $widget ) ) ) : ?>
<aside class="widget inner-padding widget_text">
<h4 class="widget-title"><?php esc_html_e( 'Footer Widget', 'generatepress' );?></h4>
<div class="textwidget">
<p>
<?php
printf( // WPCS: XSS ok.
/* translators: 1: admin URL */
__( 'Replace this widget content by going to <a href="%1$s"><strong>Appearance / Widgets</strong></a> and dragging widgets into this widget area.', 'generatepress' ),
esc_url( admin_url( 'widgets.php' ) )
);
?>
</p>
<p>
<?php
printf( // WPCS: XSS ok.
/* translators: 1: admin URL */
__( 'To remove or choose the number of footer widgets, go to <a href="%1$s"><strong>Appearance / Customize / Layout / Footer Widgets</strong></a>.', 'generatepress' ),
esc_url( admin_url( 'customize.php' ) )
);
?>
</p>
</div>
</aside>
<?php endif; ?>
</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 ) :
// 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_inside_footer_class(); ?>>
<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>
</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' )
) );
}
}

View File

@ -0,0 +1,266 @@
<?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 itemtype="https://schema.org/WPHeader" itemscope="itemscope" id="masthead" <?php generate_header_class(); ?>>
<div <?php generate_inside_header_class(); ?>>
<?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() {
generate_construct_header_widget();
generate_construct_site_title();
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_setting( 'logo' );
$logo_url = esc_url( apply_filters( 'generate_logo', $logo_url ) );
$retina_logo_url = esc_url( apply_filters( 'generate_retina_logo', generate_get_setting( '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">
%1$s
</p>',
html_entity_decode( get_bloginfo( 'description', 'display' ) )
) );
// Site title and tagline.
if ( false == $disable_title || false == $disable_tagline ) {
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 ( ! 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_top_bar_class(); ?>>
<div class="inside-top-bar<?php if ( 'contained' == generate_get_setting( '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,360 @@
<?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 itemtype="https://schema.org/SiteNavigationElement" itemscope="itemscope" id="site-navigation" <?php generate_navigation_class(); ?>>
<div <?php generate_inside_navigation_class(); ?>>
<?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 do_action( 'generate_inside_mobile_menu' ); ?>
<span class="mobile-menu"><?php echo apply_filters( 'generate_mobile_menu_label', __( 'Menu', 'generatepress' ) ); // WPCS: XSS ok. ?></span>
</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_menu_class() ) . '">%3$s</ul>',
)
);
?>
</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_menu_class(); ?>>
<?php
$args = array(
'sort_column' => 'menu_order',
'title_li' => '',
'walker' => new Generate_Page_Walker(),
);
wp_list_pages( $args );
if ( 'enable' == $generate_settings['nav_search'] ) {
echo '<li class="search-item" title="' . esc_attr_x( 'Search', 'submit button', 'generatepress' ) . '"><a href="#"><span class="screen-reader-text">' . esc_html_x( 'Search', 'submit button', 'generatepress' ) . '</span></a></li>';
}
?>
</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';
$button = '<span role="button" class="dropdown-menu-toggle" aria-expanded="false"></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_setting( 'nav_dropdown_type' ) ) {
$role = 'button';
$tabindex = ' tabindex="0"';
}
// Loop through our menu items and add our dropdown icons.
if ( 'main-nav' === $args->container_class ) {
foreach ( $item->classes as $value ) {
if ( 'menu-item-has-children' === $value ) {
$title = $title . '<span role="' . $role . '" class="dropdown-menu-toggle"' . $tabindex . '></span>';
}
}
}
// Return our title.
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 ( $args->theme_location == 'primary' ) {
return $nav . '<li class="search-item" title="' . esc_attr_x( 'Search', 'submit button', 'generatepress' ) . '"><a href="#"><span class="screen-reader-text">' . _x( 'Search', 'submit button', 'generatepress' ) . '</span></a></li>';
}
// 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" title="<?php echo esc_attr_x( 'Search', 'submit button', 'generatepress' ); ?>">
<a href="#">
<span class="screen-reader-text"><?php echo esc_attr_x( 'Search', 'submit button', 'generatepress' ); ?></span>
</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,264 @@
<?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';
$category_specific = apply_filters( 'generate_category_post_navigation', false );
?>
<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.
previous_post_link( '<div class="nav-previous"><span class="prev" title="' . esc_attr__( 'Previous', 'generatepress' ) . '">%link</span></div>', '%title', $category_specific );
next_post_link( '<div class="nav-next"><span class="next" title="' . esc_attr__( 'Next', 'generatepress' ) . '">%link</span></div>', '%title', $category_specific );
elseif ( is_home() || is_archive() || is_search() ) : // navigation links for home, archive, and search pages.
if ( get_next_posts_link() ) : ?>
<div class="nav-previous"><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"><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;
}
}
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() {
$date = apply_filters( 'generate_post_date', true );
$author = apply_filters( 'generate_post_author', 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( '<span class="posted-on">%1$s</span>', // WPCS: XSS ok, sanitization ok.
sprintf( '<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>',
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
$time_string
)
), $time_string );
}
// If our author is enabled, show it.
if ( $author ) {
echo apply_filters( 'generate_post_author_output', sprintf( ' <span class="byline">%1$s</span>', // WPCS: XSS ok, sanitization ok.
sprintf( '<span class="author vcard" itemtype="https://schema.org/Person" itemscope="itemscope" itemprop="author">%1$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>',
__( 'by', 'generatepress' ),
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() )
)
) );
}
}
}
if ( ! function_exists( 'generate_entry_meta' ) ) {
/**
* Prints HTML with meta information for the categories, tags.
*
* @since 1.2.5
*/
function generate_entry_meta() {
$categories = apply_filters( 'generate_show_categories', true );
$tags = apply_filters( 'generate_show_tags', true );
$comments = apply_filters( 'generate_show_comments', true );
$categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ) );
if ( $categories_list && $categories ) {
echo apply_filters( 'generate_category_list_output', sprintf( '<span class="cat-links"><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
) );
}
$tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ) );
if ( $tags_list && $tags ) {
echo apply_filters( 'generate_tag_list_output', sprintf( '<span class="tags-links"><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
) );
}
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) && $comments ) {
echo '<span class="comments-link">';
comments_popup_link( __( 'Leave a comment', 'generatepress' ), __( '1 Comment', 'generatepress' ), __( '% Comments', 'generatepress' ) );
echo '</span>';
}
}
}
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() {
if ( 'post' == get_post_type() ) : ?>
<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() {
if ( 'post' == get_post_type() ) : ?>
<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,43 @@
<?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' );
}

View File

@ -0,0 +1,263 @@
<?php
/**
* Main theme functions.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
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 ) {
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
return $generate_settings[ $setting ];
}
}
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() {
// Get current post
global $post;
// Get Customizer options
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
// Set up the layout variable for pages
$layout = $generate_settings['layout_setting'];
// Get the individual page/post sidebar metabox value
$layout_meta = ( isset( $post ) ) ? get_post_meta( $post->ID, '_generate-sidebar-layout-meta', true ) : '';
// Set up BuddyPress variable
$buddypress = false;
if ( function_exists( 'is_buddypress' ) ) {
$buddypress = ( is_buddypress() ) ? true : false;
}
// If we're on the single post page
// And if we're not on a BuddyPress page - fixes a bug where BP thinks is_single() is true
if ( is_single() && ! $buddypress ) {
$layout = null;
$layout = $generate_settings['single_layout_setting'];
}
// If the metabox is set, use it instead of the global settings
if ( '' !== $layout_meta && false !== $layout_meta ) {
$layout = $layout_meta;
}
// If we're on the blog, archive, attachment etc..
if ( is_home() || is_archive() || is_search() || is_tax() ) {
$layout = null;
$layout = $generate_settings['blog_layout_setting'];
}
// Finally, return the layout
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() {
// Get current post
global $post;
// Get Customizer options
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
// Set up the footer widget variable
$widgets = $generate_settings['footer_widget_setting'];
// Get the individual footer widget metabox value
$widgets_meta = ( isset( $post ) ) ? get_post_meta( $post->ID, '_generate-footer-widget-meta', true ) : '';
// If we're not on a single page or post, the metabox hasn't been set
if ( ! is_singular() ) {
$widgets_meta = '';
}
// If we have a metabox option set, use it
if ( '' !== $widgets_meta && false !== $widgets_meta ) {
$widgets = $widgets_meta;
}
// Finally, return the layout
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() {
// Get current post
global $post;
// Get Customizer settings
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
// Check to see if the more tag is being used
$more_tag = apply_filters( 'generate_more_tag', strpos( $post->post_content, '<!--more-->' ) );
// Check the post format
$format = ( false !== get_post_format() ) ? get_post_format() : 'standard';
// Get the excerpt setting from the Customizer
$show_excerpt = ( 'excerpt' == $generate_settings['post_content'] ) ? true : false;
// If our post format isn't standard, show the full content
$show_excerpt = ( 'standard' !== $format ) ? false : $show_excerpt;
// If the more tag is found, show the full content
$show_excerpt = ( $more_tag ) ? false : $show_excerpt;
// If we're on a search results page, show the excerpt
$show_excerpt = ( is_search() ) ? true : $show_excerpt;
// Return our value
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.
* @return string The URL to generatepress.com.
*/
function generate_get_premium_url( $url = 'https://generatepress.com/premium' ) {
$url = trailingslashit( $url );
$args = apply_filters( 'generate_premium_url_args', array(
'ref' => null,
'campaign' => null,
) );
// Set up our URL if we have an ID
if ( isset( $args['ref'] ) ) {
$url = add_query_arg( 'ref', absint( $args['ref'] ), $url );
}
// Set up our URL if we have a campaign
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 all of our values are the same, we can return one value only
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_setting( 'nav_position_setting' ) );
}
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,70 @@
<?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_content_class();?>>
<main id="main" <?php generate_main_class(); ?>>
<?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_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,148 @@
/**
* 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 );
}
} )();
/*! outline.js v1.2.0 - https://github.com/lindsayevans/outline.js/ */
(function(d){
var style_element = d.createElement('STYLE'),
dom_events = 'addEventListener' in d,
add_event_listener = function(type, callback){
// Basic cross-browser event handling
if(dom_events){
d.addEventListener(type, callback);
}else{
d.attachEvent('on' + type, callback);
}
},
set_css = function(css_text){
// Handle setting of <style> element contents in IE8
!!style_element.styleSheet ? style_element.styleSheet.cssText = css_text : style_element.innerHTML = css_text;
}
;
d.getElementsByTagName('HEAD')[0].appendChild(style_element);
// Using mousedown instead of mouseover, so that previously focused elements don't lose focus ring on mouse move
add_event_listener('mousedown', function(){
set_css(':focus{outline:0}::-moz-focus-inner{border:0;}');
});
add_event_listener('keydown', function(){
set_css('');
});
})(document);
( function() {
'use strict';
if ( 'querySelector' in document && 'addEventListener' in window && document.body.classList.contains( 'dropdown-hover' ) ) {
var navLinks = document.querySelectorAll( 'nav ul a' ),
parentElements = document.querySelectorAll( '.sf-menu .menu-item-has-children' );
/**
* 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 ( 'touchend' in document.documentElement ) {
for ( var i = 0; i < parentElements.length; i++ ) {
parentElements[i].addEventListener( 'touchend', function( e ) {
// Bail on mobile
if ( parentElements[i].closest( 'nav' ).classList.contains( 'toggled' ) ) {
return;
}
if ( e.touches.length === 1 ) {
// 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.preventDefault();
}
// Close other sub-menus
var openedSubMenus = parentElements[i].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
document.addEventListener( 'touchend', closeDropdown = function(e) {
e.stopPropagation();
this.classList.remove( 'sfHover' );
document.removeEventListener( 'touchend', closeDropdown );
} );
}
}
}, true );
}
}
})();

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(e){var t=e.createElement("STYLE"),n="addEventListener"in e,s=function(t,s){n?e.addEventListener(t,s):e.attachEvent("on"+t,s)},o=function(e){t.styleSheet?t.styleSheet.cssText=e:t.innerHTML=e};e.getElementsByTagName("HEAD")[0].appendChild(t),s("mousedown",function(){o(":focus{outline:0}::-moz-focus-inner{border:0;}")}),s("keydown",function(){o("")})}(document),function(){"use strict";if("querySelector"in document&&"addEventListener"in window&&document.body.classList.contains("dropdown-hover"))for(var e=document.querySelectorAll("nav ul a"),t=document.querySelectorAll(".sf-menu .menu-item-has-children"),n=function(){if(!this.closest("nav").classList.contains("toggled")&&!this.closest("nav").classList.contains("slideout-navigation"))for(var e=this;-1===e.className.indexOf("main-nav");)"li"===e.tagName.toLowerCase()&&(-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",n),e[s].addEventListener("blur",n);if("touchend"in document.documentElement)for(s=0;s<t.length;s++)t[s].addEventListener("touchend",function(e){if(!t[s].closest("nav").classList.contains("toggled")&&1===e.touches.length&&(e.stopPropagation(),!this.classList.contains("sfHover"))){e.target!==this&&e.target.parentNode!==this||e.preventDefault();var n=t[s].closest("nav").querySelectorAll("ul.toggled-on");if(n&&!this.closest("ul").classList.contains("toggled-on")&&!this.closest("li").classList.contains("sfHover"))for(var o=0;o<n.length;o++)n[o].classList.remove("toggled-on"),n[o].closest("li").classList.remove("sfHover");this.classList.add("sfHover"),document.addEventListener("touchend",closeDropdown=function(e){e.stopPropagation(),this.classList.remove("sfHover"),document.removeEventListener("touchend",closeDropdown)})}},!0)}();

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,113 @@
( 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.setAttribute( 'aria-expanded', 'true' );
} else {
dropdownToggle.setAttribute( 'aria-expanded', 'false' );
}
// Open the sub-menu
if ( body.classList.contains( 'dropdown-click-menu-item' ) ) {
_this.parentNode.querySelector( '.sub-menu' ).classList.toggle( 'toggled-on' );
} else if ( body.classList.contains( 'dropdown-click-arrow' ) ) {
closestLi.querySelector( '.sub-menu' ).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' );
for ( var i = 0; i < activeSubMenus.length; i++ ) {
activeSubMenus[i].classList.remove( 'toggled-on' );
activeSubMenus[i].closest( '.sfHover' ).classList.remove( 'sfHover' );
}
}
}
// 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 e=document.body,n=function(n,t){if(n.preventDefault(),n.stopPropagation(),!t)var t=this;var o=t.closest("li"),l=t.closest("nav").querySelectorAll("ul.toggled-on");if(l&&!t.closest("ul").classList.contains("toggled-on")&&!t.closest("li").classList.contains("sfHover"))for(var c=0;c<l.length;c++)l[c].classList.remove("toggled-on"),l[c].closest("li").classList.remove("sfHover");o.classList.toggle("sfHover"),e.classList.contains("dropdown-click-menu-item")?t.parentNode.querySelector(".sub-menu").classList.toggle("toggled-on"):e.classList.contains("dropdown-click-arrow")&&o.querySelector(".sub-menu").classList.toggle("toggled-on")},t=document.querySelectorAll(".main-nav .menu-item-has-children > a");if(e.classList.contains("dropdown-click-menu-item"))for(l=0;l<t.length;l++)t[l].addEventListener("click",n,!0);if(e.classList.contains("dropdown-click-arrow")){for(l=0;l<document.querySelectorAll(".main-nav .menu-item-has-children > a").length;l++)"#"==document.querySelectorAll(".main-nav .menu-item-has-children > a")[l].getAttribute("href")&&document.querySelectorAll(".main-nav .menu-item-has-children > a")[l].classList.add("menu-item-dropdown-click");for(var o=document.querySelectorAll(".main-nav .menu-item-has-children > a .dropdown-menu-toggle"),l=0;l<o.length;l++)o[l].addEventListener("click",n,!1),o[l].addEventListener("keydown",function(e){var t=this;13===(e.which||e.keyCode)&&n(e,t)},!1);for(l=0;l<document.querySelectorAll(".main-nav .menu-item-has-children > a.menu-item-dropdown-click").length;l++)document.querySelectorAll(".main-nav .menu-item-has-children > a.menu-item-dropdown-click")[l].addEventListener("click",n,!1)}var c=function(){if(document.querySelector("nav ul .toggled-on"))for(var e=document.querySelectorAll("nav ul .toggled-on"),n=0;n<e.length;n++)e[n].classList.remove("toggled-on"),e[n].closest(".sfHover").classList.remove("sfHover")};document.addEventListener("click",function(e){e.target.closest(".sfHover")||c()},!1),document.addEventListener("keydown",function(e){27===(e.which||e.keyCode)&&c()},!1)}}();

View File

@ -0,0 +1,227 @@
( 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.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' );
}
}
// Close the mobile menu if our link does something - good for one page sites.
if ( '#' !== url && '' !== url && ! navigator.userAgent.match( /iemobile/i ) ) {
setTimeout( function() {
closest_nav.classList.remove( 'toggled' );
htmlEl.classList.remove( 'mobile-menu-open' );
}, 200 );
}
}
}, 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 e=document.querySelectorAll(".menu-toggle"),t=document.querySelectorAll("nav .dropdown-menu-toggle"),o=document.querySelectorAll("nav ul a"),n=document.body,r=document.documentElement,s=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 s=o.getElementsByTagName("ul")[0];if(o.classList.contains("toggled")){if(o.classList.remove("toggled"),r.classList.remove("mobile-menu-open"),s.setAttribute("aria-hidden","true"),t.setAttribute("aria-expanded","false"),n.classList.contains("dropdown-hover"))for(var l=s.querySelectorAll("li.menu-item-has-children"),i=0;i<l.length;i++)l[i].querySelector(".dropdown-menu-toggle").removeAttribute("tabindex"),l[i].querySelector(".dropdown-menu-toggle").setAttribute("role","presentation"),l[i].querySelector(".dropdown-menu-toggle").removeAttribute("aria-expanded")}else if(o.classList.add("toggled"),r.classList.add("mobile-menu-open"),s.setAttribute("aria-hidden","false"),t.setAttribute("aria-expanded","true"),n.classList.contains("dropdown-hover"))for(l=s.querySelectorAll("li.menu-item-has-children"),i=0;i<l.length;i++)l[i].querySelector(".dropdown-menu-toggle").setAttribute("tabindex","0"),l[i].querySelector(".dropdown-menu-toggle").setAttribute("role","button"),l[i].querySelector(".dropdown-menu-toggle").setAttribute("aria-expanded","false")},l=0;l<e.length;l++)e[l].addEventListener("click",s,!1);var i=function(e,t){if(!t)t=this;if((t.closest("nav").classList.contains("toggled")||r.classList.contains("slide-opened"))&&!n.classList.contains("dropdown-click")){e.preventDefault();var o=t.closest("li"),s=o.querySelector(".dropdown-menu-toggle");if("false"==s.getAttribute("aria-expanded")?s.setAttribute("aria-expanded","true"):s.setAttribute("aria-expanded","false"),o.querySelector(".sub-menu"))var l=o.querySelector(".sub-menu");else l=o.querySelector(".children");o.classList.toggle("sfHover"),l.classList.toggle("toggled-on")}e.stopPropagation()};for(l=0;l<t.length;l++)t[l].addEventListener("click",i,!1),t[l].addEventListener("keypress",function(e){13===(e.which||e.keyCode)&&i(e,this)},!1);var a=function(){for(var t=0;t<e.length;t++)if(null===e[t].offsetParent){var o=e[t].closest("nav");if(o&&o.classList.contains("toggled")){var s=o.getElementsByTagName("ul")[0],l=s.getElementsByTagName("li"),i=s.getElementsByTagName("ul");document.activeElement.blur(),o.classList.remove("toggled"),r.classList.remove("mobile-menu-open"),e[t].setAttribute("aria-expanded","false");for(var a=0;a<l.length;a++)l[a].classList.remove("sfHover");for(var d=0;d<i.length;d++)i[d].classList.remove("toggled-on");if(s&&s.removeAttribute("aria-hidden"),n.classList.contains("dropdown-hover"))for(var c=o.querySelectorAll("li.menu-item-has-children"),u=0;u<c.length;u++)c[u].querySelector(".dropdown-menu-toggle").removeAttribute("tabindex"),c[u].querySelector(".dropdown-menu-toggle").setAttribute("role","presentation"),c[u].querySelector(".dropdown-menu-toggle").removeAttribute("aria-expanded")}}};if(window.addEventListener("resize",a,!1),window.addEventListener("orientationchange",a,!1),n.classList.contains("dropdown-hover"))for(l=0;l<o.length;l++)o[l].addEventListener("click",function(e){this.hostname!==window.location.hostname&&document.activeElement.blur();var t=this.closest("nav");if(t.classList.contains("toggled")||r.classList.contains("slide-opened")){var o=this.getAttribute("href");if("#"==o||""==o){e.preventDefault();var n=this.closest("li");n.classList.toggle("sfHover");var s=n.querySelector(".sub-menu");s&&s.classList.toggle("toggled-on")}"#"===o||""===o||navigator.userAgent.match(/iemobile/i)||setTimeout(function(){t.classList.remove("toggled"),r.classList.remove("mobile-menu-open")},200)}},!1)}}();

View File

@ -0,0 +1,110 @@
( 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' );
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' );
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' );
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 e=function(e,t){if(e.preventDefault(),!t)t=this;var a=t.closest("nav");t.getAttribute("data-nav")&&(a=document.querySelector(this.getAttribute("data-nav")));var s=a.querySelector(".navigation-search"),c=document.querySelectorAll('a[href], area[href], input:not([disabled]):not(.navigation-search), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]');if(s.classList.contains("nav-search-active")){t.classList.remove("close-search"),t.classList.remove("active"),document.activeElement.blur(),t.classList.remove("sfHover"),s.classList.remove("nav-search-active"),t.style.float="";for(var i=0;i<c.length;i++)c[i].closest(".navigation-search")||c[i].closest(".search-item")||c[i].removeAttribute("tabindex")}else{t.classList.add("active"),s.classList.add("nav-search-active"),s.querySelector(".search-field").focus();for(i=0;i<c.length;i++)c[i].closest(".navigation-search")||c[i].closest(".search-item")||c[i].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 t=document.querySelectorAll(".search-item"),a=0;a<t.length;a++)t[a].addEventListener("click",e,!1);document.addEventListener("click",function(t){if(document.querySelector(".navigation-search.nav-search-active")&&!t.target.closest(".navigation-search")&&!t.target.closest(".search-item"))for(var a=document.querySelectorAll(".search-item.active"),s=0;s<a.length;s++)e(t,a[s])},!1),document.addEventListener("keydown",function(t){if(document.querySelector(".navigation-search.nav-search-active")&&27===(t.which||t.keyCode))for(var a=document.querySelectorAll(".search-item.active"),s=0;s<a.length;s++)e(t,a[s])},!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,64 @@
<?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_content_class();?>>
<main id="main" <?php generate_main_class(); ?>>
<?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() ) : ?>
<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,253 @@
=== 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: 4.9
Stable tag: 2.1.4
GeneratePress is a fast, lightweight (less than 1MB zipped), mobile responsive WordPress theme built with speed, SEO and usability in mind.
== Description ==
GeneratePress is a fast, lightweight (less than 1MB zipped), mobile responsive WordPress theme built with speed, SEO and usability in mind.
GP can serve as a solid base for any website, and works great with any of your favorite page builders.
With an emphasis on WordPress coding standards, we ensure GeneratePress is compatible with all well-coded plugins, including major ones like WooCommerce, WPML, BuddyPress and bbPress.
GeneratePress is device friendly (mobile and tablet), uses 100% valid HTML, is fully schema microdata integrated, is translated into over 20 languages by our amazing community and is cross browser compatible (IE9+).
Some of our features include 9 widget areas, 5 navigation positions, 5 sidebar layouts, dropdown menus (click or hover) and a back to top button.
All our options use the native WordPress Customizer, meaning you can see every change you make instantly before pressing the publish button.
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
== Changelog ==
= 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,201 @@
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 {
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;
}
.right-sidebar .site-main {
margin: 30px 0 30px 30px;
}
.left-sidebar .site-main {
margin: 30px 30px 30px 0;
}
.both-right.separate-containers .site-main {
margin: 30px 0 30px 30px;
}
.both-left.separate-containers .site-main {
margin: 30px 30px 30px 0;
}
.both-left .inside-left-sidebar,
.both-right .inside-left-sidebar {
margin-left: 15px;
}
.both-left .inside-right-sidebar,
.both-right .inside-right-sidebar {
margin-right: 15px;
}
.one-container.both-right .site-main,
.one-container.right-sidebar .site-main {
margin-left: 60px;
}
.one-container.both-left .site-main,
.one-container.left-sidebar .site-main {
margin-right: 60px;
}
.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,
footer.entry-meta .author:before,
footer.entry-meta .posted-on:before {
margin-left: 5px;
}
.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: 66 KiB

View File

@ -0,0 +1,72 @@
<?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_content_class(); ?>>
<main id="main" <?php generate_main_class(); ?>>
<?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_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 apply_filters( 'generate_search_label', _ex( '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 esc_attr( apply_filters( 'generate_search_label', _ex( '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,64 @@
<?php
/**
* The Sidebar containing the main widget areas.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
// If the navigation is set in the sidebar, set variable to true.
$navigation_active = ( 'nav-left-sidebar' == generate_get_navigation_location() ) ? true : false;
// If the secondary navigation is set in the sidebar, set variable to true.
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-left-sidebar' == $secondary_nav['secondary_nav_position_setting'] ) {
$navigation_active = true;
}
}
?>
<div id="left-sidebar" itemtype="https://schema.org/WPSideBar" itemscope="itemscope" <?php generate_left_sidebar_class(); ?>>
<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' ) ) :
if ( false == $navigation_active ) : ?>
<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 endif;
endif;
/**
* 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,64 @@
<?php
/**
* The Sidebar containing the main widget areas.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
// If the navigation is set in the sidebar, set variable to true.
$navigation_active = ( 'nav-right-sidebar' == generate_get_navigation_location() ) ? true : false;
// If the secondary navigation is set in the sidebar, set variable to true.
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-right-sidebar' == $secondary_nav['secondary_nav_position_setting'] ) {
$navigation_active = true;
}
}
?>
<div id="right-sidebar" itemtype="https://schema.org/WPSideBar" itemscope="itemscope" <?php generate_right_sidebar_class(); ?>>
<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' ) ) :
if ( false == $navigation_active ) : ?>
<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 endif;
endif;
/**
* 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_content_class();?>>
<main id="main" <?php generate_main_class(); ?>>
<?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

1
wp-themes/generatepress/style.min.css vendored Normal file

File diff suppressed because one or more lines are too long

2
wp-themes/index.php Normal file
View File

@ -0,0 +1,2 @@
<?php
// Silence is golden.