modified file w3-total-cache
This commit is contained in:
@ -1,302 +0,0 @@
|
||||
.generate-tab-content {
|
||||
padding: 12px;
|
||||
}
|
||||
#generate_page_header_meta_box .inside {
|
||||
padding: 0;
|
||||
margin:0;
|
||||
}
|
||||
#generate-tabs-container .generate-tabs-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-tabs-container .generate-tabs-menu li {
|
||||
display: block;
|
||||
position: relative;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
#generate-tabs-container .generate-tabs-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-tabs-container .generate-tab {
|
||||
float: left;
|
||||
width: calc( 100% - 180px );
|
||||
margin-left: -1px;
|
||||
border-left: 1px solid #eee;
|
||||
}
|
||||
|
||||
#generate-tabs-container {
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
background: linear-gradient( 90deg, #fafafa 0%, #fafafa 180px, #fff 180px, #fff 100% );
|
||||
}
|
||||
|
||||
#generate-tabs-container .generate-current a {
|
||||
position: relative;
|
||||
font-weight: bold;
|
||||
color: #555;
|
||||
background-color: #e0e0e0;
|
||||
}
|
||||
|
||||
#generate-tabs-container label {
|
||||
font-weight: 600;
|
||||
display: inline-block;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
#_meta-generate-page-header-image-background-spacing-unit,
|
||||
#_meta-generate-page-header-left-right-padding-unit {
|
||||
margin: 0;
|
||||
position: relative;
|
||||
top: -2px;
|
||||
left: -4px;
|
||||
line-height: 27px;
|
||||
height: 27px;
|
||||
}
|
||||
|
||||
#generate-tabs-container .or {
|
||||
position: relative;
|
||||
top: 5px;
|
||||
}
|
||||
|
||||
.show-in-excerpt{
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
@media (min-width: 1475px) {
|
||||
.page-header-column {
|
||||
width: 30%;
|
||||
margin-right: 3%;
|
||||
float: left;
|
||||
}
|
||||
.page-header-column.last {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
.generate-tabs-menu li {
|
||||
display: inline-block;
|
||||
}
|
||||
.generate-tab-content {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#generate-tab-1 {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.generate-current a.button,
|
||||
.generate-tabs-menu li a.button:focus{
|
||||
background: #eee;
|
||||
border-color: #999;
|
||||
box-shadow: inset 0 2px 5px -3px rgba(0,0,0,.5);
|
||||
transform: translateY(1px);
|
||||
}
|
||||
|
||||
#generate-tabs-container .lcs_wrap {
|
||||
display: inline-block;
|
||||
direction: ltr;
|
||||
height: 28px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
#generate-tabs-container .lcs_wrap input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#generate-tabs-container .lcs_switch {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
width: 24px;
|
||||
height: 16px;
|
||||
border-radius: 8px;
|
||||
background: #ddd;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
transition: all .2s ease-in-out;
|
||||
}
|
||||
#generate-tabs-container .lcs_cursor {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 100%;
|
||||
background: #fff;
|
||||
z-index: 10;
|
||||
transition: all .2s linear;
|
||||
}
|
||||
#generate-tabs-container .lcs_label {
|
||||
font-family: "Trebuchet MS", Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
line-height: 18px;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
position: absolute;
|
||||
width: 33px;
|
||||
top: 5px;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
opacity: 0;
|
||||
transition: all .2s ease-in-out .1s;
|
||||
}
|
||||
#generate-tabs-container .lcs_label.lcs_label_on {
|
||||
left: -70px;
|
||||
z-index: 6;
|
||||
}
|
||||
#generate-tabs-container .lcs_label.lcs_label_off {
|
||||
right: -70px;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
|
||||
/* on */
|
||||
#generate-tabs-container .lcs_switch.lcs_on {
|
||||
background: #0073aa;
|
||||
}
|
||||
#generate-tabs-container .lcs_switch.lcs_on .lcs_cursor {
|
||||
left: 10px;
|
||||
}
|
||||
#generate-tabs-container .lcs_switch.lcs_on .lcs_label_on {
|
||||
left: 10px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
|
||||
/* off */
|
||||
#generate-tabs-container .lcs_switch.lcs_off {
|
||||
background: #b2b2b2;
|
||||
}
|
||||
#generate-tabs-container .lcs_switch.lcs_off .lcs_cursor {
|
||||
left: 2px;
|
||||
}
|
||||
#generate-tabs-container .lcs_switch.lcs_off .lcs_label_off {
|
||||
right: 10px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
|
||||
/* disabled */
|
||||
#generate-tabs-container .lcs_switch.lcs_disabled {
|
||||
opacity: 0.65;
|
||||
filter: alpha(opacity=65);
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
#generate-tabs-container .choose-content-options span {
|
||||
display:block;
|
||||
color:#222;
|
||||
}
|
||||
|
||||
#generate-tabs-container .lcs_wrap + label {
|
||||
font-weight: normal;
|
||||
display: inline;
|
||||
top: -6px;
|
||||
position: relative;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.choose-content-options div {
|
||||
margin-bottom:10px;
|
||||
border-bottom:1px solid #DDD;
|
||||
padding-bottom:10px;
|
||||
}
|
||||
.small {
|
||||
display: block;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.admin-color-light #generate_page_header_meta_box .lcs_switch.lcs_on {
|
||||
background: #04a4cc;
|
||||
box-shadow: 0 0 2px #04a4cc inset;
|
||||
}
|
||||
|
||||
.admin-color-blue #generate_page_header_meta_box .lcs_switch.lcs_on {
|
||||
background: #e1a948;
|
||||
box-shadow: 0 0 2px #e1a948 inset;
|
||||
}
|
||||
|
||||
.admin-color-coffee #generate_page_header_meta_box .lcs_switch.lcs_on {
|
||||
background: #c7a589;
|
||||
box-shadow: 0 0 2px #c7a589 inset;
|
||||
}
|
||||
|
||||
.admin-color-ectoplasm #generate_page_header_meta_box .lcs_switch.lcs_on {
|
||||
background: #a3b745;
|
||||
box-shadow: 0 0 2px #a3b745 inset;
|
||||
}
|
||||
|
||||
.admin-color-midnight #generate_page_header_meta_box .lcs_switch.lcs_on {
|
||||
background: #e14d43;
|
||||
box-shadow: 0 0 2px #e14d43 inset;
|
||||
}
|
||||
|
||||
.admin-color-ocean #generate_page_header_meta_box .lcs_switch.lcs_on {
|
||||
background: #9ebaa0;
|
||||
box-shadow: 0 0 2px #9ebaa0 inset;
|
||||
}
|
||||
|
||||
.admin-color-sunrise #generate_page_header_meta_box .lcs_switch.lcs_on {
|
||||
background: #dd823b;
|
||||
box-shadow: 0 0 2px #dd823b inset;
|
||||
}
|
||||
|
||||
.post-type-generate_page_header #generate_page_header_meta_box .handlediv,
|
||||
.post-type-generate_page_header #generate_page_header_meta_box h2.hndle {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.page-header-content-required {
|
||||
background: #fafafa;
|
||||
border-left: 4px solid #fff;
|
||||
box-shadow: 0 1px 1px 0 rgba( 0, 0, 0, 0.1 );
|
||||
margin: 5px 0 8px 0;
|
||||
padding: 1px 12px;
|
||||
border-left-color: #00a0d2;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.page-header-content-required p {
|
||||
margin: 0.5em 0;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.wp-picker-container .wp-color-result.button {
|
||||
height: 24px;
|
||||
margin: 0 6px 6px 0px;
|
||||
padding: 0 0 0 30px;
|
||||
font-size: 11px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.wp-color-result:after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.wp-color-result-text {
|
||||
background: #f7f7f7;
|
||||
border-radius: 0 2px 2px 0;
|
||||
border-left: 1px solid #ccc;
|
||||
color: #555;
|
||||
display: block;
|
||||
line-height: 22px;
|
||||
padding: 0 6px;
|
||||
text-align: center;
|
||||
}
|
@ -1,92 +0,0 @@
|
||||
.generate-combined-header {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.generate-combined-page-header.grid-container .generate-combined-header {
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.separate-containers .inside-article .page-header-below-title,
|
||||
.one-container .inside-article .page-header-below-title {
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
.inside-article .page-header-post-image {
|
||||
float: none;
|
||||
margin-right: 0px;
|
||||
}
|
||||
|
||||
.vertical-center-enabled {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.vertical-center-enabled .page-header-content-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
-ms-flex-grow: 1;
|
||||
flex-grow: 1;
|
||||
-webkit-box-flex: 1;
|
||||
|
||||
width: 100%;
|
||||
-ms-justify-content: center;
|
||||
justify-content: center;
|
||||
|
||||
-webkit-box-align: center;
|
||||
-webkit-flex-align: center;
|
||||
}
|
||||
|
||||
.vertical-center-enabled .main-navigation,
|
||||
.vertical-center-enabled .secondary-navigation,
|
||||
.vertical-center-enabled .site-header {
|
||||
flex: none;
|
||||
-ms-flex: none;
|
||||
-webkit-flex: none;
|
||||
}
|
||||
|
||||
.nav-below-header .vertical-center-enabled .main-navigation,
|
||||
.nav-above-header .vertical-center-enabled .main-navigation {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.vertical-center-enabled .site-header {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.generate-merged-header .main-navigation {
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
.generate-merged-header .main-navigation.mobile-header-navigation {
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.generate-merged-header .secondary-navigation {
|
||||
z-index: 98;
|
||||
}
|
||||
|
||||
.generate-content-header {
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.elementor-editor-active .generate-combined-header {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.page-header-content-container:before,
|
||||
.page-header-content-container:after {
|
||||
content: "";
|
||||
display: table;
|
||||
}
|
||||
|
||||
.page-header-content-container:after {
|
||||
clear: both;
|
||||
}
|
@ -1 +0,0 @@
|
||||
.generate-combined-header{position:absolute;width:100%;z-index:1000}.generate-combined-page-header.grid-container .generate-combined-header{left:0;right:0;width:auto}.one-container .inside-article .page-header-below-title,.separate-containers .inside-article .page-header-below-title{margin-top:2em}.inside-article .page-header-post-image{float:none;margin-right:0}.vertical-center-enabled{display:flex;flex-direction:column;flex-wrap:nowrap;height:100%}.vertical-center-enabled .page-header-content-wrapper{display:flex;flex-direction:column;-ms-flex-grow:1;flex-grow:1;-webkit-box-flex:1;width:100%;-ms-justify-content:center;justify-content:center;-webkit-box-align:center;-webkit-flex-align:center}.vertical-center-enabled .main-navigation,.vertical-center-enabled .secondary-navigation,.vertical-center-enabled .site-header{flex:none;-ms-flex:none;-webkit-flex:none}.nav-above-header .vertical-center-enabled .main-navigation,.nav-below-header .vertical-center-enabled .main-navigation{width:100%}.vertical-center-enabled .site-header{width:100%}.generate-merged-header .main-navigation{z-index:99}.generate-merged-header .main-navigation.mobile-header-navigation{z-index:100}.generate-merged-header .secondary-navigation{z-index:98}.generate-content-header{background-repeat:no-repeat;background-size:cover}.elementor-editor-active .generate-combined-header{pointer-events:none}.page-header-content-container:after,.page-header-content-container:before{content:"";display:table}.page-header-content-container:after{clear:both}
|
File diff suppressed because it is too large
Load Diff
@ -1,220 +0,0 @@
|
||||
<?php
|
||||
defined( 'WPINC' ) or die;
|
||||
|
||||
class Generate_Page_Header_Locations {
|
||||
/**
|
||||
* Holds the values to be used in the fields callbacks
|
||||
*/
|
||||
private $options;
|
||||
|
||||
/**
|
||||
* Start up
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'admin_menu', array( $this, 'add_plugin_page' ) );
|
||||
add_action( 'admin_init', array( $this, 'page_init' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add options page
|
||||
*/
|
||||
public function add_plugin_page() {
|
||||
add_submenu_page(
|
||||
function_exists( 'generate_premium_do_elements' ) ? 'themes.php' : 'edit.php?post_type=generate_page_header',
|
||||
__( 'Global Locations', 'gp-premium' ),
|
||||
__( 'Global Locations', 'gp-premium' ),
|
||||
'manage_options',
|
||||
'page-header-global-locations',
|
||||
array( $this, 'create_admin_page' )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Options page callback
|
||||
*/
|
||||
public function create_admin_page() {
|
||||
// Set class property
|
||||
$this->options = get_option( 'generate_page_header_global_locations' );
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h1><?php _e( 'Global Locations', 'gp-premium' ); ?></h1>
|
||||
<form method="post" action="options.php">
|
||||
<?php
|
||||
// This prints out all hidden setting fields
|
||||
settings_fields( 'page_header_global_locations' );
|
||||
do_settings_sections( 'page-header-global-locations' );
|
||||
submit_button();
|
||||
?>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Register and add settings
|
||||
*/
|
||||
public function page_init() {
|
||||
register_setting(
|
||||
'page_header_global_locations',
|
||||
'generate_page_header_global_locations',
|
||||
array( $this, 'sanitize' )
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
'page_header_global_location_section',
|
||||
'',
|
||||
'',
|
||||
'page-header-global-locations'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'generate_page_header_location_blog',
|
||||
__( 'Posts Page (blog)', 'gp-premium' ),
|
||||
array( $this, 'post_type_select' ),
|
||||
'page-header-global-locations',
|
||||
'page_header_global_location_section',
|
||||
'blog'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'generate_page_header_location_search_results',
|
||||
__( 'Search Results', 'gp-premium' ),
|
||||
array( $this, 'post_type_select' ),
|
||||
'page-header-global-locations',
|
||||
'page_header_global_location_section',
|
||||
'search_results'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'generate_page_header_location_404',
|
||||
__( '404 Template', 'gp-premium' ),
|
||||
array( $this, 'post_type_select' ),
|
||||
'page-header-global-locations',
|
||||
'page_header_global_location_section',
|
||||
'404'
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
'page_header_cpt_single_section',
|
||||
__( 'Post Types - Single', 'gp-premium' ),
|
||||
'',
|
||||
'page-header-global-locations'
|
||||
);
|
||||
|
||||
$post_types = get_post_types( array( 'public' => true ), 'objects' );
|
||||
|
||||
foreach( $post_types as $type ) {
|
||||
add_settings_field(
|
||||
'generate_page_header_location_' . $type->name,
|
||||
$type->label,
|
||||
array( $this, 'post_type_select' ),
|
||||
'page-header-global-locations',
|
||||
'page_header_cpt_single_section',
|
||||
$type->name
|
||||
);
|
||||
}
|
||||
|
||||
$post_types = get_post_types( array( 'public' => true ), 'objects' );
|
||||
unset( $post_types['attachment'] );
|
||||
unset( $post_types['page'] );
|
||||
unset( $post_types['post'] );
|
||||
|
||||
if ( count( $post_types ) > 0 ) {
|
||||
add_settings_section(
|
||||
'page_header_cpt_archives_section',
|
||||
__( 'Post Types - Archives', 'gp-premium' ),
|
||||
'',
|
||||
'page-header-global-locations'
|
||||
);
|
||||
}
|
||||
|
||||
foreach( $post_types as $type ) {
|
||||
add_settings_field(
|
||||
'generate_page_header_location_' . $type->name . '_archives',
|
||||
$type->label,
|
||||
array( $this, 'post_type_select' ),
|
||||
'page-header-global-locations',
|
||||
'page_header_cpt_archives_section',
|
||||
$type->name . '_archives'
|
||||
);
|
||||
}
|
||||
|
||||
$taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
|
||||
|
||||
if ( count( $taxonomies ) > 0 ) {
|
||||
add_settings_section(
|
||||
'page_header_taxonomies_section',
|
||||
__( 'Taxonomies - Archives', 'gp-premium' ),
|
||||
'',
|
||||
'page-header-global-locations'
|
||||
);
|
||||
}
|
||||
|
||||
foreach( $taxonomies as $type ) {
|
||||
add_settings_field(
|
||||
'generate_page_header_location_' . $type->name,
|
||||
$type->label,
|
||||
array( $this, 'post_type_select' ),
|
||||
'page-header-global-locations',
|
||||
'page_header_taxonomies_section',
|
||||
$type->name
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize each setting field as needed
|
||||
*
|
||||
* @param array $input Contains all settings fields as array keys
|
||||
*/
|
||||
public function sanitize( $input ) {
|
||||
// Initialize the new array that will hold the sanitize values
|
||||
$new_input = array();
|
||||
|
||||
// Loop through the input and sanitize each of the values
|
||||
if ( is_array( $input ) || is_object( $input ) ) {
|
||||
foreach ( $input as $key => $val ) {
|
||||
$new_input[ $key ] = absint( $val );
|
||||
}
|
||||
}
|
||||
|
||||
return $new_input;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the settings option array and print one of its values
|
||||
*/
|
||||
public function post_type_select( $type ) {
|
||||
$options = wp_parse_args(
|
||||
get_option( 'generate_page_header_global_locations', array() ),
|
||||
''
|
||||
);
|
||||
?>
|
||||
<select id="<?php echo $type;?>" name="generate_page_header_global_locations[<?php echo $type;?>]">
|
||||
<option value=""></option>
|
||||
<?php
|
||||
$page_headers = get_posts(array(
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'title',
|
||||
'post_type' => 'generate_page_header',
|
||||
'suppress_filters' => false,
|
||||
));
|
||||
|
||||
$options[ $type ] = ! isset( $options[ $type ] ) ? '' : $options[ $type ];
|
||||
|
||||
foreach( $page_headers as $header ) {
|
||||
printf( '<option value="%1$s" %2$s>%3$s</option>',
|
||||
$header->ID,
|
||||
selected( $options[ $type ], $header->ID ),
|
||||
$header->post_title
|
||||
);
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_admin() ) {
|
||||
$generate_page_header_locations = new Generate_Page_Header_Locations();
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
/**
|
||||
* Author: Tom Usborne
|
||||
* jQuery Simple Parallax for Page Header background
|
||||
*
|
||||
*/
|
||||
|
||||
// Build the header height function
|
||||
function generateHeaderHeight() {
|
||||
// If we're not using a full screen element, bail.
|
||||
if ( ! jQuery( '.fullscreen-enabled' ).length )
|
||||
return;
|
||||
|
||||
// Set up some variables
|
||||
var page_header_content;
|
||||
var window_height = jQuery( window ).height();
|
||||
|
||||
// Get our page header content div
|
||||
if ( jQuery( '.inside-page-header' ).length ) {
|
||||
page_header_content = jQuery( '.inside-page-header' );
|
||||
} else if ( jQuery( '.generate-inside-combined-content' ).length ) {
|
||||
page_header_content = jQuery( '.generate-inside-combined-content' );
|
||||
} else {
|
||||
page_header_content = jQuery( '.generate-inside-page-header-content' );
|
||||
}
|
||||
|
||||
// Get any space above our page header
|
||||
var offset = jQuery(".fullscreen-enabled").offset().top;
|
||||
|
||||
// Apply the height to our div
|
||||
jQuery( '.fullscreen-enabled' ).css( 'height', window_height - offset + 'px' );
|
||||
|
||||
// If our page header content is taller than our window, remove the height
|
||||
if ( page_header_content.outerHeight() > ( window_height - offset ) ) {
|
||||
jQuery( '.fullscreen-enabled' ).attr( 'style', 'height: initial !important' );
|
||||
}
|
||||
}
|
||||
|
||||
jQuery(document).ready(function($) {
|
||||
|
||||
// Run the header height function
|
||||
generateHeaderHeight();
|
||||
|
||||
// Set up the resize timer
|
||||
var generateResizeTimer;
|
||||
|
||||
if ( jQuery('.generate-page-header.fullscreen-enabled')[0] ) {
|
||||
// Initiate full window height on resize
|
||||
var width = $(window).width();
|
||||
$(window).resize(function() {
|
||||
if($(window).width() != width){
|
||||
clearTimeout(generateResizeTimer);
|
||||
generateResizeTimer = setTimeout(generateHeaderHeight, 200);
|
||||
width = $(window).width();
|
||||
}
|
||||
});
|
||||
|
||||
$( window ).on( "orientationchange", function( event ) {
|
||||
if($(window).width() != width){
|
||||
clearTimeout(generateResizeTimer);
|
||||
generateResizeTimer = setTimeout(generateHeaderHeight, 200);
|
||||
width = $(window).width();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
@ -1 +0,0 @@
|
||||
function generateHeaderHeight(){if(jQuery(".fullscreen-enabled").length){var a,b=jQuery(window).height();a=jQuery(".inside-page-header").length?jQuery(".inside-page-header"):jQuery(".generate-inside-combined-content").length?jQuery(".generate-inside-combined-content"):jQuery(".generate-inside-page-header-content");var c=jQuery(".fullscreen-enabled").offset().top;jQuery(".fullscreen-enabled").css("height",b-c+"px"),a.outerHeight()>b-c&&jQuery(".fullscreen-enabled").attr("style","height: initial !important")}}function generateHeaderParallax(){var a=jQuery(".menu-toggle");if(!a.is(":visible")&&jQuery(".generate-page-header.parallax-enabled")[0]){if(jQuery(".page-header-contained")[0])var b=jQuery(".generate-page-header.parallax-enabled .inside-content-header");else var b=jQuery(".generate-page-header.parallax-enabled");var c=jQuery(this).scrollTop(),d=jQuery(".generate-page-header.parallax-enabled").data("parallax-speed");return b.css("background-position","center "+parseInt(-c/d)+"px")}}jQuery(document).ready(function(a){generateHeaderHeight();var b;if(jQuery(".generate-page-header.parallax-enabled")[0]&&a(document).scroll(function(){generateHeaderParallax()}),jQuery(".generate-page-header.fullscreen-enabled")[0]){var c=a(window).width();a(window).resize(function(){a(window).width()!=c&&(clearTimeout(b),b=setTimeout(generateHeaderHeight,200),c=a(window).width())}),a(window).on("orientationchange",function(d){a(window).width()!=c&&(clearTimeout(b),b=setTimeout(generateHeaderHeight,200),c=a(window).width())})}});
|
@ -1,9 +0,0 @@
|
||||
/*
|
||||
* Vide - v0.5.0
|
||||
* Easy as hell jQuery plugin for video backgrounds.
|
||||
* http://vodkabears.github.io/vide/
|
||||
*
|
||||
* Made by Ilya Makarov
|
||||
* Under MIT License
|
||||
*/
|
||||
!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],b):b("object"==typeof exports?require("jquery"):a.jQuery)}(this,function(a){"use strict";function b(a){var b,c,d,e,f,g,h,i={};for(f=a.replace(/\s*:\s*/g,":").replace(/\s*,\s*/g,",").split(","),h=0,g=f.length;g>h&&(c=f[h],-1===c.search(/^(http|https|ftp):\/\//)&&-1!==c.search(":"));h++)b=c.indexOf(":"),d=c.substring(0,b),e=c.substring(b+1),e||(e=void 0),"string"==typeof e&&(e="true"===e||("false"===e?!1:e)),"string"==typeof e&&(e=isNaN(e)?e:+e),i[d]=e;return null==d&&null==e?a:i}function c(a){a=""+a;var b,c,d,e=a.split(/\s+/),f="50%",g="50%";for(d=0,b=e.length;b>d;d++)c=e[d],"left"===c?f="0%":"right"===c?f="100%":"top"===c?g="0%":"bottom"===c?g="100%":"center"===c?0===d?f="50%":g="50%":0===d?f=c:g=c;return{x:f,y:g}}function d(b,c){var d=function(){c(this.src)};a('<img src="'+b+'.gif">').load(d),a('<img src="'+b+'.jpg">').load(d),a('<img src="'+b+'.jpeg">').load(d),a('<img src="'+b+'.png">').load(d)}function e(c,d,e){if(this.$element=a(c),"string"==typeof d&&(d=b(d)),e?"string"==typeof e&&(e=b(e)):e={},"string"==typeof d)d=d.replace(/\.\w*$/,"");else if("object"==typeof d)for(var f in d)d.hasOwnProperty(f)&&(d[f]=d[f].replace(/\.\w*$/,""));this.settings=a.extend({},g,e),this.path=d;try{this.init()}catch(i){if(i.message!==h)throw i}}var f="vide",g={volume:1,playbackRate:1,muted:!0,loop:!0,autoplay:!0,position:"50% 50%",posterType:"detect",resizing:!0,bgColor:"transparent",className:""},h="Not implemented";e.prototype.init=function(){var b,e,g=this,i=g.path,j=i,k="",l=g.$element,m=g.settings,n=c(m.position),o=m.posterType;e=g.$wrapper=a("<div>").addClass(m.className).css({position:"absolute","z-index":-1,top:0,left:0,bottom:0,right:0,overflow:"hidden","-webkit-background-size":"cover","-moz-background-size":"cover","-o-background-size":"cover","background-size":"cover","background-color":m.bgColor,"background-repeat":"no-repeat","background-position":n.x+" "+n.y}),"object"==typeof i&&(i.poster?j=i.poster:i.mp4?j=i.mp4:i.webm?j=i.webm:i.ogv&&(j=i.ogv)),"detect"===o?d(j,function(a){e.css("background-image","url("+a+")")}):"none"!==o&&e.css("background-image","url("+j+"."+o+")"),"static"===l.css("position")&&l.css("position","relative"),l.prepend(e),"object"==typeof i?(i.mp4&&(k+='<source src="'+i.mp4+'.mp4" type="video/mp4">'),i.webm&&(k+='<source src="'+i.webm+'.webm" type="video/webm">'),i.ogv&&(k+='<source src="'+i.ogv+'.ogv" type="video/ogg">'),b=g.$video=a("<video>"+k+"</video>")):b=g.$video=a('<video><source src="'+i+'.mp4" type="video/mp4"><source src="'+i+'.webm" type="video/webm"><source src="'+i+'.ogv" type="video/ogg"></video>');try{b.prop({autoplay:m.autoplay,loop:m.loop,volume:m.volume,muted:m.muted,defaultMuted:m.muted,playbackRate:m.playbackRate,defaultPlaybackRate:m.playbackRate})}catch(p){throw new Error(h)}b.css({margin:"auto",position:"absolute","z-index":-1,top:n.y,left:n.x,"-webkit-transform":"translate(-"+n.x+", -"+n.y+")","-ms-transform":"translate(-"+n.x+", -"+n.y+")","-moz-transform":"translate(-"+n.x+", -"+n.y+")",transform:"translate(-"+n.x+", -"+n.y+")",visibility:"hidden",opacity:0}).one("canplaythrough."+f,function(){g.resize()}).one("playing."+f,function(){b.css({visibility:"visible",opacity:1}),e.css("background-image","none")}),l.on("resize."+f,function(){m.resizing&&g.resize()}),e.append(b)},e.prototype.getVideoObject=function(){return this.$video[0]},e.prototype.resize=function(){if(this.$video){var a=this.$wrapper,b=this.$video,c=b[0],d=c.videoHeight,e=c.videoWidth,f=a.height(),g=a.width();g/e>f/d?b.css({width:g+2,height:"auto"}):b.css({width:"auto",height:f+2})}},e.prototype.destroy=function(){delete a[f].lookup[this.index],this.$video&&this.$video.off(f),this.$element.off(f).removeData(f),this.$wrapper.remove()},a[f]={lookup:[]},a.fn[f]=function(b,c){var d;return this.each(function(){d=a.data(this,f),d&&d.destroy(),d=new e(this,b,c),d.index=a[f].lookup.push(d)-1,a.data(this,f,d)}),this},a(document).ready(function(){var b=a(window);b.on("resize."+f,function(){for(var b,c=a[f].lookup.length,d=0;c>d;d++)b=a[f].lookup[d],b&&b.settings.resizing&&b.resize()}),b.on("unload."+f,function(){return!1}),a(document).find("[data-"+f+"-bg]").each(function(b,c){var d=a(c),e=d.data(f+"-options"),g=d.data(f+"-bg");d[f](g,e)})})});jQuery(document).ready(function($) {var page_header_content = $( '.page-header-content' );if ( page_header_content.length ) {if ( page_header_content.hasClass( 'grid-container' ) ) {$( '.inside-page-header-container' ).data('vide').getVideoObject().play();} else {page_header_content.data('vide').getVideoObject().play();}}});
|
@ -1,149 +0,0 @@
|
||||
/**
|
||||
* lc_switch.js
|
||||
* Version: 1.0
|
||||
* Author: LCweb - Luca Montanari
|
||||
* Website: http://www.lcweb.it
|
||||
* Licensed under the MIT license
|
||||
*/
|
||||
|
||||
(function($){
|
||||
if(typeof($.fn.lc_switch) != 'undefined') {return false;} // prevent dmultiple scripts inits
|
||||
|
||||
$.fn.lc_switch = function(on_text, off_text) {
|
||||
|
||||
// destruct
|
||||
$.fn.lcs_destroy = function() {
|
||||
|
||||
$(this).each(function() {
|
||||
var $wrap = $(this).parents('.lcs_wrap');
|
||||
|
||||
$wrap.children().not('input').remove();
|
||||
$(this).unwrap();
|
||||
});
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
// set to ON
|
||||
$.fn.lcs_on = function() {
|
||||
|
||||
$(this).each(function() {
|
||||
var $wrap = $(this).parents('.lcs_wrap');
|
||||
var $input = $wrap.find('input');
|
||||
|
||||
if(typeof($.fn.prop) == 'function') {
|
||||
$wrap.find('input').prop('checked', true);
|
||||
} else {
|
||||
$wrap.find('input').attr('checked', true);
|
||||
}
|
||||
|
||||
$wrap.find('input').trigger('lcs-on');
|
||||
$wrap.find('input').trigger('lcs-statuschange');
|
||||
$wrap.find('.lcs_switch').removeClass('lcs_off').addClass('lcs_on');
|
||||
|
||||
// if radio - disable other ones
|
||||
if( $wrap.find('.lcs_switch').hasClass('lcs_radio_switch') ) {
|
||||
var f_name = $input.attr('name');
|
||||
$wrap.parents('form').find('input[name='+f_name+']').not($input).lcs_off();
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
// set to OFF
|
||||
$.fn.lcs_off = function() {
|
||||
|
||||
$(this).each(function() {
|
||||
var $wrap = $(this).parents('.lcs_wrap');
|
||||
|
||||
if(typeof($.fn.prop) == 'function') {
|
||||
$wrap.find('input').prop('checked', false);
|
||||
} else {
|
||||
$wrap.find('input').attr('checked', false);
|
||||
}
|
||||
|
||||
$wrap.find('input').trigger('lcs-off');
|
||||
$wrap.find('input').trigger('lcs-statuschange');
|
||||
$wrap.find('.lcs_switch').removeClass('lcs_on').addClass('lcs_off');
|
||||
});
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
// construct
|
||||
return this.each(function(){
|
||||
|
||||
// check against double init
|
||||
if( !$(this).parent().hasClass('lcs_wrap') ) {
|
||||
|
||||
// default texts
|
||||
var ckd_on_txt = (typeof(on_text) == 'undefined') ? 'ON' : on_text;
|
||||
var ckd_off_txt = (typeof(off_text) == 'undefined') ? 'OFF' : off_text;
|
||||
|
||||
// labels structure
|
||||
var on_label = (ckd_on_txt) ? '<div class="lcs_label lcs_label_on">'+ ckd_on_txt +'</div>' : '';
|
||||
var off_label = (ckd_off_txt) ? '<div class="lcs_label lcs_label_off">'+ ckd_off_txt +'</div>' : '';
|
||||
|
||||
|
||||
// default states
|
||||
var disabled = ($(this).is(':disabled')) ? true: false;
|
||||
var active = ($(this).is(':checked')) ? true : false;
|
||||
|
||||
var status_classes = '';
|
||||
status_classes += (active) ? ' lcs_on' : ' lcs_off';
|
||||
if(disabled) {status_classes += ' lcs_disabled';}
|
||||
|
||||
|
||||
// wrap and append
|
||||
var structure =
|
||||
'<div class="lcs_switch '+status_classes+'">' +
|
||||
'<div class="lcs_cursor"></div>' +
|
||||
on_label + off_label +
|
||||
'</div>';
|
||||
|
||||
if( $(this).is(':input') && ($(this).attr('type') == 'checkbox' || $(this).attr('type') == 'radio') ) {
|
||||
|
||||
$(this).wrap('<div class="lcs_wrap"></div>');
|
||||
$(this).parent().append(structure);
|
||||
|
||||
$(this).parent().find('.lcs_switch').addClass('lcs_'+ $(this).attr('type') +'_switch');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
// handlers
|
||||
$(document).ready(function() {
|
||||
|
||||
// on click
|
||||
$(document).delegate('.lcs_switch:not(.lcs_disabled)', 'click tap', function(e) {
|
||||
|
||||
if( $(this).hasClass('lcs_on') ) {
|
||||
if( !$(this).hasClass('lcs_radio_switch') ) { // not for radio
|
||||
$(this).lcs_off();
|
||||
}
|
||||
} else {
|
||||
$(this).lcs_on();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// on checkbox status change
|
||||
$(document).delegate('.lcs_wrap input', 'change', function() {
|
||||
|
||||
if( $(this).is(':checked') ) {
|
||||
$(this).lcs_on();
|
||||
} else {
|
||||
$(this).lcs_off();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
})(jQuery);
|
@ -1,220 +0,0 @@
|
||||
jQuery(document).ready(function($) {
|
||||
$( '#generate-tabs-container input[type="checkbox"]' ).lc_switch( '', '' );
|
||||
|
||||
$( '.generate-tabs-menu a' ).on( 'click', function( event ) {
|
||||
event.preventDefault();
|
||||
$( this ).parent().addClass( 'generate-current' );
|
||||
$( this ).parent().siblings().removeClass( 'generate-current' );
|
||||
var tab = $( this ).attr( 'href' );
|
||||
$( '.generate-tab-content' ).not(tab).css( 'display', 'none' );
|
||||
$( tab ).fadeIn( 100 );
|
||||
|
||||
if ( '#generate-image-tab' == tab || '#generate-content-tab' == tab ) {
|
||||
$( '.show-in-excerpt' ).show();
|
||||
} else {
|
||||
$( '.show-in-excerpt' ).hide();
|
||||
}
|
||||
} );
|
||||
|
||||
$( '#_meta-generate-page-header-content' ).on( 'input change', function() {
|
||||
if ( this.value.length ) {
|
||||
$( '.page-header-content-required' ).hide();
|
||||
} else {
|
||||
$( '.page-header-content-required' ).show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
jQuery(window).on('load', function() {
|
||||
if ( jQuery( '#_meta-generate-page-header-enable-image-crop' ).val() == 'enable' ) {
|
||||
jQuery( '#crop-enabled' ).show();
|
||||
}
|
||||
|
||||
jQuery( '#_meta-generate-page-header-enable-image-crop' ).change(function () {
|
||||
if ( jQuery( this ).val() === 'enable' ) {
|
||||
jQuery( '#crop-enabled' ).show();
|
||||
} else {
|
||||
jQuery( '#crop-enabled' ).hide();
|
||||
}
|
||||
});
|
||||
|
||||
if ( jQuery( '#_meta-generate-page-header-image-background' ).is( ':checked' ) ) {
|
||||
jQuery( '.parallax' ).show();
|
||||
} else {
|
||||
jQuery( '.parallax' ).hide();
|
||||
}
|
||||
|
||||
jQuery('body').delegate('.image-background', 'lcs-statuschange', function() {
|
||||
if (jQuery(this).is(":checked")) {
|
||||
jQuery('.parallax').show();
|
||||
} else {
|
||||
jQuery('.parallax').hide();
|
||||
jQuery('#_meta-generate-page-header-image-background-fixed').lcs_off();
|
||||
}
|
||||
});
|
||||
|
||||
if ( jQuery('#_meta-generate-page-header-full-screen').is(':checked')) {
|
||||
jQuery('.vertical-center').show();
|
||||
} else {
|
||||
jQuery('.vertical-center').hide();
|
||||
}
|
||||
|
||||
jQuery('body').delegate('#_meta-generate-page-header-full-screen', 'lcs-statuschange', function() {
|
||||
if (jQuery(this).is(":checked")) {
|
||||
jQuery('.vertical-center').show();
|
||||
} else {
|
||||
jQuery('.vertical-center').hide();
|
||||
jQuery('#_meta-generate-page-header-vertical-center').lcs_off();
|
||||
}
|
||||
});
|
||||
|
||||
if ( jQuery('#_meta-generate-page-header-transparent-navigation').is(':checked')) {
|
||||
jQuery('.navigation-colors').show();
|
||||
} else {
|
||||
jQuery('.navigation-colors').hide();
|
||||
}
|
||||
|
||||
jQuery('body').delegate('#_meta-generate-page-header-transparent-navigation', 'lcs-statuschange', function() {
|
||||
if (jQuery(this).is(":checked")) {
|
||||
jQuery('.navigation-colors').show();
|
||||
} else {
|
||||
jQuery('.navigation-colors').hide();
|
||||
}
|
||||
});
|
||||
|
||||
if ( jQuery('#_meta-generate-page-header-combine').is(':checked')) {
|
||||
jQuery('.combination-options').show();
|
||||
} else {
|
||||
jQuery('.combination-options').hide();
|
||||
}
|
||||
|
||||
jQuery('body').delegate('#_meta-generate-page-header-combine', 'lcs-statuschange', function() {
|
||||
if (jQuery(this).is(":checked")) {
|
||||
jQuery('.combination-options').show();
|
||||
} else {
|
||||
jQuery('.combination-options').hide();
|
||||
}
|
||||
});
|
||||
|
||||
if ( jQuery('#_meta-generate-page-header-image-background-type').val() == '' ) {
|
||||
jQuery('.vertical-center').hide();
|
||||
jQuery('.fullscreen').hide();
|
||||
}
|
||||
jQuery('#_meta-generate-page-header-image-background-type').change(function () {
|
||||
if (jQuery(this).val() === '') {
|
||||
jQuery('.vertical-center').hide();
|
||||
jQuery('#_meta-generate-page-header-vertical-center').lcs_off();
|
||||
jQuery('.fullscreen').hide();
|
||||
jQuery('#_meta-generate-page-header-full-screen').lcs_off();
|
||||
} else {
|
||||
//jQuery('.vertical-center').show();
|
||||
jQuery('.fullscreen').show();
|
||||
}
|
||||
});
|
||||
|
||||
var $set_button = jQuery('.generate-upload-file');
|
||||
/**
|
||||
* open the media manager
|
||||
*/
|
||||
$set_button.click(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var $thisbutton = jQuery(this);
|
||||
var frame = wp.media({
|
||||
title : $thisbutton.data('title'),
|
||||
multiple : false,
|
||||
library : { type : $thisbutton.data('type') },
|
||||
button : { text : $thisbutton.data('insert') }
|
||||
});
|
||||
// close event media manager
|
||||
frame.on('select', function () {
|
||||
var attachment = frame.state().get('selection').first().toJSON();
|
||||
// set the file
|
||||
//set_dfi(attachment.url);
|
||||
$thisbutton.prev('input').val(attachment.url);
|
||||
$thisbutton.nextAll('input.image-id').val(attachment.id);
|
||||
if ( $thisbutton.data('prev') === true ) {
|
||||
$thisbutton.prev('input').prevAll('#preview-image').children('.saved-image').remove();
|
||||
$thisbutton.prev('input').prevAll('#preview-image').append('<img src="' + attachment.url + '" width="100" class="saved-image" style="margin-bottom:12px;" />');
|
||||
}
|
||||
$thisbutton.nextAll( '.generate-page-header-remove-image' ).show();
|
||||
if ( 'upload_image' == $thisbutton.prev( 'input' ).attr( 'id' ) ) {
|
||||
jQuery( '.featured-image-message' ).hide();
|
||||
jQuery( '.page-header-image-settings' ).show();
|
||||
jQuery( '.generate-page-header-set-featured-image' ).hide();
|
||||
}
|
||||
});
|
||||
|
||||
// everthing is set open the media manager
|
||||
frame.open();
|
||||
});
|
||||
});
|
||||
jQuery(document).ready(function($) {
|
||||
$('#generate-tabs-container .color-picker').wpColorPicker();
|
||||
|
||||
jQuery( '.generate-page-header-remove-image' ).on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
var input = jQuery( this ).data( 'input' );
|
||||
var input_id = jQuery( this ).data( 'input-id' );
|
||||
var preview = jQuery( this ).data( 'prev' );
|
||||
jQuery( input ).attr( 'value', '' );
|
||||
jQuery( input_id ).attr( 'value', '' );
|
||||
jQuery( preview ).children( '.saved-image' ).remove();
|
||||
jQuery( this ).hide();
|
||||
if ( '-1' == jQuery( '#_thumbnail_id' ).attr( 'value' ) ) {
|
||||
jQuery( '.page-header-image-settings' ).hide();
|
||||
jQuery( '.generate-page-header-set-featured-image' ).show();
|
||||
|
||||
} else {
|
||||
jQuery( '.generate-page-header-set-featured-image' ).hide();
|
||||
jQuery( '.page-header-image-settings' ).show();
|
||||
jQuery( '.featured-image-message' ).show();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#postimagediv').on( 'click', '#remove-post-thumbnail', function() {
|
||||
// The featured image is gone, so we can hide the message
|
||||
jQuery( '.featured-image-message' ).hide();
|
||||
|
||||
// If there's no other image set, we can hide the image settings
|
||||
if ( '' == jQuery( '#_meta-generate-page-header-image-id' ).attr( 'value' ) ) {
|
||||
jQuery( '.page-header-image-settings' ).hide();
|
||||
jQuery( '.generate-page-header-set-featured-image' ).show();
|
||||
}
|
||||
|
||||
// No more featured image means we can show the 'show excerpt' option
|
||||
jQuery( '.show-in-excerpt' ).show();
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
wp.media.featuredImage.frame().on('select', function() {
|
||||
|
||||
// We have a featured image, so the 'show excerpt' function isn't necessary
|
||||
jQuery( '.show-in-excerpt' ).hide();
|
||||
|
||||
// We can stop here if we have a custom image set
|
||||
if ( '' !== jQuery( '#_meta-generate-page-header-image-id' ).attr( 'value' ) )
|
||||
return;
|
||||
|
||||
// Hide the set your featured image message
|
||||
jQuery( '.generate-page-header-set-featured-image' ).hide();
|
||||
|
||||
// Show the "using feaured image" message
|
||||
jQuery( '.featured-image-message' ).show();
|
||||
|
||||
// Show the image settings (image link, resizing etc..)
|
||||
jQuery( '.page-header-image-settings' ).show();
|
||||
});
|
||||
|
||||
$( '.generate-featured-image, .generate-page-header-set-featured-image a' ).on( 'click', function( event ) {
|
||||
event.preventDefault();
|
||||
|
||||
// Stop propagation to prevent thickbox from activating.
|
||||
event.stopPropagation();
|
||||
|
||||
// Open the featured image modal
|
||||
wp.media.featuredImage.frame().open();
|
||||
});
|
||||
});
|
@ -1,17 +0,0 @@
|
||||
function generate_parallax_element( selector, context ) {
|
||||
context = context || document;
|
||||
var elements = context.querySelectorAll( selector );
|
||||
return Array.prototype.slice.call( elements );
|
||||
}
|
||||
|
||||
window.addEventListener( "scroll", function() {
|
||||
var scrolledHeight= window.pageYOffset;
|
||||
generate_parallax_element( ".parallax-enabled" ).forEach( function( el, index, array ) {
|
||||
var limit = el.offsetTop + el.offsetHeight;
|
||||
if( scrolledHeight > el.offsetTop && scrolledHeight <= limit ) {
|
||||
el.style.backgroundPositionY = ( scrolledHeight - el.offsetTop ) / el.getAttribute( 'data-parallax-speed' ) + "px";
|
||||
} else {
|
||||
el.style.backgroundPositionY = "0";
|
||||
}
|
||||
});
|
||||
});
|
@ -1 +0,0 @@
|
||||
function generate_parallax_element(e,t){var a=(t=t||document).querySelectorAll(e);return Array.prototype.slice.call(a)}window.addEventListener("scroll",function(){var e=window.pageYOffset;generate_parallax_element(".parallax-enabled").forEach(function(t,a,o){var r=t.offsetTop+t.offsetHeight;e>t.offsetTop&&e<=r?t.style.backgroundPositionY=(e-t.offsetTop)/t.getAttribute("data-parallax-speed")+"px":t.style.backgroundPositionY="0"})});
|
@ -1,782 +0,0 @@
|
||||
<?php
|
||||
defined( 'WPINC' ) or die;
|
||||
|
||||
if ( ! function_exists( 'add_generate_page_header_meta_box' ) ) {
|
||||
add_action( 'add_meta_boxes', 'add_generate_page_header_meta_box', 50 );
|
||||
/**
|
||||
* Generate the page header metabox.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function add_generate_page_header_meta_box() {
|
||||
// Set user role - make filterable
|
||||
$allowed = apply_filters( 'generate_page_header_metabox_capability', 'edit_posts' );
|
||||
|
||||
// If not an administrator, don't show the metabox
|
||||
if ( ! current_user_can( $allowed ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$stored_meta = (array) get_post_meta( get_the_ID() );
|
||||
|
||||
// Set defaults to avoid PHP notices
|
||||
$stored_meta['_meta-generate-page-header-image'][0] = ( isset( $stored_meta['_meta-generate-page-header-image'][0] ) ) ? $stored_meta['_meta-generate-page-header-image'][0] : '';
|
||||
$stored_meta['_meta-generate-page-header-image-id'][0] = ( isset( $stored_meta['_meta-generate-page-header-image-id'][0] ) ) ? $stored_meta['_meta-generate-page-header-image-id'][0] : '';
|
||||
$stored_meta['_meta-generate-page-header-content'][0] = ( isset( $stored_meta['_meta-generate-page-header-content'][0] ) ) ? $stored_meta['_meta-generate-page-header-content'][0] : '';
|
||||
|
||||
$args = array( 'public' => true );
|
||||
$post_types = get_post_types( $args );
|
||||
|
||||
// Bail if we're not using the old Page Header meta box
|
||||
if ( 'generate_page_header' !== get_post_type() && '' == $stored_meta['_meta-generate-page-header-content'][0] && '' == $stored_meta['_meta-generate-page-header-image'][0] && '' == $stored_meta['_meta-generate-page-header-image-id'][0] ) {
|
||||
if ( ! defined( 'GENERATE_LAYOUT_META_BOX' ) ) {
|
||||
foreach ( $post_types as $type ) {
|
||||
if ( 'attachment' !== $type ) {
|
||||
add_meta_box(
|
||||
'generate_select_page_header_meta_box',
|
||||
__( 'Page Header', 'gp-premium' ),
|
||||
'generate_do_select_page_header_meta_box',
|
||||
$type,
|
||||
'normal',
|
||||
'high'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! apply_filters( 'generate_page_header_legacy_metabox', false ) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
array_push( $post_types, 'generate_page_header' );
|
||||
foreach ($post_types as $type) {
|
||||
if ( 'attachment' !== $type ) {
|
||||
add_meta_box(
|
||||
'generate_page_header_meta_box',
|
||||
__( 'Page Header', 'gp-premium' ),
|
||||
'show_generate_page_header_meta_box',
|
||||
$type,
|
||||
'normal',
|
||||
'high'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_page_header_metabox_enqueue' ) ) {
|
||||
add_action( 'admin_enqueue_scripts', 'generate_page_header_metabox_enqueue' );
|
||||
/**
|
||||
* Add our metabox scripts
|
||||
*/
|
||||
function generate_page_header_metabox_enqueue( $hook ) {
|
||||
// I prefer to enqueue the styles only on pages that are using the metaboxes
|
||||
if ( in_array( $hook, array( "post.php", "post-new.php" ) ) ) {
|
||||
$args = array( 'public' => true );
|
||||
$post_types = get_post_types( $args );
|
||||
|
||||
$screen = get_current_screen();
|
||||
$post_type = $screen->id;
|
||||
|
||||
if ( in_array( $post_type, (array) $post_types ) || 'generate_page_header' == get_post_type() ){
|
||||
wp_enqueue_media();
|
||||
wp_enqueue_script( 'wp-color-picker' );
|
||||
wp_enqueue_style( 'wp-color-picker' );
|
||||
wp_enqueue_script( 'wp-color-picker-alpha', GP_LIBRARY_DIRECTORY_URL . 'alpha-color-picker/wp-color-picker-alpha.min.js', array( 'wp-color-picker' ), '3.0.0', true );
|
||||
|
||||
wp_add_inline_script(
|
||||
'wp-color-picker-alpha',
|
||||
'jQuery( function() { jQuery( ".color-picker" ).wpColorPicker(); } );'
|
||||
);
|
||||
|
||||
wp_enqueue_style( 'generate-page-header-metabox', plugin_dir_url( __FILE__ ) . 'css/metabox.css', array(), GENERATE_PAGE_HEADER_VERSION );
|
||||
wp_enqueue_script( 'generate-lc-switch', plugin_dir_url( __FILE__ ) . 'js/lc_switch.js', array( 'jquery' ), GENERATE_PAGE_HEADER_VERSION, false );
|
||||
wp_enqueue_script( 'generate-page-header-metabox', plugin_dir_url( __FILE__ ) . 'js/metabox.js', array( 'jquery','generate-lc-switch', 'wp-color-picker' ), GENERATE_PAGE_HEADER_VERSION, false );
|
||||
|
||||
if ( function_exists( 'wp_add_inline_script' ) && function_exists( 'generate_get_default_color_palettes' ) ) {
|
||||
// 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 . ';' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build our Select Page Header meta box.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
function generate_do_select_page_header_meta_box( $post ) {
|
||||
wp_nonce_field( basename( __FILE__ ), 'generate_page_header_nonce' );
|
||||
$stored_meta = get_post_meta( $post->ID );
|
||||
$stored_meta['_generate-select-page-header'][0] = ( isset( $stored_meta['_generate-select-page-header'][0] ) ) ? $stored_meta['_generate-select-page-header'][0] : '';
|
||||
|
||||
$page_headers = get_posts(array(
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'title',
|
||||
'post_type' => 'generate_page_header',
|
||||
));
|
||||
|
||||
if ( count( $page_headers ) > 0 ) :
|
||||
?>
|
||||
<p>
|
||||
<select name="_generate-select-page-header" id="_generate-select-page-header">
|
||||
<option value="" <?php selected( $stored_meta['_generate-select-page-header'][0], '' ); ?>></option>
|
||||
<?php
|
||||
foreach( $page_headers as $header ) {
|
||||
printf( '<option value="%1$s" %2$s>%3$s</option>',
|
||||
$header->ID,
|
||||
selected( $stored_meta['_generate-select-page-header'][0], $header->ID ),
|
||||
$header->post_title
|
||||
);
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</p>
|
||||
<?php else : ?>
|
||||
<p>
|
||||
<?php
|
||||
printf( __( 'No Page Headers found. Want to <a href="%1$s" target="_blank">create one</a>?', 'gp-premium' ),
|
||||
esc_url( admin_url( 'post-new.php?post_type=generate_page_header' ) )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<?php endif;
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'show_generate_page_header_meta_box' ) ) {
|
||||
/**
|
||||
* Outputs the content of the metabox
|
||||
* This could use some cleaning up
|
||||
*/
|
||||
function show_generate_page_header_meta_box( $post ) {
|
||||
wp_nonce_field( basename( __FILE__ ), 'generate_page_header_nonce' );
|
||||
$show_excerpt_option = ( has_post_thumbnail() ) ? 'style="display:none;"' : 'style="display:block;"';
|
||||
|
||||
$content_required = sprintf(
|
||||
'<div class="page-header-content-required" %2$s><p>%1$s</p></div>',
|
||||
__( 'Content is required for the below settings to work.', 'gp-premium' ),
|
||||
'' !== generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-content', true ) ? 'style="display:none"' : ''
|
||||
);
|
||||
|
||||
if ( '' !== generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-content', true ) ) {
|
||||
?>
|
||||
<script>
|
||||
jQuery( function( $ ) {
|
||||
$('#generate-image-tab').hide();
|
||||
$('#generate-content-tab').show();
|
||||
$('.generate-tabs-menu .content-settings').addClass('generate-current');
|
||||
$('.generate-tabs-menu .image-settings').removeClass('generate-current');
|
||||
} );
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div id="generate-tabs-container">
|
||||
<ul class="generate-tabs-menu">
|
||||
<li class="generate-current image-settings">
|
||||
<a href="#generate-image-tab"><?php _e( 'Image', 'gp-premium' ); ?></a>
|
||||
</li>
|
||||
|
||||
<li class="content-settings">
|
||||
<a href="#generate-content-tab"><?php _e( 'Content', 'gp-premium' ); ?></a>
|
||||
</li>
|
||||
|
||||
<li class="video-settings">
|
||||
<a href="#generate-video-background-tab"><?php _e( 'Background Video', 'gp-premium' ); ?></a>
|
||||
</li>
|
||||
|
||||
<?php if ( generate_page_header_logo_exists() || generate_page_header_navigation_logo_exists() ) : ?>
|
||||
<li class="logo-settings">
|
||||
<a href="#generate-logo-tab"><?php _e( 'Logo', 'gp-premium' ); ?></a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<li class="advanced-settings">
|
||||
<a href="#generate-advanced-tab"><?php _e( 'Advanced', 'gp-premium' ); ?></a>
|
||||
</li>
|
||||
|
||||
<?php if ( 'post' == get_post_type() && !is_single() ) : ?>
|
||||
<div class="show-in-excerpt" <?php echo $show_excerpt_option; ?>>
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-add-to-excerpt"><strong><?php _e( 'Add to excerpt', 'gp-premium' );?></strong></label><br />
|
||||
<input class="add-to-excerpt" type="checkbox" name="_meta-generate-page-header-add-to-excerpt" id="_meta-generate-page-header-add-to-excerpt" value="yes" <?php checked( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-add-to-excerpt', true ), 'yes' ); ?> />
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
<div class="generate-tab">
|
||||
<div id="generate-image-tab" class="generate-tab-content" style="display:block;">
|
||||
<?php
|
||||
$show_featured_image_message = ( has_post_thumbnail() && '' == generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-id', true ) ) ? 'style="display:block;"' : 'style="display:none;"';
|
||||
$remove_button = ( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image', true ) != "") ? 'style="display:inline-block;"' : 'style="display:none;"';
|
||||
$show_image_settings = ( has_post_thumbnail() || '' !== generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-id', true ) ) ? 'style="display:block;"' : 'style="display: none;"';
|
||||
$no_image_selected = ( ! has_post_thumbnail() && '' == generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-id', true ) ) ? 'style="display:block;"' : 'style="display:none;"';
|
||||
?>
|
||||
<div class="featured-image-message" <?php echo $show_featured_image_message; ?>>
|
||||
<p class="description">
|
||||
<?php _e( 'Currently using your <a href="#" class="generate-featured-image">featured image</a>.', 'gp-premium' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="preview-image" class="generate-page-header-image">
|
||||
<?php if( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image', true ) != "") { ?>
|
||||
<img class="saved-image" src="<?php echo esc_url( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image', true ) );?>" width="100" style="margin-bottom:12px;" />
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<input data-prev="true" id="upload_image" type="hidden" name="_meta-generate-page-header-image" value="<?php echo esc_url(generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image', true )); ?>" />
|
||||
<button class="generate-upload-file button" type="button" data-type="image" data-title="<?php _e( 'Page Header Image', 'gp-premium' );?>" data-insert="<?php _e( 'Insert Image', 'gp-premium' ); ?>" data-prev="true">
|
||||
<?php _e( 'Choose Image', 'gp-premium' ) ;?>
|
||||
</button>
|
||||
<button class="generate-page-header-remove-image button" type="button" <?php echo $remove_button; ?> data-input="#upload_image" data-input-id="#_meta-generate-page-header-image-id" data-prev=".generate-page-header-image">
|
||||
<?php _e( 'Remove Image', 'gp-premium' ) ;?>
|
||||
</button>
|
||||
<input class="image-id" id="_meta-generate-page-header-image-id" type="hidden" name="_meta-generate-page-header-image-id" value="<?php echo esc_attr( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-id', true ) ); ?>" />
|
||||
|
||||
<div class="generate-page-header-set-featured-image" <?php echo $no_image_selected; ?>>
|
||||
<p class="description"><?php _e( 'Or you can <a href="#">set the featured image</a>.', 'gp-premium' ); ?></p>
|
||||
</div>
|
||||
|
||||
<div class="page-header-image-settings" <?php echo $show_image_settings; ?>>
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-image-link" class="example-row-title"><strong><?php _e( 'Image Link', 'gp-premium' );?></strong></label><br />
|
||||
<input class="widefat" style="max-width:350px;" placeholder="http://" id="_meta-generate-page-header-image-link" type="text" name="_meta-generate-page-header-image-link" value="<?php echo esc_url(generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-link', true )); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-enable-image-crop" class="example-row-title"><strong><?php _e( 'Resize Image', 'gp-premium' );?></strong></label><br />
|
||||
<select name="_meta-generate-page-header-enable-image-crop" id="_meta-generate-page-header-enable-image-crop">
|
||||
<option value="" <?php selected( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-enable-image-crop', true ), '' ); ?>><?php _e( 'Disable', 'gp-premium' );?></option>
|
||||
<option value="enable" <?php selected( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-enable-image-crop', true ), 'enable' ); ?>><?php _e( 'Enable', 'gp-premium' );?></option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<div id="crop-enabled" style="display:none">
|
||||
<p><?php _e( 'These options are no longer available as of GP Premium 1.10.0.', 'gp-premium' ); ?>
|
||||
<div style="display: none;">
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-image-width" class="example-row-title"><strong><?php _e( 'Image Width', 'gp-premium' );?></strong></label><br />
|
||||
<input style="width:45px" type="text" name="_meta-generate-page-header-image-width" id="_meta-generate-page-header-image-width" value="<?php echo intval( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-width', true ) ); ?>" /><label for="_meta-generate-page-header-image-width"><span class="pixels">px</span></label>
|
||||
</p>
|
||||
|
||||
<p style="margin-bottom:0;">
|
||||
<label for="_meta-generate-page-header-image-height" class="example-row-title"><strong><?php _e( 'Image Height', 'gp-premium' );?></strong></label><br />
|
||||
<input placeholder="" style="width:45px" type="text" name="_meta-generate-page-header-image-height" id="_meta-generate-page-header-image-height" value="<?php echo intval( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-height', true ) ); ?>" />
|
||||
<label for="_meta-generate-page-header-image-height"><span class="pixels">px</span></label>
|
||||
<span class="description" style="display:block;"><?php _e( 'Use "0" or leave blank for proportional resizing.', 'gp-premium' );?></span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="generate-content-tab" class="generate-tab-content">
|
||||
|
||||
<textarea style="width:100%;min-height:200px;" name="_meta-generate-page-header-content" id="_meta-generate-page-header-content"><?php echo esc_textarea( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-content', true ) ); ?></textarea>
|
||||
<p class="description" style="margin:0;"><?php _e( 'HTML and shortcodes allowed.', 'gp-premium' );?></p>
|
||||
|
||||
<div style="margin-top:12px;">
|
||||
<?php echo $content_required; ?>
|
||||
<div class="page-header-column">
|
||||
<p>
|
||||
<input type="checkbox" name="_meta-generate-page-header-content-autop" id="_meta-generate-page-header-content-autop" value="yes" <?php checked( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-content-autop', true ), 'yes' ); ?> />
|
||||
<label for="_meta-generate-page-header-content-autop"><?php _e( 'Automatically add paragraphs', 'gp-premium' );?></label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input type="checkbox" name="_meta-generate-page-header-content-padding" id="_meta-generate-page-header-content-padding" value="yes" <?php checked( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-content-padding', true ), 'yes' ); ?> />
|
||||
<label for="_meta-generate-page-header-content-padding"><?php _e( 'Add Padding', 'gp-premium' );?></label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input class="image-background" type="checkbox" name="_meta-generate-page-header-image-background" id="_meta-generate-page-header-image-background" value="yes" <?php checked( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-background', true ), 'yes' ); ?> />
|
||||
<label for="_meta-generate-page-header-image-background"><?php _e( 'Add Background Image', 'gp-premium' );?></label>
|
||||
</p>
|
||||
|
||||
<p class="parallax">
|
||||
<input type="checkbox" name="_meta-generate-page-header-image-background-overlay" id="_meta-generate-page-header-image-background-overlay" value="yes" <?php checked( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-background-overlay', true ), 'yes' ); ?> />
|
||||
<label for="_meta-generate-page-header-image-background-overlay"><?php _e( 'Use background color as overlay', 'gp-premium' );?></label>
|
||||
</p>
|
||||
|
||||
<p class="parallax">
|
||||
<input type="checkbox" name="_meta-generate-page-header-image-background-fixed" id="_meta-generate-page-header-image-background-fixed" value="yes" <?php checked( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-background-fixed', true ), 'yes' ); ?> />
|
||||
<label for="_meta-generate-page-header-image-background-fixed"><?php _e( 'Parallax Effect', 'gp-premium' );?></label>
|
||||
</p>
|
||||
|
||||
<p class="fullscreen">
|
||||
<input type="checkbox" name="_meta-generate-page-header-full-screen" id="_meta-generate-page-header-full-screen" value="yes" <?php checked( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-full-screen', true ), 'yes' ); ?> />
|
||||
<label for="_meta-generate-page-header-full-screen"><?php _e( 'Full Screen', 'gp-premium' );?></label>
|
||||
</p>
|
||||
|
||||
<p class="vertical-center">
|
||||
<input type="checkbox" name="_meta-generate-page-header-vertical-center" id="_meta-generate-page-header-vertical-center" value="yes" <?php checked( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-vertical-center', true ), 'yes' ); ?> />
|
||||
<label for="_meta-generate-page-header-vertical-center"><?php _e( 'Vertical center content', 'gp-premium' );?></label>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="page-header-column">
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-image-background-type" class="example-row-title"><strong><?php _e( 'Container', 'gp-premium' );?></strong></label><br />
|
||||
<select name="_meta-generate-page-header-image-background-type" id="_meta-generate-page-header-image-background-type">
|
||||
<option value="" <?php selected( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-background-type', true ), '' ); ?>><?php _ex( 'Contained', 'Width', 'gp-premium' );?></option>
|
||||
<option value="fluid" <?php selected( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-background-type', true ), 'fluid' ); ?>><?php _e( 'Full Width', 'gp-premium' );?></option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-image-background-type" class="example-row-title"><strong><?php _e( 'Inner Container', 'gp-premium' );?></strong></label><br />
|
||||
<select name="_meta-generate-page-header-inner-container" id="_meta-generate-page-header-inner-container">
|
||||
<option value="" <?php selected( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-inner-container', true ), '' ); ?>><?php _ex( 'Contained', 'Width', 'gp-premium' );?></option>
|
||||
<option value="full" <?php selected( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-inner-container', true ), 'full' ); ?>><?php _e( 'Full Width', 'gp-premium' );?></option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-image-background-alignment" class="example-row-title"><strong><?php _e( 'Text Alignment', 'gp-premium' );?></strong></label><br />
|
||||
<select name="_meta-generate-page-header-image-background-alignment" id="_meta-generate-page-header-image-background-alignment">
|
||||
<option value="" <?php selected( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-background-alignment', true ), '' ); ?>><?php _e( 'Left', 'gp-premium' );?></option>
|
||||
<option value="center" <?php selected( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-background-alignment', true ), 'center' ); ?>><?php _e( 'Center', 'gp-premium' );?></option>
|
||||
<option value="right" <?php selected( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-background-alignment', true ), 'right' ); ?>><?php _e( 'Right', 'gp-premium' );?></option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-image-background-spacing" class="example-row-title"><strong><?php _e( 'Top & Bottom Padding', 'gp-premium' );?></strong></label><br />
|
||||
<input placeholder="" style="width:45px" type="text" name="_meta-generate-page-header-image-background-spacing" id="_meta-generate-page-header-image-background-spacing" value="<?php echo esc_attr( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-background-spacing', true ) ); ?>" />
|
||||
<select name="_meta-generate-page-header-image-background-spacing-unit" id="_meta-generate-page-header-image-background-spacing-unit">
|
||||
<option value="" <?php selected( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-background-spacing-unit', true ), '' ); ?>>px</option>
|
||||
<option value="%" <?php selected( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-background-spacing-unit', true ), '%' ); ?>>%</option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-left-right-padding" class="example-row-title"><strong><?php _e( 'Left & Right Padding', 'gp-premium' );?></strong></label><br />
|
||||
<input placeholder="" style="width:45px" type="text" name="_meta-generate-page-header-left-right-padding" id="_meta-generate-page-header-left-right-padding" value="<?php echo esc_attr( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-left-right-padding', true ) ); ?>" />
|
||||
<select name="_meta-generate-page-header-left-right-padding-unit" id="_meta-generate-page-header-left-right-padding-unit">
|
||||
<option value="" <?php selected( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-left-right-padding-unit', true ), '' ); ?>>px</option>
|
||||
<option value="%" <?php selected( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-left-right-padding-unit', true ), '%' ); ?>>%</option>
|
||||
</select>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="page-header-column last">
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-image-background-color" class="example-row-title"><strong><?php _e( 'Background Color', 'gp-premium' );?></strong></label><br />
|
||||
<input class="color-picker" data-alpha-enabled="true" data-alpha-color-type="hex" style="width:45px" type="text" name="_meta-generate-page-header-image-background-color" id="_meta-generate-page-header-image-background-color" value="<?php echo esc_attr( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-background-color', true ) ); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-image-background-text-color" class="example-row-title"><strong><?php _e( 'Text Color', 'gp-premium' );?></strong></label><br />
|
||||
<input class="color-picker" style="width:45px" type="text" name="_meta-generate-page-header-image-background-text-color" id="_meta-generate-page-header-image-background-text-color" value="<?php echo esc_attr( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-background-text-color', true ) ); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-image-background-link-color" class="example-row-title"><strong><?php _e( 'Link Color', 'gp-premium' );?></strong></label><br />
|
||||
<input class="color-picker" style="width:45px" type="text" name="_meta-generate-page-header-image-background-link-color" id="_meta-generate-page-header-image-background-link-color" value="<?php echo esc_attr( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-background-link-color', true ) ); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-image-background-link-color-hover" class="example-row-title"><strong><?php _e( 'Link Color Hover', 'gp-premium' );?></strong></label><br />
|
||||
<input class="color-picker" style="width:45px" type="text" name="_meta-generate-page-header-image-background-link-color-hover" id="_meta-generate-page-header-image-background-link-color-hover" value="<?php echo esc_attr( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-image-background-link-color-hover', true ) ); ?>" />
|
||||
</p>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="generate-video-background-tab" class="generate-tab-content generate-video-tab" style="display:none">
|
||||
<?php echo $content_required; ?>
|
||||
<p style="margin-top:0;">
|
||||
<label for="_meta-generate-page-header-video" class="example-row-title"><strong><?php _e( 'MP4 file', 'gp-premium' );?></strong></label><br />
|
||||
<input placeholder="http://" class="widefat" style="max-width:350px" id="_meta-generate-page-header-video" type="text" name="_meta-generate-page-header-video" value="<?php echo esc_url(generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-video', true )); ?>" />
|
||||
<button class="generate-upload-file button" type="button" data-type="video" data-title="<?php _e( 'Page Header Video', 'gp-premium' );?>" data-insert="<?php _e( 'Insert Video', 'gp-premium' ); ?>" data-prev="false">
|
||||
<?php _e( 'Choose Video', 'gp-premium' ) ;?>
|
||||
</button>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-video-ogv" class="example-row-title"><strong><?php _e( 'OGV file', 'gp-premium' );?></strong></label><br />
|
||||
<input placeholder="http://" class="widefat" style="max-width:350px" id="_meta-generate-page-header-video-ogv" type="text" name="_meta-generate-page-header-video-ogv" value="<?php echo esc_url(generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-video-ogv', true )); ?>" />
|
||||
<button class="generate-upload-file button" type="button" data-type="video" data-title="<?php _e( 'Page Header Video', 'gp-premium' );?>" data-insert="<?php _e( 'Insert Video', 'gp-premium' ); ?>" data-prev="false">
|
||||
<?php _e( 'Choose Video', 'gp-premium' ) ;?>
|
||||
</button>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-video-webm" class="example-row-title"><strong><?php _e( 'WEBM file', 'gp-premium' );?></strong></label><br />
|
||||
<input placeholder="http://" class="widefat" style="max-width:350px" id="_meta-generate-page-header-video-webm" type="text" name="_meta-generate-page-header-video-webm" value="<?php echo esc_url(generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-video-webm', true )); ?>" />
|
||||
<button class="generate-upload-file button" type="button" data-type="video" data-title="<?php _e( 'Page Header Video', 'gp-premium' );?>" data-insert="<?php _e( 'Insert Video', 'gp-premium' ); ?>" data-prev="false">
|
||||
<?php _e( 'Choose Video', 'gp-premium' ) ;?>
|
||||
</button>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-video-overlay" class="example-row-title"><strong><?php _e( 'Overlay Color', 'gp-premium' );?></strong></label><br />
|
||||
<input class="color-picker" data-alpha-enabled="true" data-alpha-color-type="hex" style="width:45px" type="text" name="_meta-generate-page-header-video-overlay" id="_meta-generate-page-header-video-overlay" value="<?php echo esc_attr( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-video-overlay', true ) ); ?>" />
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php if ( generate_page_header_logo_exists() || generate_page_header_navigation_logo_exists() ) : ?>
|
||||
<div id="generate-logo-tab" class="generate-tab-content">
|
||||
<?php if ( function_exists( 'generate_get_defaults' ) ) {
|
||||
$generate_settings = wp_parse_args(
|
||||
get_option( 'generate_settings', array() ),
|
||||
generate_get_defaults()
|
||||
);
|
||||
|
||||
if ( function_exists( 'generate_construct_logo' ) && ( '' !== $generate_settings[ 'logo' ] || get_theme_mod( 'custom_logo' ) ) ) {
|
||||
?>
|
||||
<p class="description" style="margin-top:0;">
|
||||
<?php _e( 'Overwrite your site-wide logo/header on this page.', 'gp-premium' ); ?>
|
||||
</p>
|
||||
|
||||
<div id="preview-image" class="generate-logo-image">
|
||||
<?php if( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-logo', true ) != "") { ?>
|
||||
<img class="saved-image" src="<?php echo esc_url( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-logo', true ) );?>" width="100" style="margin-bottom:12px;" />
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<input style="width:350px" id="_meta-generate-page-header-logo" type="hidden" name="_meta-generate-page-header-logo" value="<?php echo esc_url(generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-logo', true )); ?>" />
|
||||
<button class="generate-upload-file button" type="button" data-type="image" data-title="<?php _e( 'Header / Logo', 'gp-premium' );?>" data-insert="<?php _e( 'Insert Logo', 'gp-premium' ); ?>" data-prev="true">
|
||||
<?php _e('Choose Logo', 'gp-premium' ) ;?>
|
||||
</button>
|
||||
<input class="image-id" id="_meta-generate-page-header-logo-id" type="hidden" name="_meta-generate-page-header-logo-id" value="<?php echo esc_attr( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-logo-id', true ) ); ?>" />
|
||||
|
||||
<?php if( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-logo', true ) != "") {
|
||||
$remove_button = 'style="display:inline-block;"';
|
||||
} else {
|
||||
$remove_button = 'style="display:none;"';
|
||||
}
|
||||
?>
|
||||
<button class="generate-page-header-remove-image button" type="button" <?php echo $remove_button; ?> data-input="#_meta-generate-page-header-logo" data-input-id="_meta-generate-page-header-logo-id" data-prev=".generate-logo-image">
|
||||
<?php _e( 'Remove Logo', 'gp-premium' ) ;?>
|
||||
</button>
|
||||
|
||||
<p style="margin-bottom:20px;"></p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( function_exists( 'generate_menu_plus_get_defaults' ) ) {
|
||||
$generate_menu_plus_settings = wp_parse_args(
|
||||
get_option( 'generate_menu_plus_settings', array() ),
|
||||
generate_menu_plus_get_defaults()
|
||||
);
|
||||
|
||||
if ( '' !== $generate_menu_plus_settings[ 'sticky_menu_logo' ] ) {
|
||||
?>
|
||||
<p class="description" style="margin-top:0;">
|
||||
<?php _e( 'Overwrite your navigation logo on this page.', 'gp-premium' ); ?>
|
||||
</p>
|
||||
|
||||
<div id="preview-image" class="generate-navigation-logo-image">
|
||||
<?php if( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-navigation-logo', true ) != "") { ?>
|
||||
<img class="saved-image" src="<?php echo esc_url( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-navigation-logo', true ) );?>" width="100" style="margin-bottom:12px;" />
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<input style="width:350px" id="_meta-generate-page-header-navigation-logo" type="hidden" name="_meta-generate-page-header-navigation-logo" value="<?php echo esc_url( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-navigation-logo', true ) ); ?>" />
|
||||
<button class="generate-upload-file button" type="button" data-type="image" data-title="<?php _e( 'Navigation Logo', 'gp-premium' );?>" data-insert="<?php _e( 'Insert Logo', 'page-header'); ?>" data-prev="true">
|
||||
<?php _e( 'Choose Logo', 'gp-premium' ) ;?>
|
||||
</button>
|
||||
<input class="image-id" id="_meta-generate-page-header-navigation-logo-id" type="hidden" name="_meta-generate-page-header-navigation-logo-id" value="<?php echo esc_attr( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-navigation-logo-id', true ) ); ?>" />
|
||||
|
||||
<?php if ( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-navigation-logo', true ) != "" ) {
|
||||
$remove_button = 'style="display:inline-block;"';
|
||||
} else {
|
||||
$remove_button = 'style="display:none;"';
|
||||
}
|
||||
?>
|
||||
|
||||
<button class="generate-page-header-remove-image button" type="button" <?php echo $remove_button; ?> data-input="#_meta-generate-page-header-navigation-logo" data-input-id="_meta-generate-page-header-navigation-logo-id" data-prev=".generate-navigation-logo-image">
|
||||
<?php _e( 'Remove Logo', 'gp-premium' ) ;?>
|
||||
</button>
|
||||
<?php }
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div id="generate-advanced-tab" class="generate-tab-content" style="display:none">
|
||||
<?php echo $content_required; ?>
|
||||
<p style="margin-top:0;">
|
||||
<input type="checkbox" name="_meta-generate-page-header-combine" id="_meta-generate-page-header-combine" value="yes" <?php checked( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-combine', true ), 'yes' ); ?> />
|
||||
<label for="_meta-generate-page-header-combine"><?php _e( 'Merge with site header', 'gp-premium' );?></label>
|
||||
</p>
|
||||
|
||||
<div class="combination-options">
|
||||
<p class="absolute-position">
|
||||
<input type="checkbox" name="_meta-generate-page-header-absolute-position" id="_meta-generate-page-header-absolute-position" value="yes" <?php checked( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-absolute-position', true ), 'yes' ); ?> />
|
||||
<label for="_meta-generate-page-header-absolute-position"><?php _e( 'Place content behind header (sliders etc..)', 'gp-premium' );?></label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-site-title" class="example-row-title"><?php _e( 'Site Title', 'gp-premium' );?></label><br />
|
||||
<input class="color-picker" style="width:45px" type="text" name="_meta-generate-page-header-site-title" id="_meta-generate-page-header-site-title" value="<?php echo esc_attr( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-site-title', true ) ); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-site-tagline" class="example-row-title"><?php _e( 'Site Tagline', 'gp-premium' );?></label><br />
|
||||
<input class="color-picker" style="width:45px" type="text" name="_meta-generate-page-header-site-tagline" id="_meta-generate-page-header-site-tagline" value="<?php echo esc_attr( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-site-tagline', true ) ); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input type="checkbox" name="_meta-generate-page-header-transparent-navigation" id="_meta-generate-page-header-transparent-navigation" value="yes" <?php checked( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-transparent-navigation', true ), 'yes' ); ?> />
|
||||
<label for="_meta-generate-page-header-transparent-navigation"><?php _e( 'Custom Navigation Colors', 'gp-premium' );?></label>
|
||||
</p>
|
||||
|
||||
<div class="navigation-colors">
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-navigation-background" class="example-row-title"><strong><?php _e( 'Navigation Background', 'gp-premium' );?></strong></label><br />
|
||||
<input class="color-picker" data-alpha-enabled="true" data-alpha-color-type="hex" style="width:45px" type="text" name="_meta-generate-page-header-navigation-background" id="_meta-generate-page-header-navigation-background" value="<?php echo esc_attr( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-navigation-background', true ) ); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-navigation-text" class="example-row-title"><strong><?php _e( 'Navigation Text', 'gp-premium' );?></strong></label><br />
|
||||
<input class="color-picker" style="width:45px" type="text" name="_meta-generate-page-header-navigation-text" id="_meta-generate-page-header-navigation-text" value="<?php echo esc_attr( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-navigation-text', true ) ); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-navigation-background-hover" class="example-row-title"><strong><?php _e( 'Navigation Background Hover', 'gp-premium' );?></strong></label><br />
|
||||
<input class="color-picker" data-alpha-enabled="true" data-alpha-color-type="hex" style="width:45px" type="text" name="_meta-generate-page-header-navigation-background-hover" id="_meta-generate-page-header-navigation-background-hover" value="<?php echo esc_attr( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-navigation-background-hover', true ) ); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-navigation-text-hover" class="example-row-title"><strong><?php _e( 'Navigation Text Hover', 'gp-premium' );?></strong></label><br />
|
||||
<input class="color-picker" style="width:45px" type="text" name="_meta-generate-page-header-navigation-text-hover" id="_meta-generate-page-header-navigation-text-hover" value="<?php echo esc_attr( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-navigation-text-hover', true ) ); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-navigation-background-current" class="example-row-title"><strong><?php _e( 'Navigation Background Current', 'gp-premium' );?></strong></label><br />
|
||||
<input class="color-picker" data-alpha-enabled="true" data-alpha-color-type="hex" style="width:45px" type="text" name="_meta-generate-page-header-navigation-background-current" id="_meta-generate-page-header-navigation-background-current" value="<?php echo esc_attr( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-navigation-background-current', true ) ); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="_meta-generate-page-header-navigation-text-current" class="example-row-title"><strong><?php _e( 'Navigation Text Current', 'gp-premium' );?></strong></label><br />
|
||||
<input class="color-picker" style="width:45px" type="text" name="_meta-generate-page-header-navigation-text-current" id="_meta-generate-page-header-navigation-text-current" value="<?php echo esc_attr( generate_page_header_get_post_meta( get_the_ID(), '_meta-generate-page-header-navigation-text-current', true ) ); ?>" />
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'save_generate_page_header_meta' ) ) {
|
||||
add_action( 'save_post', 'save_generate_page_header_meta' );
|
||||
/**
|
||||
* Save our settings
|
||||
*/
|
||||
function save_generate_page_header_meta($post_id) {
|
||||
$is_autosave = wp_is_post_autosave( $post_id );
|
||||
$is_revision = wp_is_post_revision( $post_id );
|
||||
$is_valid_nonce = ( isset( $_POST[ 'generate_page_header_nonce' ] ) && wp_verify_nonce( $_POST[ 'generate_page_header_nonce' ], basename( __FILE__ ) ) ) ? true : false;
|
||||
|
||||
// Exits script depending on save status
|
||||
if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check that the logged in user has permission to edit this post
|
||||
if ( ! current_user_can( 'edit_post', $post_id ) ) {
|
||||
return $post_id;
|
||||
}
|
||||
|
||||
$options = array(
|
||||
'_meta-generate-page-header-content' => 'FILTER_CONTENT',
|
||||
'_meta-generate-page-header-image' => 'FILTER_SANITIZE_URL',
|
||||
'_meta-generate-page-header-image-id' => 'FILTER_SANITIZE_NUMBER_INT',
|
||||
'_meta-generate-page-header-image-link' => 'FILTER_SANITIZE_URL',
|
||||
'_meta-generate-page-header-enable-image-crop' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-image-crop' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-image-width' => 'FILTER_SANITIZE_NUMBER_INT',
|
||||
'_meta-generate-page-header-image-height' => 'FILTER_SANITIZE_NUMBER_INT',
|
||||
'_meta-generate-page-header-image-background-type' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-inner-container' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-image-background-alignment' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-image-background-spacing' => 'FILTER_SANITIZE_NUMBER_INT',
|
||||
'_meta-generate-page-header-image-background-spacing-unit' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-left-right-padding' => 'FILTER_SANITIZE_NUMBER_INT',
|
||||
'_meta-generate-page-header-left-right-padding-unit' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-image-background-color' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-image-background-text-color' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-image-background-link-color' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-image-background-link-color-hover' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-navigation-background' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-navigation-text' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-navigation-background-hover' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-navigation-text-hover' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-navigation-background-current' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-navigation-text-current' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-site-title' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-site-tagline' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-video' => 'FILTER_SANITIZE_URL',
|
||||
'_meta-generate-page-header-video-ogv' => 'FILTER_SANITIZE_URL',
|
||||
'_meta-generate-page-header-video-webm' => 'FILTER_SANITIZE_URL',
|
||||
'_meta-generate-page-header-video-overlay' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-content-autop' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-content-padding' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-image-background' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-full-screen' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-vertical-center' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-image-background-fixed' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-image-background-overlay' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-combine' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-absolute-position' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-transparent-navigation' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-add-to-excerpt' => 'FILTER_SANITIZE_STRING',
|
||||
'_meta-generate-page-header-logo' => 'FILTER_SANITIZE_URL',
|
||||
'_meta-generate-page-header-logo-id' => 'FILTER_SANITIZE_NUMBER_INT',
|
||||
'_meta-generate-page-header-navigation-logo' => 'FILTER_SANITIZE_URL',
|
||||
'_meta-generate-page-header-navigation-logo-id' => 'FILTER_SANITIZE_NUMBER_INT',
|
||||
);
|
||||
|
||||
if ( ! defined( 'GENERATE_LAYOUT_META_BOX' ) ) {
|
||||
$options[ '_generate-select-page-header' ] = 'FILTER_SANITIZE_NUMBER_INT';
|
||||
}
|
||||
|
||||
foreach ( $options as $key => $sanitize ) {
|
||||
if ( 'FILTER_SANITIZE_STRING' == $sanitize ) {
|
||||
$value = filter_input( INPUT_POST, $key, FILTER_SANITIZE_STRING );
|
||||
} elseif ( 'FILTER_SANITIZE_URL' == $sanitize ) {
|
||||
$value = filter_input( INPUT_POST, $key, FILTER_SANITIZE_URL );
|
||||
} elseif ( 'FILTER_SANITIZE_NUMBER_INT' == $sanitize ) {
|
||||
$value = filter_input( INPUT_POST, $key, FILTER_SANITIZE_NUMBER_INT );
|
||||
} elseif ( 'FILTER_CONTENT' == $sanitize && isset( $_POST[ $key ] ) ) {
|
||||
if ( current_user_can( 'unfiltered_html' ) ) {
|
||||
$value = $_POST[ $key ];
|
||||
} else {
|
||||
$value = wp_kses_post( $_POST[ $key ] );
|
||||
}
|
||||
} else {
|
||||
$value = filter_input( INPUT_POST, $key, FILTER_DEFAULT );
|
||||
}
|
||||
|
||||
if ( $value ) {
|
||||
update_post_meta( $post_id, $key, $value );
|
||||
} else {
|
||||
delete_post_meta( $post_id, $key );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'add_meta_boxes', 'generate_page_header_tags_add_meta_box' );
|
||||
/**
|
||||
* Add our Template Tags meta box.
|
||||
*
|
||||
* @param WP_Post $post Current post object.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
function generate_page_header_tags_add_meta_box( $post ) {
|
||||
add_meta_box( 'generate_page_header_tags', __( 'Template Tags', 'gp-premium' ), 'generate_page_header_tags_do_meta_box', 'generate_page_header', 'side', 'low' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta box display callback.
|
||||
*
|
||||
* @param WP_Post $post Current post object.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
function generate_page_header_tags_do_meta_box( $post ) {
|
||||
?>
|
||||
<input type="text" readonly="readonly" value="{{post_title}}" />
|
||||
<p class="decription" style="margin-top:0;opacity:0.8;font-size:85%;"><?php _e( 'The content title of the current post/taxonomy.', 'gp-premium' ); ?></p>
|
||||
|
||||
<input type="text" readonly="readonly" value="{{post_date}}" />
|
||||
<p class="decription" style="margin-top:0;opacity:0.8;font-size:85%;"><?php _e( 'The published date of the current post.', 'gp-premium' ); ?></p>
|
||||
|
||||
<input type="text" readonly="readonly" value="{{post_author}}" />
|
||||
<p class="decription" style="margin-top:0;opacity:0.8;font-size:85%;"><?php _e( 'The author of the current post.', 'gp-premium' ); ?></p>
|
||||
|
||||
<input type="text" readonly="readonly" value="{{post_terms.taxonomy}}" />
|
||||
<p class="decription" style="margin-top:0;opacity:0.8;font-size:85%;"><?php _e( 'The terms attached to the chosen taxonomy (category, post_tag, product_cat).', 'gp-premium' ); ?></p>
|
||||
|
||||
<input type="text" readonly="readonly" value='{{custom_field.name}}' />
|
||||
<p class="decription" style="margin-top:0;opacity:0.8;font-size:85%;"><?php _e( 'Custom post meta. Replace "name" with the name of your custom field.', 'gp-premium' ); ?></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
add_action( 'generate_layout_meta_box_content', 'generate_premium_page_header_meta_box_options' );
|
||||
/**
|
||||
* Add the meta box options to the Layout meta box in the new GP
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
function generate_premium_page_header_meta_box_options( $stored_meta ) {
|
||||
$stored_meta = (array) get_post_meta( get_the_ID() );
|
||||
$stored_meta['_generate-select-page-header'][0] = ( isset( $stored_meta['_generate-select-page-header'][0] ) ) ? $stored_meta['_generate-select-page-header'][0] : '';
|
||||
?>
|
||||
<div id="generate-layout-page-header" style="display: none;">
|
||||
<?php
|
||||
$page_headers = get_posts(array(
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'title',
|
||||
'post_type' => 'generate_page_header',
|
||||
'suppress_filters' => false,
|
||||
));
|
||||
|
||||
if ( count( $page_headers ) > 0 ) :
|
||||
?>
|
||||
<p style="margin-top:0;">
|
||||
<select name="_generate-select-page-header" id="_generate-select-page-header">
|
||||
<option value="" <?php selected( $stored_meta['_generate-select-page-header'][0], '' ); ?>></option>
|
||||
<?php
|
||||
foreach( $page_headers as $header ) {
|
||||
printf( '<option value="%1$s" %2$s>%3$s</option>',
|
||||
$header->ID,
|
||||
selected( $stored_meta['_generate-select-page-header'][0], $header->ID ),
|
||||
$header->post_title
|
||||
);
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</p>
|
||||
<?php else : ?>
|
||||
<p>
|
||||
<?php
|
||||
printf( __( 'No Page Headers found. Want to <a href="%1$s" target="_blank">create one</a>?', 'gp-premium' ),
|
||||
esc_url( admin_url( 'post-new.php?post_type=generate_page_header' ) )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
add_action( 'generate_layout_meta_box_menu_item', 'generate_premium_page_header_menu_item' );
|
||||
|
||||
function generate_premium_page_header_menu_item() {
|
||||
?>
|
||||
<li class="page-heade-meta-menu-item"><a href="#generate-layout-page-header"><?php _e( 'Page Header', 'gp-premium' ); ?></a></li>
|
||||
<?php
|
||||
}
|
||||
|
||||
add_action( 'generate_layout_meta_box_save', 'generate_premium_save_page_header_meta' );
|
||||
/**
|
||||
* Save the Page Header meta box values
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
function generate_premium_save_page_header_meta( $post_id ) {
|
||||
$page_header_key = '_generate-select-page-header';
|
||||
$page_header_value = filter_input( INPUT_POST, $page_header_key, FILTER_SANITIZE_NUMBER_INT );
|
||||
|
||||
if ( $page_header_value ) {
|
||||
update_post_meta( $post_id, $page_header_key, $page_header_value );
|
||||
} else {
|
||||
delete_post_meta( $post_id, $page_header_key );
|
||||
}
|
||||
}
|
@ -1,184 +0,0 @@
|
||||
<?php
|
||||
defined( 'WPINC' ) or die;
|
||||
|
||||
if ( ! function_exists( 'generate_get_blog_page_header' ) ) {
|
||||
/**
|
||||
* Apply a filter to see if we should display the blog page header
|
||||
* This allows you to show the Blog Page Header anywhere you want
|
||||
*/
|
||||
function generate_get_blog_page_header() {
|
||||
$page_header = ( is_home() ) ? true : false;
|
||||
return apply_filters( 'generate_get_blog_page_header', $page_header );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_page_header_area_start_container' ) ) {
|
||||
/**
|
||||
* Start our page header container
|
||||
*
|
||||
* This doesn't finish the container, as we can move it above the header
|
||||
* which allows us to merge the header and page header without position:absolute
|
||||
*/
|
||||
function generate_page_header_area_start_container( $image_class, $content_class ) {
|
||||
$options = generate_page_header_get_options();
|
||||
$image_url = generate_page_header_get_image( 'URL' );
|
||||
$container_type = ( 'fluid' !== $options[ 'container_type' ] ) ? ' page-header-contained grid-container grid-parent' : '';
|
||||
|
||||
// Parallax variable
|
||||
$parallax = ( ! empty( $options[ 'parallax' ] ) ) ? ' parallax-enabled' : '';
|
||||
$parallax_speed = apply_filters( 'generate_page_header_parallax_speed', 2 );
|
||||
|
||||
// Full screen variable
|
||||
$full_screen = ( ! empty( $options[ 'full_screen' ] ) ) ? ' fullscreen-enabled' : '';
|
||||
|
||||
// Vertical center variable
|
||||
$vertical_center_container = ( ! empty( $options[ 'vertical_center' ] ) && ! empty( $options[ 'full_screen' ] ) ) ? ' vertical-center-container' : '';
|
||||
$vertical_center = ( ! empty( $options[ 'vertical_center' ] ) && ! empty( $options[ 'full_screen' ] ) ) ? ' vertical-center-enabled' : '';
|
||||
|
||||
// Do we have a video?
|
||||
$video_enabled = ( empty( $options[ 'background_video' ] ) && empty( $options[ 'background_video_ogv' ] ) && empty( $options[ 'background_video_webm' ] ) ) ? false : true;
|
||||
|
||||
// Which types?
|
||||
$video_types = array(
|
||||
'mp4' => ( ! empty( $options[ 'background_video' ] ) ) ? 'mp4:' . esc_url( $options[ 'background_video' ] ) : null,
|
||||
'ogv' => ( ! empty( $options[ 'background_video_ogv' ] ) ) ? 'ogv:' . esc_url( $options[ 'background_video_ogv' ] ) : null,
|
||||
'webm' => ( ! empty( $options[ 'background_video_webm' ] ) ) ? 'webm:' . esc_url( $options[ 'background_video_webm' ] ) : null,
|
||||
'poster' => ( ! empty( $image_url ) ) ? 'poster:' . esc_url( $image_url ) : null
|
||||
);
|
||||
|
||||
// Add our videos to a string
|
||||
$video_output = array();
|
||||
foreach( $video_types as $video => $val ) {
|
||||
$video_output[] = $val;
|
||||
}
|
||||
|
||||
$video = null;
|
||||
// Video variable
|
||||
if ( $video_enabled && '' !== $options[ 'content' ] ) {
|
||||
|
||||
$ext = ( ! empty( $image_url ) ) ? pathinfo( $image_url, PATHINFO_EXTENSION ) : false;
|
||||
$video_options = array();
|
||||
|
||||
if ( $ext ) {
|
||||
$video_options[ 'posterType' ] = 'posterType:' . $ext;
|
||||
} else {
|
||||
$video_options[ 'posterType' ] = 'posterType: none';
|
||||
}
|
||||
|
||||
$video_options[ 'className' ] = 'className:generate-page-header-video';
|
||||
|
||||
if ( apply_filters( 'generate_page_header_video_loop', true ) ) {
|
||||
$video_options[ 'loop' ] = 'loop:true';
|
||||
} else {
|
||||
$video_options[ 'loop' ] = 'loop:false';
|
||||
}
|
||||
|
||||
if ( apply_filters( 'generate_page_header_video_muted', true ) ) {
|
||||
$video_options[ 'muted' ] = 'muted:true';
|
||||
} else {
|
||||
$video_options[ 'muted' ] = 'muted:false';
|
||||
}
|
||||
|
||||
$video_options[ 'autoplay' ] = 'autoplay:false';
|
||||
|
||||
$video = sprintf( ' data-vide-bg="%1$s" data-vide-options="%2$s"',
|
||||
implode( ', ', array_filter( $video_output ) ),
|
||||
implode( ', ', array_filter( $video_options ) )
|
||||
);
|
||||
}
|
||||
|
||||
// Write a class if we're merging the header
|
||||
$combined_content = ( '' !== $options[ 'merge' ] ) ? ' generate-combined-page-header' : '';
|
||||
|
||||
// If content is set, show it
|
||||
if ( '' !== $options[ 'content' ] && false !== $options[ 'content' ] ) {
|
||||
printf(
|
||||
'<div id="page-header-%7$s" %1$s class="%2$s" %6$s>
|
||||
<div %3$s class="inside-page-header-container inside-content-header %4$s %5$s">',
|
||||
( 'fluid' == $options[ 'container_type' ] ) ? $video : null,
|
||||
$content_class . $parallax . $full_screen . $vertical_center_container . $container_type . $combined_content . ' generate-page-header generate-content-header',
|
||||
( 'fluid' !== $options[ 'container_type' ] ) ? $video : null,
|
||||
$vertical_center,
|
||||
( '' !== $options[ 'merge' ] ) ? 'generate-merged-header' : '',
|
||||
( ! empty( $parallax ) ) ? 'data-parallax-speed="' . esc_attr( $parallax_speed ) . '"' : '',
|
||||
$options[ 'page_header_id' ]
|
||||
);
|
||||
}
|
||||
|
||||
do_action( 'generate_inside_merged_page_header' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_page_header_area' ) ) {
|
||||
/**
|
||||
* Build our entire page header.
|
||||
*
|
||||
* @since 0.1
|
||||
*
|
||||
* @param $image_class The class to give our element if it's an image.
|
||||
* @param $content_class The class to give our element if it's content.
|
||||
*/
|
||||
function generate_page_header_area( $image_class, $content_class ) {
|
||||
// Get our options
|
||||
$options = generate_page_header_get_options();
|
||||
|
||||
// Get out of here if we don't have content or an image
|
||||
if ( '' == $options[ 'content' ] && ! generate_page_header_get_image( 'ALL' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$inner_container = ( '' == $options[ 'inner_container' ] ) ? ' grid-container grid-parent' : '';
|
||||
|
||||
do_action( 'generate_before_page_header' );
|
||||
|
||||
// If an image is set and no content is set
|
||||
if ( '' == $options[ 'content' ] && generate_page_header_get_image( 'ALL' ) ) {
|
||||
|
||||
printf(
|
||||
'<div class="%1$s">
|
||||
%2$s
|
||||
%4$s
|
||||
%3$s
|
||||
</div>',
|
||||
esc_attr( $image_class ) . $inner_container . ' generate-page-header',
|
||||
( ! empty( $options[ 'image_link' ] ) ) ? '<a href="' . esc_url( $options[ 'image_link' ] ) . '"' . apply_filters( 'generate_page_header_link_target','' ) . '>' : null,
|
||||
( ! empty( $options[ 'image_link' ] ) ) ? '</a>' : null,
|
||||
generate_page_header_get_image_output()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
// If content is set, show it
|
||||
if ( '' !== $options[ 'content' ] && false !== $options[ 'content' ] ) {
|
||||
// If we're not merging our header, we can start the container here
|
||||
// If we were merging, the container would be added in the generate_before_header hook
|
||||
if ( '' == $options[ 'merge' ] ) {
|
||||
generate_page_header_area_start_container( 'page-header-image', 'page-header-content' );
|
||||
}
|
||||
|
||||
// Replace any found template tags
|
||||
$options[ 'content' ] = generate_page_header_template_tags( $options[ 'content' ] );
|
||||
|
||||
// Print the rest of our page header HTML
|
||||
// The starting elements are inside generate_page_header_area_start_container()
|
||||
printf ( '<div class="page-header-content-wrapper %1$s %2$s">
|
||||
<div class="%3$s page-header-content-container">
|
||||
%4$s
|
||||
%6$s
|
||||
%5$s
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>',
|
||||
( '' !== $options[ 'merge' ] ) ? 'generate-combined-content' : '',
|
||||
$inner_container,
|
||||
( '' !== $options[ 'merge' ] ) ? 'generate-inside-combined-content' : 'generate-inside-page-header-content',
|
||||
( ! empty( $options[ 'add_padding' ] ) ) ? '<div class="inside-page-header">' : null,
|
||||
( ! empty( $options[ 'add_padding' ] ) ) ? '</div>' : null,
|
||||
( ! empty( $options[ 'autop' ] ) ) ? do_shortcode( wpautop( $options[ 'content' ] ) ) : do_shortcode( $options[ 'content' ] )
|
||||
);
|
||||
}
|
||||
|
||||
do_action( 'generate_after_page_header' );
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
<?php
|
||||
defined( 'WPINC' ) or die;
|
||||
|
||||
if ( ! function_exists( 'generate_page_header_post_image' ) ) {
|
||||
add_action( 'generate_after_entry_header', 'generate_page_header_post_image' );
|
||||
/**
|
||||
* Prints the Post Image to post excerpts
|
||||
*/
|
||||
function generate_page_header_post_image() {
|
||||
// Get our options
|
||||
$options = generate_page_header_get_options( get_the_ID() );
|
||||
|
||||
// Check if we have a featured image
|
||||
$featured_image = ( has_post_thumbnail() ) ? apply_filters( 'generate_post_image_force_featured_image', true ) : apply_filters( 'generate_post_image_force_featured_image', false );
|
||||
// If using the featured image, stop
|
||||
if ( $featured_image ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If our add to excerpt checkbox isn't set, stop
|
||||
if ( '' == get_post_meta( get_the_ID(), '_meta-generate-page-header-add-to-excerpt', true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'post' == get_post_type() && ! is_single() ) {
|
||||
// If an image is set and no content is set
|
||||
if ( '' == $options[ 'content' ] && generate_page_header_get_image( 'ALL' ) ) {
|
||||
printf(
|
||||
'<div class="%1$s">
|
||||
%2$s
|
||||
%4$s
|
||||
%3$s
|
||||
</div>',
|
||||
'post-image page-header-post-image',
|
||||
( ! empty( $options[ 'image_link' ] ) ) ? '<a href="' . esc_url( $options[ 'image_link' ] ) . '"' . apply_filters( 'generate_page_header_link_target','' ) . '>' : null,
|
||||
( ! empty( $options[ 'image_link' ] ) ) ? '</a>' : null,
|
||||
generate_page_header_get_image_output()
|
||||
);
|
||||
}
|
||||
|
||||
// If content is set, show it
|
||||
if ( '' !== $options[ 'content' ] && false !== $options[ 'content' ] ) {
|
||||
printf(
|
||||
'<div class="%1$s">
|
||||
<div class="%2$s">
|
||||
%3$s
|
||||
%5$s
|
||||
%4$s
|
||||
</div>
|
||||
</div>',
|
||||
'post-image generate-page-header generate-post-content-header page-header-post-image',
|
||||
'inside-page-header-container inside-post-content-header grid-container grid-parent',
|
||||
( ! empty( $options[ 'add_padding' ] ) ) ? '<div class="inside-page-header">' : null,
|
||||
( ! empty( $options[ 'add_padding' ] ) ) ? '</div>' : null,
|
||||
( ! empty( $options[ 'autop' ] ) ) ? do_shortcode( wpautop( $options[ 'content' ] ) ) : do_shortcode( $options[ 'content' ] )
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,236 +0,0 @@
|
||||
<?php
|
||||
defined( 'WPINC' ) or die;
|
||||
|
||||
add_action( 'init', 'generate_page_header_post_type', 15 );
|
||||
/**
|
||||
* Create our Page Header post type.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
function generate_page_header_post_type() {
|
||||
$labels = array(
|
||||
'name' => _x( 'Page Headers', 'Post Type General Name', 'gp-premium' ),
|
||||
'singular_name' => _x( 'Page Header', 'Post Type Singular Name', 'gp-premium' ),
|
||||
'menu_name' => __( 'Page Headers', 'gp-premium' ),
|
||||
'name_admin_bar' => __( 'Page Header', 'gp-premium' ),
|
||||
'archives' => __( 'Page Header Archives', 'gp-premium' ),
|
||||
'parent_item_colon' => __( 'Parent Page Header:', 'gp-premium' ),
|
||||
'all_items' => __( 'All Page Headers', 'gp-premium' ),
|
||||
'add_new_item' => __( 'Add New Page Header', 'gp-premium' ),
|
||||
'new_item' => __( 'New Page Header', 'gp-premium' ),
|
||||
'edit_item' => __( 'Edit Page Header', 'gp-premium' ),
|
||||
'update_item' => __( 'Update Page Header', 'gp-premium' ),
|
||||
'view_item' => __( 'View Page Header', 'gp-premium' ),
|
||||
'search_items' => __( 'Search Page Header', 'gp-premium' ),
|
||||
'insert_into_item' => __( 'Insert into Page Header', 'gp-premium' ),
|
||||
'uploaded_to_this_item' => __( 'Uploaded to this Page Header', 'gp-premium' ),
|
||||
);
|
||||
$args = array(
|
||||
'label' => __( 'Page Header', 'gp-premium' ),
|
||||
'labels' => $labels,
|
||||
'supports' => array( 'title', 'thumbnail' ),
|
||||
'hierarchical' => false,
|
||||
'public' => false,
|
||||
'show_ui' => true,
|
||||
'show_in_menu' => function_exists( 'generate_premium_do_elements' ) ? false : true,
|
||||
'menu_position' => 100,
|
||||
'menu_icon' => 'dashicons-welcome-widgets-menus',
|
||||
'show_in_admin_bar' => false,
|
||||
'show_in_nav_menus' => false,
|
||||
'can_export' => true,
|
||||
'has_archive' => false,
|
||||
'exclude_from_search' => true,
|
||||
'publicly_queryable' => false,
|
||||
'capability_type' => 'page',
|
||||
);
|
||||
register_post_type( 'generate_page_header', $args );
|
||||
|
||||
$post_types = get_post_types( array( 'public' => true ) );
|
||||
$term_args = array(
|
||||
'sanitize_callback' => 'int',
|
||||
'type' => 'string',
|
||||
'description' => '',
|
||||
'single' => true,
|
||||
'show_in_rest' => true,
|
||||
);
|
||||
foreach ( $post_types as $type ) {
|
||||
register_meta( $type, 'generate_page_header', $term_args );
|
||||
}
|
||||
|
||||
$taxonomies = get_taxonomies( array( 'public' => true ) );
|
||||
if ( $taxonomies ) {
|
||||
foreach ( $taxonomies as $taxonomy ) {
|
||||
add_action( $taxonomy . '_add_form_fields', 'generate_page_header_tax_new_ph_field' );
|
||||
add_action( $taxonomy . '_edit_form_fields', 'generate_page_header_tax_edit_ph_field' );
|
||||
add_action( 'edit_' . $taxonomy, 'generate_page_header_tax_save_ph' );
|
||||
add_action( 'create_' . $taxonomy, 'generate_page_header_tax_save_ph' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'admin_menu', 'generate_old_page_header_options_page' );
|
||||
/**
|
||||
* Add our submenu page to the Appearance tab.
|
||||
*
|
||||
* @since 1.7
|
||||
*/
|
||||
function generate_old_page_header_options_page() {
|
||||
if ( ! function_exists( 'generate_premium_do_elements' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_submenu_page(
|
||||
'themes.php',
|
||||
esc_html__( 'Page Headers', 'gp-premium' ),
|
||||
esc_html__( 'Page Headers', 'gp-premium' ),
|
||||
'manage_options',
|
||||
'edit.php?post_type=generate_page_header'
|
||||
);
|
||||
}
|
||||
|
||||
add_action( 'admin_head', 'generate_old_page_header_fix_menu' );
|
||||
/**
|
||||
* Set our current menu in the admin while in the old Page Header pages.
|
||||
*
|
||||
* @since 1.7
|
||||
*/
|
||||
function generate_old_page_header_fix_menu() {
|
||||
if ( ! function_exists( 'generate_premium_do_elements' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $parent_file, $submenu_file, $post_type;
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
if ( 'generate_page_header' === $post_type || 'appearance_page_page-header-global-locations' === $screen->base ) {
|
||||
$parent_file = 'themes.php';
|
||||
$submenu_file = 'edit.php?post_type=gp_elements';
|
||||
}
|
||||
|
||||
remove_submenu_page( 'themes.php', 'edit.php?post_type=generate_page_header' );
|
||||
remove_submenu_page( 'themes.php', 'page-header-global-locations' );
|
||||
}
|
||||
|
||||
add_action( 'admin_head', 'generate_page_header_add_legacy_locations_button', 999 );
|
||||
/**
|
||||
* Add legacy buttons to our new GP Elements post type.
|
||||
*
|
||||
* @since 1.7
|
||||
*/
|
||||
function generate_page_header_add_legacy_locations_button() {
|
||||
if ( ! function_exists( 'generate_premium_do_elements' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
if ( 'generate_page_header' === $screen->post_type ) :
|
||||
?>
|
||||
<script>
|
||||
jQuery( function( $ ) {
|
||||
$( '<a href="<?php echo admin_url(); ?>themes.php?page=page-header-global-locations" class="page-title-action legacy-button"><?php esc_html_e( "Global Locations", "gp-premium" ); ?></a>' ).insertAfter( '.page-title-action:not(.legacy-button)' );
|
||||
} );
|
||||
</script>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
if ( 'gp_elements' === $screen->post_type && 'edit' === $screen->base ) :
|
||||
?>
|
||||
<script>
|
||||
jQuery( function( $ ) {
|
||||
$( '<a href="<?php echo admin_url(); ?>edit.php?post_type=generate_page_header" class="page-title-action legacy-button"><?php esc_html_e( "Legacy Page Headers", "gp-premium" ); ?></a>' ).insertAfter( '.page-title-action:not(.legacy-button)' );
|
||||
} );
|
||||
</script>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build our taxonomy select option when adding new taxonomies.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
function generate_page_header_tax_new_ph_field() {
|
||||
wp_nonce_field( basename( __FILE__ ), 'generate_page_header_term_nonce' ); ?>
|
||||
<div class="form-field term-page-header-wrap">
|
||||
<label for="_generate-select-page-header"><?php _e( 'Page Header', 'gp-premium' ); ?></label>
|
||||
<select name="_generate-select-page-header" id="_generate-select-page-header">
|
||||
<option value=""></option>
|
||||
<?php
|
||||
$page_headers = get_posts(array(
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'title',
|
||||
'post_type' => 'generate_page_header',
|
||||
));
|
||||
|
||||
foreach( $page_headers as $header ) {
|
||||
printf( '<option value="%1$s">%2$s</option>',
|
||||
$header->ID,
|
||||
$header->post_title
|
||||
);
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Build our taxonomy select option when editing existing taxonomies.
|
||||
*
|
||||
* @since 1.4
|
||||
*
|
||||
* @param string $term The selected term.
|
||||
*/
|
||||
function generate_page_header_tax_edit_ph_field( $term ) {
|
||||
?>
|
||||
<tr class="form-field form-required term-page-header-wrap">
|
||||
<th scope="row">
|
||||
<label for="_generate-select-page-header"><?php _e( 'Page Header', 'gp-premium' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<?php wp_nonce_field( basename( __FILE__ ), 'generate_page_header_term_nonce' ); ?>
|
||||
<select name="_generate-select-page-header" id="_generate-select-page-header">
|
||||
<option value="" <?php selected( get_term_meta( $term->term_id, '_generate-select-page-header', true ), '' ); ?>></option>
|
||||
<?php
|
||||
$page_headers = get_posts(array(
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'title',
|
||||
'post_type' => 'generate_page_header',
|
||||
));
|
||||
|
||||
foreach( $page_headers as $header ) {
|
||||
printf( '<option value="%1$s" %2$s>%3$s</option>',
|
||||
$header->ID,
|
||||
selected( get_term_meta( $term->term_id, '_generate-select-page-header', true ), $header->ID ),
|
||||
$header->post_title
|
||||
);
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }
|
||||
|
||||
/**
|
||||
* Save our selected page header inside taxonomies.
|
||||
*
|
||||
* @since 1.4
|
||||
*
|
||||
* @param int $term_id The selected term ID.
|
||||
*/
|
||||
function generate_page_header_tax_save_ph( $term_id ) {
|
||||
if ( ! isset( $_POST['generate_page_header_term_nonce'] ) || ! wp_verify_nonce( $_POST['generate_page_header_term_nonce'], basename( __FILE__ ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$old = get_term_meta( $term_id, '_generate-select-page-header', true );
|
||||
$new = isset( $_POST['_generate-select-page-header'] ) ? sanitize_key( $_POST['_generate-select-page-header'] ) : '';
|
||||
|
||||
if ( $old && '' === $new ) {
|
||||
delete_term_meta( $term_id, '_generate-select-page-header' );
|
||||
} else if ( $old !== $new ) {
|
||||
update_term_meta( $term_id, '_generate-select-page-header', $new );
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The Page Header module.
|
||||
*
|
||||
* @since 1.1.0
|
||||
* @deprecated 1.7.0
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
// Define the version.
|
||||
if ( ! defined( 'GENERATE_PAGE_HEADER_VERSION' ) ) {
|
||||
define( 'GENERATE_PAGE_HEADER_VERSION', GP_PREMIUM_VERSION );
|
||||
}
|
||||
|
||||
// Include assets unique to this addon.
|
||||
require plugin_dir_path( __FILE__ ) . 'functions/functions.php';
|
Reference in New Issue
Block a user