Initial commit
This commit is contained in:
157
wp-content/plugins/gp-premium/blog/functions/columns.php
Normal file
157
wp-content/plugins/gp-premium/blog/functions/columns.php
Normal file
@ -0,0 +1,157 @@
|
||||
<?php
|
||||
defined( 'WPINC' ) or die;
|
||||
|
||||
if ( ! function_exists( 'generate_blog_get_columns' ) ) {
|
||||
/**
|
||||
* Initiate columns.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_blog_get_columns() {
|
||||
$generate_blog_settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
// If columns are enabled, set to true
|
||||
$columns = ( true == $generate_blog_settings['column_layout'] ) ? true : false;
|
||||
|
||||
// If we're not dealing with posts, set it to false.
|
||||
// Check for is_home() to prevent bug in Yoast that throws off the post type check.
|
||||
$columns = ( 'post' == get_post_type() || is_search() || is_home() ) ? $columns : false;
|
||||
|
||||
// If masonry is enabled via filter, enable columns
|
||||
$columns = ( 'true' == apply_filters( 'generate_blog_masonry', 'false' ) ) ? true : $columns;
|
||||
|
||||
// If we're on a singular post or page, disable
|
||||
$columns = ( is_singular() ) ? false : $columns;
|
||||
|
||||
// Turn off columns if we're on a WooCommerce search page
|
||||
if ( function_exists( 'is_woocommerce' ) ) {
|
||||
$columns = ( is_woocommerce() && is_search() ) ? false : $columns;
|
||||
}
|
||||
|
||||
// Bail if there's no search results
|
||||
if ( is_search() ) {
|
||||
global $wp_query;
|
||||
if ( 0 == $wp_query->post_count ) {
|
||||
$columns = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Return the result
|
||||
return apply_filters( 'generate_blog_columns', $columns );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_get_masonry' ) ) {
|
||||
/**
|
||||
* Check if masonry is enabled.
|
||||
* This function is a mess with strings as bools etc.. Will re-write in a big upate to get lots of testing.
|
||||
*/
|
||||
function generate_blog_get_masonry() {
|
||||
$generate_blog_settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
// If masonry is enabled via option or filter, enable it.
|
||||
if ( $generate_blog_settings['masonry'] || 'true' == apply_filters( 'generate_blog_masonry', 'false' ) ) {
|
||||
$masonry = 'true';
|
||||
} else {
|
||||
$masonry = 'false';
|
||||
}
|
||||
|
||||
// Allow masonry to be turned off using a boolean.
|
||||
if ( false === apply_filters( 'generate_blog_masonry', 'false' ) ) {
|
||||
$masonry = 'false';
|
||||
}
|
||||
|
||||
return $masonry;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_add_columns_container' ) ) {
|
||||
add_action( 'generate_before_main_content', 'generate_blog_add_columns_container' );
|
||||
/**
|
||||
* Add columns container
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
function generate_blog_add_columns_container() {
|
||||
if ( ! generate_blog_get_columns() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$columns = generate_blog_get_column_count();
|
||||
|
||||
printf(
|
||||
'<div class="generate-columns-container %1$s">%2$s',
|
||||
'false' !== generate_blog_get_masonry() ? 'masonry-container are-images-unloaded' : '',
|
||||
'false' !== generate_blog_get_masonry() ? '<div class="grid-sizer ' . esc_attr( 'grid-' . esc_attr( $columns ) ) . ' tablet-grid-50 mobile-grid-100"></div>' : ''
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_add_ending_columns_container' ) ) {
|
||||
add_action( 'generate_after_main_content', 'generate_blog_add_ending_columns_container' );
|
||||
/**
|
||||
* Add closing columns container
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
function generate_blog_add_ending_columns_container() {
|
||||
if ( ! generate_blog_get_columns() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
echo '</div><!-- .generate-columns-contaier -->';
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_columns_css' ) ) {
|
||||
/**
|
||||
* Add inline CSS
|
||||
*/
|
||||
function generate_blog_columns_css() {
|
||||
$generate_blog_settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( function_exists( 'generate_spacing_get_defaults' ) ) {
|
||||
$spacing_settings = wp_parse_args(
|
||||
get_option( 'generate_spacing_settings', array() ),
|
||||
generate_spacing_get_defaults()
|
||||
);
|
||||
}
|
||||
|
||||
$separator = ( function_exists('generate_spacing_get_defaults') ) ? absint( $spacing_settings['separator'] ) : 20;
|
||||
|
||||
$return = '';
|
||||
if ( generate_blog_get_columns() ) {
|
||||
$return .= '.generate-columns {margin-bottom: ' . $separator . 'px;padding-left: ' . $separator . 'px;}';
|
||||
$return .= '.generate-columns-container {margin-left: -' . $separator . 'px;}';
|
||||
$return .= '.page-header {margin-bottom: ' . $separator . 'px;margin-left: ' . $separator . 'px}';
|
||||
$return .= '.generate-columns-container > .paging-navigation {margin-left: ' . $separator . 'px;}';
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_get_column_count' ) ) {
|
||||
/**
|
||||
* Get our column grid class
|
||||
*/
|
||||
function generate_blog_get_column_count() {
|
||||
$generate_blog_settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
$count = $generate_blog_settings['columns'];
|
||||
|
||||
return apply_filters( 'generate_blog_get_column_count', $count );
|
||||
}
|
||||
}
|
1
wp-content/plugins/gp-premium/blog/functions/css/style-min.css
vendored
Normal file
1
wp-content/plugins/gp-premium/blog/functions/css/style-min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
224
wp-content/plugins/gp-premium/blog/functions/css/style.css
Normal file
224
wp-content/plugins/gp-premium/blog/functions/css/style.css
Normal file
@ -0,0 +1,224 @@
|
||||
.post-image-above-header .inside-article .post-image,
|
||||
.post-image-above-header .inside-article .featured-image {
|
||||
margin-top:0;
|
||||
margin-bottom:2em;
|
||||
}
|
||||
|
||||
.post-image-aligned-left .inside-article .post-image,
|
||||
.post-image-aligned-left .inside-article .featured-image {
|
||||
margin-top:0;
|
||||
margin-right:2em;
|
||||
float:left;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.post-image-aligned-center .post-image,
|
||||
.post-image-aligned-center .featured-image {
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
.post-image-aligned-right .inside-article .post-image,
|
||||
.post-image-aligned-right .inside-article .featured-image {
|
||||
margin-top:0;
|
||||
margin-left:2em;
|
||||
float:right;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.post-image-below-header.post-image-aligned-right .inside-article .post-image,
|
||||
.post-image-below-header.post-image-aligned-right .inside-article .featured-image,
|
||||
.post-image-below-header.post-image-aligned-center .inside-article .featured-image,
|
||||
.post-image-below-header.post-image-aligned-left .inside-article .post-image,
|
||||
.post-image-below-header.post-image-aligned-left .inside-article .featured-image {
|
||||
margin-top:2em;
|
||||
}
|
||||
|
||||
.post-image-aligned-left > .featured-image,
|
||||
.post-image-aligned-right > .featured-image {
|
||||
float: none;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.post-image-aligned-left .featured-image {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.post-image-aligned-right .featured-image {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.post-image-aligned-left .inside-article:before,
|
||||
.post-image-aligned-left .inside-article:after,
|
||||
.post-image-aligned-right .inside-article:before,
|
||||
.post-image-aligned-right .inside-article:after {
|
||||
content: "";
|
||||
display: table;
|
||||
}
|
||||
|
||||
.post-image-aligned-left .inside-article:after,
|
||||
.post-image-aligned-right .inside-article:after {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.post-image-aligned-left .inside-article,
|
||||
.post-image-aligned-right .inside-article {
|
||||
zoom: 1; /* For IE 6/7 (trigger hasLayout) */
|
||||
}
|
||||
|
||||
.one-container.right-sidebar.post-image-aligned-center .no-featured-image-padding .post-image,
|
||||
.one-container.both-right.post-image-aligned-center .no-featured-image-padding .post-image,
|
||||
.one-container.right-sidebar.post-image-aligned-center .no-featured-image-padding .featured-image,
|
||||
.one-container.both-right.post-image-aligned-center .no-featured-image-padding .featured-image {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.one-container.left-sidebar.post-image-aligned-center .no-featured-image-padding .post-image,
|
||||
.one-container.both-left.post-image-aligned-center .no-featured-image-padding .post-image,
|
||||
.one-container.left-sidebar.post-image-aligned-center .no-featured-image-padding .featured-image,
|
||||
.one-container.both-left.post-image-aligned-center .no-featured-image-padding .featured-image {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.one-container.both-sidebars.post-image-aligned-center .no-featured-image-padding .post-image,
|
||||
.one-container.both-sidebars.post-image-aligned-center .no-featured-image-padding .featured-image,
|
||||
.one-container.post-image-aligned-center .no-featured-image-padding.generate-columns .post-image,
|
||||
.one-container.post-image-aligned-center .no-featured-image-padding.generate-columns .featured-image {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.masonry-enabled .page-header {
|
||||
position: relative !important;
|
||||
}
|
||||
|
||||
.separate-containers .site-main > .generate-columns-container {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.masonry-container.are-images-unloaded,
|
||||
.load-more.are-images-unloaded,
|
||||
.masonry-enabled #nav-below {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/* columns */
|
||||
.generate-columns-container:not(.masonry-container) {
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-flex-flow: row wrap;
|
||||
-ms-flex-flow: row wrap;
|
||||
flex-flow: row wrap;
|
||||
|
||||
-webkit-align-items: stretch;
|
||||
-ms-flex-align: stretch;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.generate-columns-container:not(.masonry-container) .generate-columns {
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.generate-columns .inside-article {
|
||||
width: 100%;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.generate-columns-activated.post-image-aligned-left .generate-columns-container article:not(.featured-column) .post-image,
|
||||
.generate-columns-activated.post-image-aligned-right .generate-columns-container article:not(.featured-column) .post-image {
|
||||
float: none;
|
||||
text-align: center;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.generate-columns-container .paging-navigation,
|
||||
.generate-columns-container .page-header {
|
||||
-webkit-box-flex: 1;
|
||||
-webkit-flex: 1 1 100%;
|
||||
-ms-flex: 1 1 100%;
|
||||
flex: 1 1 100%;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.generate-columns-container .paging-navigation {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.no-sidebar .generate-columns-container .inside-article > * {
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.load-more:not(.has-svg-icon) .button.loading:before {
|
||||
content: "\e900";
|
||||
display: inline-block;
|
||||
font-family: "GP Premium";
|
||||
speak: none;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-variant: normal;
|
||||
text-transform: none;
|
||||
line-height: 1;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
-webkit-animation: spin 2s infinite linear;
|
||||
animation: spin 2s infinite linear;
|
||||
margin-right: 7px;
|
||||
}
|
||||
|
||||
.load-more .button:not(.loading) .gp-icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.load-more .gp-icon svg {
|
||||
-webkit-animation: spin 2s infinite linear;
|
||||
animation: spin 2s infinite linear;
|
||||
margin-right: 7px;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotate(360deg);
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.generate-columns-activated .generate-columns-container {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
.generate-columns-container > * {
|
||||
padding-left: 0;
|
||||
}
|
||||
.generate-columns-container .page-header {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width:768px) {
|
||||
body:not(.post-image-aligned-center) .inside-article .post-image,
|
||||
body:not(.post-image-aligned-center) .featured-image,
|
||||
body:not(.post-image-aligned-center) .inside-article .featured-image {
|
||||
margin-right: 0;
|
||||
margin-left: 0;
|
||||
float: none;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.load-more {
|
||||
display: block;
|
||||
text-align:center;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
1115
wp-content/plugins/gp-premium/blog/functions/customizer.php
Normal file
1115
wp-content/plugins/gp-premium/blog/functions/customizer.php
Normal file
File diff suppressed because it is too large
Load Diff
55
wp-content/plugins/gp-premium/blog/functions/defaults.php
Normal file
55
wp-content/plugins/gp-premium/blog/functions/defaults.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
defined( 'WPINC' ) or die;
|
||||
|
||||
if ( ! function_exists( 'generate_blog_get_defaults' ) ) {
|
||||
/**
|
||||
* Set our defaults
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_blog_get_defaults() {
|
||||
$generate_blog_defaults = array(
|
||||
'excerpt_length' => '55',
|
||||
'read_more' => __( 'Read more', 'gp-premium' ),
|
||||
'read_more_button' => false,
|
||||
'masonry' => false,
|
||||
'masonry_load_more' => __( '+ More', 'gp-premium' ),
|
||||
'masonry_loading' => __( 'Loading...', 'gp-premium' ),
|
||||
'infinite_scroll' => false,
|
||||
'infinite_scroll_button' => false,
|
||||
'post_image' => true,
|
||||
'post_image_position' => '',
|
||||
'post_image_alignment' => 'post-image-aligned-center',
|
||||
'post_image_width' => '',
|
||||
'post_image_height' => '',
|
||||
'post_image_padding' => true,
|
||||
'single_post_image' => true,
|
||||
'single_post_image_position' => 'inside-content',
|
||||
'single_post_image_alignment' => 'center',
|
||||
'single_post_image_width' => '',
|
||||
'single_post_image_height' => '',
|
||||
'single_post_image_padding' => true,
|
||||
'page_post_image' => true,
|
||||
'page_post_image_position' => 'above-content',
|
||||
'page_post_image_alignment' => 'center',
|
||||
'page_post_image_width' => '',
|
||||
'page_post_image_height' => '',
|
||||
'page_post_image_padding' => true,
|
||||
'date' => true,
|
||||
'author' => true,
|
||||
'categories' => true,
|
||||
'tags' => true,
|
||||
'comments' => true,
|
||||
'single_date' => true,
|
||||
'single_author' => true,
|
||||
'single_categories' => true,
|
||||
'single_tags' => true,
|
||||
'single_post_navigation' => true,
|
||||
'column_layout' => false,
|
||||
'columns' => '50',
|
||||
'featured_column' => false
|
||||
);
|
||||
|
||||
return apply_filters( 'generate_blog_option_defaults', $generate_blog_defaults );
|
||||
}
|
||||
}
|
540
wp-content/plugins/gp-premium/blog/functions/generate-blog.php
Normal file
540
wp-content/plugins/gp-premium/blog/functions/generate-blog.php
Normal file
@ -0,0 +1,540 @@
|
||||
<?php
|
||||
defined( 'WPINC' ) or die;
|
||||
|
||||
// Pull in our defaults and functions
|
||||
require plugin_dir_path( __FILE__ ) . 'defaults.php';
|
||||
require plugin_dir_path( __FILE__ ) . 'images.php';
|
||||
require plugin_dir_path( __FILE__ ) . 'columns.php';
|
||||
require plugin_dir_path( __FILE__ ) . 'customizer.php';
|
||||
require plugin_dir_path( __FILE__ ) . 'migrate.php';
|
||||
|
||||
if ( ! function_exists( 'generate_blog_scripts' ) ) {
|
||||
add_action( 'wp_enqueue_scripts', 'generate_blog_scripts', 50 );
|
||||
/**
|
||||
* Enqueue scripts and styles
|
||||
*/
|
||||
function generate_blog_scripts() {
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
wp_add_inline_style( 'generate-style', generate_blog_css() );
|
||||
wp_add_inline_style( 'generate-style', generate_blog_columns_css() );
|
||||
|
||||
$deps = array();
|
||||
|
||||
if ( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) {
|
||||
$deps[] = 'jquery-masonry';
|
||||
$deps[] = 'imagesloaded';
|
||||
}
|
||||
|
||||
if ( $settings[ 'infinite_scroll' ] && ! is_singular() && ! is_404() ) {
|
||||
$deps[] = 'infinitescroll';
|
||||
wp_enqueue_script( 'infinitescroll', plugin_dir_url( __FILE__ ) . 'js/infinite-scroll.pkgd.min.js', array( 'jquery' ), '3.0.1', true );
|
||||
|
||||
$font_icons = true;
|
||||
|
||||
if ( function_exists( 'generate_get_option' ) ) {
|
||||
if ( 'font' !== generate_get_option( 'icons' ) ) {
|
||||
$font_icons = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $settings['infinite_scroll_button'] && $font_icons ) {
|
||||
wp_enqueue_style( 'gp-premium-icons' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) || ( $settings[ 'infinite_scroll' ] && ! is_singular() && ! is_404() ) ) {
|
||||
wp_enqueue_script( 'generate-blog', plugin_dir_url( __FILE__ ) . 'js/scripts.min.js', $deps, GENERATE_BLOG_VERSION, true );
|
||||
wp_localize_script( 'generate-blog', 'blog', array(
|
||||
'more' => $settings['masonry_load_more'],
|
||||
'loading' => $settings['masonry_loading'],
|
||||
'icon' => function_exists( 'generate_get_svg_icon' ) ? generate_get_svg_icon( 'spinner' ) : '',
|
||||
) );
|
||||
}
|
||||
|
||||
wp_enqueue_style( 'generate-blog', plugin_dir_url( __FILE__ ) . 'css/style-min.css', array(), GENERATE_BLOG_VERSION );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_post_classes' ) ) {
|
||||
add_filter( 'post_class', 'generate_blog_post_classes' );
|
||||
/**
|
||||
* Adds custom classes to the content container
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_blog_post_classes( $classes ) {
|
||||
global $wp_query;
|
||||
$paged = get_query_var( 'paged' );
|
||||
$paged = $paged ? $paged : 1;
|
||||
|
||||
// Get our options
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
// Set our masonry class
|
||||
if ( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) {
|
||||
$classes[] = 'masonry-post';
|
||||
}
|
||||
|
||||
// Set our column classes
|
||||
if ( generate_blog_get_columns() && ! is_singular() ) {
|
||||
$classes[] = 'generate-columns';
|
||||
$classes[] = 'tablet-grid-50';
|
||||
$classes[] = 'mobile-grid-100';
|
||||
$classes[] = 'grid-parent';
|
||||
|
||||
// Set our featured column class
|
||||
if ( $wp_query->current_post == 0 && $paged == 1 && $settings['featured_column'] ) {
|
||||
if ( 50 == generate_blog_get_column_count() ) {
|
||||
$classes[] = 'grid-100';
|
||||
}
|
||||
|
||||
if ( 33 == generate_blog_get_column_count() ) {
|
||||
$classes[] = 'grid-66';
|
||||
}
|
||||
|
||||
if ( 25 == generate_blog_get_column_count() ) {
|
||||
$classes[] = 'grid-50';
|
||||
}
|
||||
|
||||
if ( 20 == generate_blog_get_column_count() ) {
|
||||
$classes[] = 'grid-60';
|
||||
}
|
||||
$classes[] = 'featured-column';
|
||||
} else {
|
||||
$classes[] = 'grid-' . generate_blog_get_column_count();
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $settings['post_image_padding'] && ! is_singular() ) {
|
||||
$classes[] = 'no-featured-image-padding';
|
||||
}
|
||||
|
||||
$location = generate_blog_get_singular_template();
|
||||
|
||||
if ( ! $settings[$location . '_post_image_padding'] && is_singular() ) {
|
||||
$classes[] = 'no-featured-image-padding';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_body_classes' ) ) {
|
||||
add_filter( 'body_class', 'generate_blog_body_classes' );
|
||||
/**
|
||||
* Adds custom classes to the body
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_blog_body_classes( $classes ) {
|
||||
// Get theme options
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( is_singular() ) {
|
||||
$location = generate_blog_get_singular_template();
|
||||
|
||||
if ( 'below-title' == $settings[$location . '_post_image_position'] ) {
|
||||
$classes[] = 'post-image-below-header';
|
||||
}
|
||||
|
||||
if ( 'inside-content' == $settings[$location . '_post_image_position'] ) {
|
||||
$classes[] = 'post-image-above-header';
|
||||
}
|
||||
|
||||
$classes[] = ( ! empty( $settings[$location . '_post_image_alignment'] ) ) ? 'post-image-aligned-' . $settings[$location . '_post_image_alignment'] : 'post-image-aligned-center';
|
||||
} else {
|
||||
$classes[] = ( '' == $settings['post_image_position'] ) ? 'post-image-below-header' : 'post-image-above-header';
|
||||
$classes[] = ( ! empty( $settings['post_image_alignment'] ) ) ? $settings['post_image_alignment'] : 'post-image-aligned-center';
|
||||
}
|
||||
|
||||
if ( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) {
|
||||
$classes[] = 'masonry-enabled';
|
||||
}
|
||||
|
||||
if ( generate_blog_get_columns() && ! is_singular() ) {
|
||||
$classes[] = 'generate-columns-activated';
|
||||
}
|
||||
|
||||
if ( $settings[ 'infinite_scroll' ] && ! is_singular() ) {
|
||||
$classes[] = 'infinite-scroll';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_excerpt_length' ) ) {
|
||||
add_filter( 'excerpt_length', 'generate_excerpt_length', 15 );
|
||||
/**
|
||||
* Set our excerpt length
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_excerpt_length( $length ) {
|
||||
$generate_settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
return absint( apply_filters( 'generate_excerpt_length', $generate_settings['excerpt_length'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_css' ) ) {
|
||||
/**
|
||||
* Build our inline CSS
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_blog_css() {
|
||||
global $post;
|
||||
$return = '';
|
||||
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
// Get disable headline meta
|
||||
$disable_headline = ( isset( $post ) ) ? get_post_meta( $post->ID, '_generate-disable-headline', true ) : '';
|
||||
|
||||
if ( ! $settings['categories'] && ! $settings['comments'] && ! $settings['tags'] && ! is_singular() ) {
|
||||
$return .= '.blog footer.entry-meta, .archive footer.entry-meta {display:none;}';
|
||||
}
|
||||
|
||||
if ( ! $settings['single_date'] && ! $settings['single_author'] && $disable_headline && is_singular() ) {
|
||||
$return .= '.single .entry-header{display:none;}.single .entry-content {margin-top:0;}';
|
||||
}
|
||||
|
||||
if ( ! $settings['date'] && ! $settings['author'] && ! is_singular() ) {
|
||||
$return .= '.entry-header .entry-meta {display:none;}';
|
||||
}
|
||||
|
||||
if ( ! $settings['single_date'] && ! $settings['single_author'] && is_singular() ) {
|
||||
$return .= '.entry-header .entry-meta {display:none;}';
|
||||
}
|
||||
|
||||
if ( ! $settings['single_post_navigation'] && is_singular() ) {
|
||||
$return .= '.post-navigation {display:none;}';
|
||||
}
|
||||
|
||||
if ( ! $settings['single_categories'] && ! $settings['single_post_navigation'] && ! $settings['single_tags'] && is_singular() ) {
|
||||
$return .= '.single footer.entry-meta {display:none;}';
|
||||
}
|
||||
|
||||
$separator = 20;
|
||||
$content_padding_top = 40;
|
||||
$content_padding_right = 40;
|
||||
$content_padding_left = 40;
|
||||
$mobile_content_padding_top = 30;
|
||||
$mobile_content_padding_right = 30;
|
||||
$mobile_content_padding_left = 30;
|
||||
|
||||
if ( function_exists( 'generate_spacing_get_defaults' ) ) {
|
||||
$spacing_settings = wp_parse_args(
|
||||
get_option( 'generate_spacing_settings', array() ),
|
||||
generate_spacing_get_defaults()
|
||||
);
|
||||
|
||||
$separator = absint( $spacing_settings['separator'] );
|
||||
$content_padding_top = absint( $spacing_settings['content_top'] );
|
||||
$content_padding_right = absint( $spacing_settings['content_right'] );
|
||||
$content_padding_left = absint( $spacing_settings['content_left'] );
|
||||
$mobile_content_padding_top = absint( $spacing_settings['mobile_content_top'] );
|
||||
$mobile_content_padding_right = absint( $spacing_settings['mobile_content_right'] );
|
||||
$mobile_content_padding_left = absint( $spacing_settings['mobile_content_left'] );
|
||||
}
|
||||
|
||||
if ( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) {
|
||||
$return .= '.page-header {margin-bottom: ' . $separator . 'px;margin-left: ' . $separator . 'px}';
|
||||
}
|
||||
|
||||
if ( $settings[ 'infinite_scroll' ] && ! is_singular() ) {
|
||||
$return .= '#nav-below {display:none;}';
|
||||
}
|
||||
|
||||
if ( ! $settings['post_image_padding'] && 'post-image-aligned-center' == $settings['post_image_alignment'] && ! is_singular() ) {
|
||||
$return .= '.no-featured-image-padding .post-image {margin-left:-' . $content_padding_left . 'px;margin-right:-' . $content_padding_right . 'px;}';
|
||||
$return .= '.post-image-above-header .no-featured-image-padding .inside-article .post-image {margin-top:-' . $content_padding_top . 'px;}';
|
||||
}
|
||||
|
||||
$location = generate_blog_get_singular_template();
|
||||
|
||||
if ( ! $settings[$location . '_post_image_padding'] && 'center' == $settings[$location . '_post_image_alignment'] && is_singular() ) {
|
||||
$return .= '.no-featured-image-padding .featured-image {margin-left:-' . $content_padding_left . 'px;margin-right:-' . $content_padding_right . 'px;}';
|
||||
$return .= '.post-image-above-header .no-featured-image-padding .inside-article .featured-image {margin-top:-' . $content_padding_top . 'px;}';
|
||||
}
|
||||
|
||||
if ( ! $settings['page_post_image_padding'] || ! $settings['single_post_image_padding'] || ! $settings['post_image_padding'] ) {
|
||||
$return .= '@media ' . generate_premium_get_media_query( 'mobile' ) . '{';
|
||||
if ( ! $settings['post_image_padding'] && 'post-image-aligned-center' == $settings['post_image_alignment'] && ! is_singular() ) {
|
||||
$return .= '.no-featured-image-padding .post-image {margin-left:-' . $mobile_content_padding_left . 'px;margin-right:-' . $mobile_content_padding_right . 'px;}';
|
||||
$return .= '.post-image-above-header .no-featured-image-padding .inside-article .post-image {margin-top:-' . $mobile_content_padding_top . 'px;}';
|
||||
}
|
||||
|
||||
if ( ! $settings[$location . '_post_image_padding'] && 'center' == $settings[$location . '_post_image_alignment'] && is_singular() ) {
|
||||
$return .= '.no-featured-image-padding .featured-image {margin-left:-' . $mobile_content_padding_left . 'px;margin-right:-' . $mobile_content_padding_right . 'px;}';
|
||||
$return .= '.post-image-above-header .no-featured-image-padding .inside-article .featured-image {margin-top:-' . $mobile_content_padding_top . 'px;}';
|
||||
}
|
||||
$return .= '}';
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_excerpt_more' ) ) {
|
||||
add_filter( 'excerpt_more', 'generate_blog_excerpt_more', 15 );
|
||||
/**
|
||||
* Prints the read more HTML
|
||||
*/
|
||||
function generate_blog_excerpt_more( $more ) {
|
||||
$generate_settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
// If empty, return
|
||||
if ( '' == $generate_settings['read_more'] ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return apply_filters( 'generate_excerpt_more_output', sprintf( ' ... <a title="%1$s" class="read-more" href="%2$s">%3$s</a>',
|
||||
the_title_attribute( 'echo=0' ),
|
||||
esc_url( get_permalink( get_the_ID() ) ),
|
||||
wp_kses_post( $generate_settings['read_more'] )
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_content_more' ) ) {
|
||||
add_filter( 'the_content_more_link', 'generate_blog_content_more', 15 );
|
||||
/**
|
||||
* Prints the read more HTML
|
||||
*/
|
||||
function generate_blog_content_more( $more ) {
|
||||
$generate_settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
// If empty, return
|
||||
if ( '' == $generate_settings['read_more'] ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return apply_filters( 'generate_content_more_link_output', sprintf( '<p class="read-more-container"><a title="%1$s" class="read-more content-read-more" href="%2$s">%3$s%4$s</a></p>',
|
||||
the_title_attribute( 'echo=0' ),
|
||||
esc_url( get_permalink( get_the_ID() ) . apply_filters( 'generate_more_jump','#more-' . get_the_ID() ) ),
|
||||
wp_kses_post( $generate_settings['read_more'] ),
|
||||
'<span class="screen-reader-text">' . get_the_title() . '</span>'
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the setting and returns false if $thing is disabled
|
||||
*
|
||||
* @since 1.4
|
||||
*
|
||||
* @param String $data The original data, passed through if not disabled
|
||||
* @param String $thing The name of the thing to check
|
||||
* @return String|False The original data, or false (if disabled)
|
||||
*/
|
||||
function generate_disable_post_thing( $data, $thing ) {
|
||||
$generate_blog_settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( ! $generate_blog_settings[$thing] ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_disable_post_date' ) ) {
|
||||
add_filter( 'generate_post_date', 'generate_disable_post_date' );
|
||||
/**
|
||||
* Remove the post date if set
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_disable_post_date( $date ) {
|
||||
if ( is_singular() ) {
|
||||
return generate_disable_post_thing( $date, 'single_date' );
|
||||
} else {
|
||||
return generate_disable_post_thing( $date, 'date' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_disable_post_author' ) ) {
|
||||
add_filter( 'generate_post_author', 'generate_disable_post_author' );
|
||||
/**
|
||||
* Set the author if set
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_disable_post_author( $author ) {
|
||||
if ( is_singular() ) {
|
||||
return generate_disable_post_thing( $author, 'single_author' );
|
||||
} else {
|
||||
return generate_disable_post_thing( $author, 'author' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_disable_post_categories' ) ) {
|
||||
add_filter( 'generate_show_categories', 'generate_disable_post_categories' );
|
||||
/**
|
||||
* Remove the categories if set
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_disable_post_categories( $categories ) {
|
||||
if ( is_singular() ) {
|
||||
return generate_disable_post_thing( $categories, 'single_categories' );
|
||||
} else {
|
||||
return generate_disable_post_thing( $categories, 'categories' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_disable_post_tags' ) ) {
|
||||
add_filter( 'generate_show_tags', 'generate_disable_post_tags' );
|
||||
/**
|
||||
* Remove the tags if set
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_disable_post_tags( $tags ) {
|
||||
if ( is_singular() ) {
|
||||
return generate_disable_post_thing( $tags, 'single_tags' );
|
||||
} else {
|
||||
return generate_disable_post_thing( $tags, 'tags' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_disable_post_comments_link' ) ) {
|
||||
add_filter( 'generate_show_comments', 'generate_disable_post_comments_link' );
|
||||
/**
|
||||
* Remove the link to comments if set
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_disable_post_comments_link( $comments_link ) {
|
||||
return generate_disable_post_thing( $comments_link, 'comments' );
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'next_post_link', 'generate_disable_post_navigation' );
|
||||
add_filter( 'previous_post_link', 'generate_disable_post_navigation' );
|
||||
/**
|
||||
* Remove the single post navigation
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
function generate_disable_post_navigation( $navigation ) {
|
||||
return generate_disable_post_thing( $navigation, 'single_post_navigation' );
|
||||
}
|
||||
|
||||
add_filter( 'generate_excerpt_more_output', 'generate_blog_read_more_button' );
|
||||
add_filter( 'generate_content_more_link_output', 'generate_blog_read_more_button' );
|
||||
/**
|
||||
* Add the button class to our read more link if set.
|
||||
*
|
||||
* @since 1.5
|
||||
*
|
||||
* @param string Our existing read more link.
|
||||
*/
|
||||
function generate_blog_read_more_button( $output ) {
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( ! $settings[ 'read_more_button' ] ) {
|
||||
return $output;
|
||||
}
|
||||
|
||||
return sprintf( '%5$s<p class="read-more-container"><a title="%1$s" class="read-more button" href="%2$s">%3$s%4$s</a></p>',
|
||||
the_title_attribute( 'echo=0' ),
|
||||
esc_url( get_permalink( get_the_ID() ) . apply_filters( 'generate_more_jump','#more-' . get_the_ID() ) ),
|
||||
wp_kses_post( $settings['read_more'] ),
|
||||
'<span class="screen-reader-text">' . get_the_title() . '</span>',
|
||||
'generate_excerpt_more_output' == current_filter() ? ' ... ' : ''
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_load_more' ) ) {
|
||||
add_action( 'generate_after_main_content', 'generate_blog_load_more', 20 );
|
||||
/**
|
||||
* Build our load more button
|
||||
*/
|
||||
function generate_blog_load_more() {
|
||||
// Get theme options
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( ( ! $settings[ 'infinite_scroll_button' ] || ! $settings[ 'infinite_scroll' ] ) || is_singular() || is_404() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $wp_query;
|
||||
|
||||
if ( $wp_query->max_num_pages < 2 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( is_post_type_archive( 'product' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$icon = '';
|
||||
|
||||
if ( function_exists( 'generate_get_svg_icon' ) ) {
|
||||
$icon = generate_get_svg_icon( 'spinner' );
|
||||
}
|
||||
|
||||
printf(
|
||||
'<div class="masonry-load-more load-more %1$s %2$s">
|
||||
<a class="button" href="#">%3$s%4$s</a>
|
||||
</div>',
|
||||
$icon ? 'has-svg-icon' : '',
|
||||
( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) ? 'are-images-unloaded' : '',
|
||||
$icon,
|
||||
wp_kses_post( $settings['masonry_load_more'] )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see whether we're getting page or single post options.
|
||||
*
|
||||
* @since 1.5
|
||||
*
|
||||
* @return string Name of our singular template
|
||||
*/
|
||||
function generate_blog_get_singular_template() {
|
||||
$template = 'single';
|
||||
|
||||
if ( is_page() ) {
|
||||
$template = 'page';
|
||||
}
|
||||
|
||||
return $template;
|
||||
}
|
286
wp-content/plugins/gp-premium/blog/functions/images.php
Normal file
286
wp-content/plugins/gp-premium/blog/functions/images.php
Normal file
@ -0,0 +1,286 @@
|
||||
<?php
|
||||
defined( 'WPINC' ) or die;
|
||||
|
||||
if ( ! defined( 'GP_IMAGE_RESIZER' ) ) {
|
||||
require_once GP_LIBRARY_DIRECTORY . 'image-processing-queue/image-processing-queue.php';
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_get_blog_image_attributes' ) ) {
|
||||
/**
|
||||
* Build our image attributes
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_get_blog_image_attributes() {
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
if ( is_singular() ) {
|
||||
if ( is_singular( 'page' ) ) {
|
||||
$single = 'page_';
|
||||
} else {
|
||||
$single = 'single_';
|
||||
}
|
||||
} else {
|
||||
$single = '';
|
||||
}
|
||||
|
||||
$ignore_crop = array( '', '0', '9999' );
|
||||
|
||||
$atts = array(
|
||||
'width' => ( in_array( $settings["{$single}post_image_width"], $ignore_crop ) ) ? 9999 : absint( $settings["{$single}post_image_width"] ),
|
||||
'height' => ( in_array( $settings["{$single}post_image_height"], $ignore_crop ) ) ? 9999 : absint( $settings["{$single}post_image_height"] ),
|
||||
'crop' => ( in_array( $settings["{$single}post_image_width"], $ignore_crop ) || in_array( $settings["{$single}post_image_height"], $ignore_crop ) ) ? false : true
|
||||
);
|
||||
|
||||
// If there's no height or width, empty the array
|
||||
if ( 9999 == $atts[ 'width' ] && 9999 == $atts[ 'height' ] ) {
|
||||
$atts = array();
|
||||
}
|
||||
|
||||
return apply_filters( 'generate_blog_image_attributes', $atts );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_setup' ) ) {
|
||||
add_action( 'wp', 'generate_blog_setup', 50 );
|
||||
/**
|
||||
* Setup our blog functions and actions
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_blog_setup() {
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
// Move our featured images to above the title
|
||||
if ( 'post-image-above-header' == $settings['post_image_position'] ) {
|
||||
remove_action( 'generate_after_entry_header', 'generate_post_image' );
|
||||
add_action( 'generate_before_content', 'generate_post_image' );
|
||||
|
||||
// If we're using the Page Header add-on, move those as well
|
||||
if ( function_exists('generate_page_header_post_image') ) {
|
||||
remove_action( 'generate_after_entry_header', 'generate_page_header_post_image' );
|
||||
add_action( 'generate_before_content', 'generate_page_header_post_image' );
|
||||
}
|
||||
}
|
||||
|
||||
$page_header_content = false;
|
||||
if ( function_exists( 'generate_page_header_get_options' ) ) {
|
||||
$options = generate_page_header_get_options();
|
||||
if ( '' !== $options[ 'content' ] ) {
|
||||
$page_header_content = true;
|
||||
}
|
||||
|
||||
// If our Page Header has no content, remove it
|
||||
// This will allow the Blog add-on to add an image for us
|
||||
if ( ! $page_header_content && is_singular() ) {
|
||||
remove_action( 'generate_before_content', 'generate_page_header' );
|
||||
remove_action( 'generate_after_entry_header', 'generate_page_header' );
|
||||
remove_action( 'generate_after_header', 'generate_page_header' );
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the core theme featured image
|
||||
// I would like to filter instead one day
|
||||
remove_action( 'generate_after_header', 'generate_featured_page_header' );
|
||||
remove_action( 'generate_before_content', 'generate_featured_page_header_inside_single' );
|
||||
|
||||
$location = generate_blog_get_singular_template();
|
||||
|
||||
if ( $settings[$location . '_post_image'] && is_singular() && ! $page_header_content ) {
|
||||
if ( 'below-title' == $settings[$location . '_post_image_position'] ) {
|
||||
add_action( 'generate_after_entry_header', 'generate_blog_single_featured_image' );
|
||||
}
|
||||
|
||||
if ( 'inside-content' == $settings[$location . '_post_image_position'] ) {
|
||||
add_action( 'generate_before_content', 'generate_blog_single_featured_image' );
|
||||
}
|
||||
|
||||
if ( 'above-content' == $settings[$location . '_post_image_position'] ) {
|
||||
add_action( 'generate_after_header', 'generate_blog_single_featured_image' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'generate_featured_image_output', 'generate_blog_featured_image' );
|
||||
/**
|
||||
* Filter our core featured image so we can include support for resized images.
|
||||
*
|
||||
* @since 1.5
|
||||
* @return string The image HTML
|
||||
*/
|
||||
function generate_blog_featured_image( $output ) {
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
$image_atts = generate_get_blog_image_attributes();
|
||||
$image_id = get_post_thumbnail_id( get_the_ID(), 'full' );
|
||||
|
||||
if ( ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) || ! $settings['post_image'] ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( $image_atts && function_exists( 'ipq_get_theme_image' ) ) {
|
||||
$image_html = ipq_get_theme_image( $image_id,
|
||||
array(
|
||||
array( $image_atts[ 'width' ], $image_atts[ 'height' ], $image_atts[ 'crop' ] )
|
||||
),
|
||||
array(
|
||||
'itemprop' => 'image',
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return $output;
|
||||
}
|
||||
|
||||
return apply_filters( 'generate_resized_featured_image_output', sprintf(
|
||||
'<div class="post-image">
|
||||
<a href="%1$s">
|
||||
%2$s
|
||||
</a>
|
||||
</div>',
|
||||
esc_url( get_permalink() ),
|
||||
$image_html
|
||||
), $image_html );
|
||||
}
|
||||
|
||||
/**
|
||||
* Build our featured images for single posts and pages.
|
||||
*
|
||||
* This function is way more complicated than it could be so it can
|
||||
* ensure compatibility with the Page Header add-on.
|
||||
*
|
||||
* @since 1.5
|
||||
*
|
||||
* @return string The image HTML
|
||||
*/
|
||||
function generate_blog_single_featured_image() {
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
$image_atts = generate_get_blog_image_attributes();
|
||||
$image_id = get_post_thumbnail_id( get_the_ID(), 'full' );
|
||||
|
||||
if ( function_exists( 'generate_page_header_get_image' ) && generate_page_header_get_image( 'ID' ) ) {
|
||||
if ( intval( $image_id ) !== generate_page_header_get_image( 'ID' ) ) {
|
||||
$image_id = generate_page_header_get_image( 'ID' );
|
||||
}
|
||||
}
|
||||
|
||||
$location = generate_blog_get_singular_template();
|
||||
|
||||
if ( ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) || ! $settings[$location . '_post_image'] || ! $image_id ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( $image_atts && function_exists( 'ipq_get_theme_image' ) ) {
|
||||
|
||||
$image_html = ipq_get_theme_image( $image_id,
|
||||
array(
|
||||
array( $image_atts[ 'width' ], $image_atts[ 'height' ], $image_atts[ 'crop' ] )
|
||||
),
|
||||
array(
|
||||
'itemprop' => 'image',
|
||||
)
|
||||
);
|
||||
|
||||
} else {
|
||||
|
||||
$image_html = apply_filters( 'post_thumbnail_html',
|
||||
wp_get_attachment_image( $image_id, apply_filters( 'generate_page_header_default_size', 'full' ), '',
|
||||
array(
|
||||
'itemprop' => 'image',
|
||||
)
|
||||
),
|
||||
get_the_ID(),
|
||||
$image_id,
|
||||
apply_filters( 'generate_page_header_default_size', 'full' ),
|
||||
''
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$location = generate_blog_get_singular_template();
|
||||
|
||||
$classes = array(
|
||||
is_page() ? 'page-header-image' : null,
|
||||
is_singular() && ! is_page() ? 'page-header-image-single' : null,
|
||||
'above-content' == $settings[$location . '_post_image_position'] ? 'grid-container grid-parent' : null,
|
||||
);
|
||||
|
||||
$image_html = apply_filters( 'generate_single_featured_image_html', $image_html );
|
||||
|
||||
echo apply_filters( 'generate_single_featured_image_output', sprintf(
|
||||
'<div class="featured-image %2$s">
|
||||
%1$s
|
||||
</div>',
|
||||
$image_html,
|
||||
implode( ' ', $classes )
|
||||
), $image_html );
|
||||
}
|
||||
|
||||
add_filter( 'generate_blog_image_attributes', 'generate_blog_page_header_image_atts' );
|
||||
/**
|
||||
* Filter our image attributes in case we're using differents atts in our Page Header
|
||||
*
|
||||
* @since 1.5
|
||||
*
|
||||
* @param array $atts Our existing image attributes.
|
||||
* @return array Image attributes
|
||||
*/
|
||||
function generate_blog_page_header_image_atts( $atts ) {
|
||||
if ( ! function_exists( 'generate_page_header_get_options' ) ) {
|
||||
return $atts;
|
||||
}
|
||||
|
||||
if ( ! is_singular() ) {
|
||||
return $atts;
|
||||
}
|
||||
|
||||
$options = generate_page_header_get_options();
|
||||
|
||||
if ( 'enable' == $options[ 'image_resize' ] ) {
|
||||
$ignore_crop = array( '', '0', '9999' );
|
||||
|
||||
$atts = array(
|
||||
'width' => ( in_array( $options[ 'image_width' ], $ignore_crop ) ) ? 9999 : absint( $options[ 'image_width' ] ),
|
||||
'height' => ( in_array( $options[ 'image_height' ], $ignore_crop ) ) ? 9999 : absint( $options[ 'image_height' ] ),
|
||||
'crop' => ( in_array( $options[ 'image_width' ], $ignore_crop ) || in_array( $options[ 'image_height' ], $ignore_crop ) ) ? false : true
|
||||
);
|
||||
}
|
||||
|
||||
return $atts;
|
||||
}
|
||||
|
||||
add_filter( 'generate_single_featured_image_html', 'generate_blog_page_header_link' );
|
||||
/**
|
||||
* Add our Page Header link to our featured image if set.
|
||||
*
|
||||
* @since 1.5
|
||||
*
|
||||
* @param string $image_html Our existing image HTML.
|
||||
* @return string Our new image HTML.
|
||||
*/
|
||||
function generate_blog_page_header_link( $image_html ) {
|
||||
if ( ! function_exists( 'generate_page_header_get_options' ) ) {
|
||||
return $image_html;
|
||||
}
|
||||
|
||||
$options = generate_page_header_get_options();
|
||||
|
||||
if ( ! empty( $options['image_link'] ) ) {
|
||||
return '<a href="' . esc_url( $options[ 'image_link' ] ) . '"' . apply_filters( 'generate_page_header_link_target', '' ) . '>' . $image_html . '</a>';
|
||||
} else {
|
||||
return $image_html;
|
||||
}
|
||||
}
|
95
wp-content/plugins/gp-premium/blog/functions/js/controls.js
vendored
Normal file
95
wp-content/plugins/gp-premium/blog/functions/js/controls.js
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
jQuery( document ).ready( function($) {
|
||||
// Featured image controls
|
||||
var featured_image_archive_controls = [
|
||||
'generate_blog_settings-post_image',
|
||||
'generate_blog_settings-post_image_padding',
|
||||
'generate_blog_settings-post_image_position',
|
||||
'generate_blog_settings-post_image_alignment',
|
||||
'generate_blog_settings-post_image_width',
|
||||
'generate_blog_settings-post_image_height',
|
||||
'post_image_apply_sizes',
|
||||
];
|
||||
|
||||
$.each( featured_image_archive_controls, function( index, value ) {
|
||||
$( '#customize-control-' + value ).attr( 'data-control-section', 'featured-image-archives' );
|
||||
} );
|
||||
|
||||
var featured_image_single_controls = [
|
||||
'generate_blog_settings-single_post_image',
|
||||
'generate_blog_settings-single_post_image_padding',
|
||||
'generate_blog_settings-single_post_image_position',
|
||||
'generate_blog_settings-single_post_image_alignment',
|
||||
'generate_blog_settings-single_post_image_width',
|
||||
'generate_blog_settings-single_post_image_height',
|
||||
'single_post_image_apply_sizes',
|
||||
];
|
||||
|
||||
$.each( featured_image_single_controls, function( index, value ) {
|
||||
$( '#customize-control-' + value ).attr( 'data-control-section', 'featured-image-single' ).css( {
|
||||
visibility: 'hidden',
|
||||
height: '0',
|
||||
width: '0',
|
||||
margin: '0',
|
||||
overflow: 'hidden'
|
||||
} );
|
||||
} );
|
||||
|
||||
var featured_image_page_controls = [
|
||||
'generate_blog_settings-page_post_image',
|
||||
'generate_blog_settings-page_post_image_padding',
|
||||
'generate_blog_settings-page_post_image_position',
|
||||
'generate_blog_settings-page_post_image_alignment',
|
||||
'generate_blog_settings-page_post_image_width',
|
||||
'generate_blog_settings-page_post_image_height',
|
||||
'page_post_image_apply_sizes',
|
||||
];
|
||||
|
||||
$.each( featured_image_page_controls, function( index, value ) {
|
||||
$( '#customize-control-' + value ).attr( 'data-control-section', 'featured-image-page' ).css( {
|
||||
visibility: 'hidden',
|
||||
height: '0',
|
||||
width: '0',
|
||||
margin: '0',
|
||||
overflow: 'hidden'
|
||||
} );
|
||||
} );
|
||||
|
||||
// Post meta controls
|
||||
var post_meta_archive_controls = [
|
||||
'generate_settings-post_content',
|
||||
'generate_blog_settings-excerpt_length',
|
||||
'generate_blog_settings-read_more',
|
||||
'generate_blog_settings-read_more_button',
|
||||
'generate_blog_settings-date',
|
||||
'generate_blog_settings-author',
|
||||
'generate_blog_settings-categories',
|
||||
'generate_blog_settings-tags',
|
||||
'generate_blog_settings-comments',
|
||||
'generate_blog_settings-infinite_scroll',
|
||||
'generate_blog_settings-infinite_scroll_button',
|
||||
'blog_masonry_load_more_control',
|
||||
'blog_masonry_loading_control',
|
||||
];
|
||||
|
||||
$.each( post_meta_archive_controls, function( index, value ) {
|
||||
$( '#customize-control-' + value ).attr( 'data-control-section', 'post-meta-archives' );
|
||||
} );
|
||||
|
||||
var post_meta_single_controls = [
|
||||
'generate_blog_settings-single_date',
|
||||
'generate_blog_settings-single_author',
|
||||
'generate_blog_settings-single_categories',
|
||||
'generate_blog_settings-single_tags',
|
||||
'generate_blog_settings-single_post_navigation',
|
||||
];
|
||||
|
||||
$.each( post_meta_single_controls, function( index, value ) {
|
||||
$( '#customize-control-' + value ).attr( 'data-control-section', 'post-meta-single' ).css( {
|
||||
visibility: 'hidden',
|
||||
height: '0',
|
||||
width: '0',
|
||||
margin: '0',
|
||||
overflow: 'hidden'
|
||||
} );
|
||||
} );
|
||||
});
|
@ -0,0 +1,78 @@
|
||||
/**
|
||||
* Theme Customizer enhancements for a better user experience.
|
||||
*
|
||||
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
|
||||
*/
|
||||
|
||||
( function( $ ) {
|
||||
|
||||
// Container width
|
||||
wp.customize( 'generate_settings[container_width]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
if ( $( '.masonry-container' )[0] ) {
|
||||
var $initiate = jQuery('.masonry-container').imagesLoaded( function() {
|
||||
$container = jQuery('.masonry-container');
|
||||
if (jQuery($container).length) {
|
||||
$container.masonry({
|
||||
columnWidth: '.grid-sizer',
|
||||
itemSelector: '.masonry-post',
|
||||
stamp: '.page-header'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
$( 'body' ).on( 'generate_spacing_updated', function() {
|
||||
if ( $( '.masonry-container' )[0] ) {
|
||||
var $initiate = jQuery('.masonry-container').imagesLoaded( function() {
|
||||
$container = jQuery('.masonry-container');
|
||||
if (jQuery($container).length) {
|
||||
$container.masonry({
|
||||
columnWidth: '.grid-sizer',
|
||||
itemSelector: '.masonry-post',
|
||||
stamp: '.page-header'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* The first infinite scroll load in the Customizer misses article classes if they've been
|
||||
* added or removed in the previous refresh.
|
||||
*
|
||||
* This is totally hacky, but I'm just happy I finally got it working!
|
||||
*/
|
||||
var $container = $( 'article' ).first().parent();
|
||||
$container.on( 'load.infiniteScroll', function( event, response, path ) {
|
||||
$posts = $( response ).find( 'article' );
|
||||
if ( wp.customize.value('generate_blog_settings[column_layout]')() ) {
|
||||
$posts.addClass( 'generate-columns' );
|
||||
$posts.addClass( 'grid-parent' );
|
||||
$posts.addClass( 'grid-' + wp.customize.value('generate_blog_settings[columns]')() );
|
||||
$posts.addClass( 'tablet-grid-50' );
|
||||
$posts.addClass( 'mobile-grid-100' );
|
||||
} else {
|
||||
$posts.removeClass( 'generate-columns' );
|
||||
$posts.removeClass( 'grid-parent' );
|
||||
$posts.removeClass( 'grid-' + wp.customize.value('generate_blog_settings[columns]')() );
|
||||
$posts.removeClass( 'tablet-grid-50' );
|
||||
$posts.removeClass( 'mobile-grid-100' );
|
||||
}
|
||||
|
||||
if ( wp.customize.value('generate_blog_settings[masonry]')() ) {
|
||||
$posts.addClass( 'masonry-post' );
|
||||
} else {
|
||||
$posts.removeClass( 'masonry-post' );
|
||||
}
|
||||
|
||||
if ( ! wp.customize.value('generate_blog_settings[post_image_padding]')() ) {
|
||||
$posts.addClass( 'no-featured-image-padding' );
|
||||
} else {
|
||||
$posts.removeClass( 'no-featured-image-padding' );
|
||||
}
|
||||
});
|
||||
|
||||
} )( jQuery );
|
12
wp-content/plugins/gp-premium/blog/functions/js/infinite-scroll.pkgd.min.js
vendored
Normal file
12
wp-content/plugins/gp-premium/blog/functions/js/infinite-scroll.pkgd.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
80
wp-content/plugins/gp-premium/blog/functions/js/scripts.js
Normal file
80
wp-content/plugins/gp-premium/blog/functions/js/scripts.js
Normal file
@ -0,0 +1,80 @@
|
||||
jQuery( document ).ready( function( $ ) {
|
||||
var $masonry_container = $( '.masonry-container' );
|
||||
var msnry = false;
|
||||
|
||||
if ( $masonry_container.length ) {
|
||||
var $grid = $masonry_container.masonry({
|
||||
columnWidth: '.grid-sizer',
|
||||
itemSelector: 'none',
|
||||
stamp: '.page-header',
|
||||
percentPosition: true,
|
||||
stagger: 30,
|
||||
visibleStyle: { transform: 'translateY(0)', opacity: 1 },
|
||||
hiddenStyle: { transform: 'translateY(5px)', opacity: 0 },
|
||||
} );
|
||||
|
||||
msnry = $grid.data( 'masonry' );
|
||||
|
||||
$grid.imagesLoaded( function() {
|
||||
$grid.masonry( 'layout' );
|
||||
$grid.removeClass( 'are-images-unloaded' );
|
||||
$( '.load-more' ).removeClass( 'are-images-unloaded' );
|
||||
$( '#nav-below' ).css( 'opacity', '1' );
|
||||
$grid.masonry( 'option', { itemSelector: '.masonry-post' });
|
||||
var $items = $grid.find( '.masonry-post' );
|
||||
$grid.masonry( 'appended', $items );
|
||||
} );
|
||||
|
||||
$( '#nav-below' ).insertAfter( '.masonry-container' );
|
||||
|
||||
$( window ).on( "orientationchange", function( event ) {
|
||||
$grid.masonry( 'layout' );
|
||||
} );
|
||||
}
|
||||
|
||||
if ( $( '.infinite-scroll' ).length && $( '.nav-links .next' ).length ) {
|
||||
var $container = $( '#main article' ).first().parent();
|
||||
var $button = $( '.load-more a' );
|
||||
var svgIcon = '';
|
||||
|
||||
if ( blog.icon ) {
|
||||
svgIcon = blog.icon;
|
||||
}
|
||||
|
||||
$container.infiniteScroll( {
|
||||
path: '.nav-links .next',
|
||||
append: '#main article',
|
||||
history: false,
|
||||
outlayer: msnry,
|
||||
loadOnScroll: $button.length ? false : true,
|
||||
button: $button.length ? '.load-more a' : null,
|
||||
scrollThreshold: $button.length ? false : 600,
|
||||
} );
|
||||
|
||||
$button.on( 'click', function( e ) {
|
||||
$( this ).html( svgIcon + blog.loading ).addClass( 'loading' );
|
||||
} );
|
||||
|
||||
$container.on( 'append.infiniteScroll', function( event, response, path, items ) {
|
||||
if ( ! $( '.generate-columns-container' ).length ) {
|
||||
$container.append( $button.parent() );
|
||||
}
|
||||
|
||||
$( items ).find( 'img' ).each( function( index, img ) {
|
||||
img.outerHTML = img.outerHTML;
|
||||
} );
|
||||
|
||||
if ( $grid ) {
|
||||
$grid.imagesLoaded( function() {
|
||||
$grid.masonry( 'layout' );
|
||||
} );
|
||||
}
|
||||
|
||||
$button.html( svgIcon + blog.more ).removeClass( 'loading' );
|
||||
} );
|
||||
|
||||
$container.on( 'last.infiniteScroll', function() {
|
||||
$( '.load-more' ).hide();
|
||||
} );
|
||||
}
|
||||
} );
|
1
wp-content/plugins/gp-premium/blog/functions/js/scripts.min.js
vendored
Normal file
1
wp-content/plugins/gp-premium/blog/functions/js/scripts.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
jQuery(document).ready(function(t){var n=t(".masonry-container"),o=!1;if(n.length){var i=n.masonry({columnWidth:".grid-sizer",itemSelector:"none",stamp:".page-header",percentPosition:!0,stagger:30,visibleStyle:{transform:"translateY(0)",opacity:1},hiddenStyle:{transform:"translateY(5px)",opacity:0}});o=i.data("masonry"),i.imagesLoaded(function(){i.masonry("layout"),i.removeClass("are-images-unloaded"),t(".load-more").removeClass("are-images-unloaded"),t("#nav-below").css("opacity","1"),i.masonry("option",{itemSelector:".masonry-post"});var n=i.find(".masonry-post");i.masonry("appended",n)}),t("#nav-below").insertAfter(".masonry-container"),t(window).on("orientationchange",function(n){i.masonry("layout")})}if(t(".infinite-scroll").length&&t(".nav-links .next").length){var l=t("#main article").first().parent(),r=t(".load-more a"),s="";blog.icon&&(s=blog.icon),l.infiniteScroll({path:".nav-links .next",append:"#main article",history:!1,outlayer:o,loadOnScroll:!r.length,button:r.length?".load-more a":null,scrollThreshold:!r.length&&600}),r.on("click",function(n){t(this).html(s+blog.loading).addClass("loading")}),l.on("append.infiniteScroll",function(n,o,e,a){t(".generate-columns-container").length||l.append(r.parent()),t(a).find("img").each(function(n,o){o.outerHTML=o.outerHTML}),i&&i.imagesLoaded(function(){i.masonry("layout")}),r.html(s+blog.more).removeClass("loading")}),l.on("last.infiniteScroll",function(){t(".load-more").hide()})}});
|
122
wp-content/plugins/gp-premium/blog/functions/migrate.php
Normal file
122
wp-content/plugins/gp-premium/blog/functions/migrate.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
defined( 'WPINC' ) or die;
|
||||
|
||||
add_action( 'admin_init', 'generate_blog_update_visibility_settings' );
|
||||
/**
|
||||
* Migrates our old Blog settings so we can use checkboxes instead.
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
function generate_blog_update_visibility_settings() {
|
||||
// Get our migration settings
|
||||
$settings = get_option( 'generate_migration_settings', array() );
|
||||
|
||||
// If we've already ran this function, bail
|
||||
if ( isset( $settings[ 'blog_visibility_updated' ] ) && 'true' == $settings[ 'blog_visibility_updated' ] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// A lot of the defaults changed, so lets put the old defaults here
|
||||
$defaults = array(
|
||||
'masonry' => 'false',
|
||||
'masonry_width' => 'width2',
|
||||
'masonry_most_recent_width' => 'width4',
|
||||
'post_image' => 'true',
|
||||
'date' => 'true',
|
||||
'author' => 'true',
|
||||
'categories' => 'true',
|
||||
'tags' => 'true',
|
||||
'comments' => 'true',
|
||||
);
|
||||
|
||||
// Get our spacing settings
|
||||
$blog_settings = wp_parse_args(
|
||||
get_option( 'generate_blog_settings', array() ),
|
||||
$defaults
|
||||
);
|
||||
|
||||
$new_settings = array();
|
||||
|
||||
// These options use to be a select input with false + true values
|
||||
// This will make the false values empty so the options can be checkboxes
|
||||
$keys = array( 'date', 'author', 'categories', 'tags', 'comments', 'masonry', 'post_image' );
|
||||
foreach ( $keys as $key ) {
|
||||
if ( is_string( $blog_settings[ $key ] ) ) {
|
||||
if ( 'false' == $blog_settings[ $key ] ) {
|
||||
$new_settings[ $key ] = false;
|
||||
} elseif ( 'true' == $blog_settings[ $key ] ) {
|
||||
$new_settings[ $key ] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set the single post meta options to whatever the blog options are
|
||||
$new_settings[ 'single_date' ] = isset( $new_settings[ 'date' ] ) ? $new_settings[ 'date' ] : true;
|
||||
$new_settings[ 'single_author' ] = isset( $new_settings[ 'author' ] ) ? $new_settings[ 'author' ] : true;
|
||||
$new_settings[ 'single_categories' ] = isset( $new_settings[ 'categories' ] ) ? $new_settings[ 'categories' ] : true;
|
||||
$new_settings[ 'single_tags' ] = isset( $new_settings[ 'tags' ] ) ? $new_settings[ 'tags' ] : true;
|
||||
|
||||
if ( isset( $new_settings[ 'masonry' ] ) && $new_settings[ 'masonry' ] ) {
|
||||
$new_settings[ 'column_layout' ] = true;
|
||||
$new_settings[ 'infinite_scroll' ] = true;
|
||||
$new_settings[ 'infinite_scroll_button' ] = true;
|
||||
|
||||
if ( 'width2' == $blog_settings['masonry_width'] ) {
|
||||
$new_settings[ 'columns' ] = '33';
|
||||
}
|
||||
|
||||
if ( 'width4' == $blog_settings['masonry_width'] ) {
|
||||
$new_settings[ 'columns' ] = '50';
|
||||
}
|
||||
|
||||
if ( 'width6' == $blog_settings['masonry_width'] ) {
|
||||
$new_settings[ 'columns' ] = '100';
|
||||
}
|
||||
|
||||
if ( 'width2' == $blog_settings[ 'masonry_width' ] ) {
|
||||
if ( 'width2' !== $blog_settings[ 'masonry_most_recent_width' ] ) {
|
||||
$new_settings[ 'featured_column' ] = true;
|
||||
} else {
|
||||
$new_settings[ 'featured_column' ] = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'width4' == $blog_settings[ 'masonry_width' ] ) {
|
||||
if ( 'width6' == $blog_settings[ 'masonry_most_recent_width' ] ) {
|
||||
$new_settings[ 'featured_column' ] = true;
|
||||
} else {
|
||||
$new_settings[ 'featured_column' ] = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'width6' == $blog_settings[ 'masonry_width' ] ) {
|
||||
$new_settings[ 'featured_column' ] = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( function_exists( 'generate_page_header_get_defaults' ) ) {
|
||||
$page_header_settings = wp_parse_args(
|
||||
get_option( 'generate_page_header_settings', array() ),
|
||||
generate_page_header_get_defaults()
|
||||
);
|
||||
|
||||
if ( 'hide' == $page_header_settings[ 'post_header_position' ] ) {
|
||||
$new_settings[ 'single_post_image' ] = false;
|
||||
} else {
|
||||
$new_settings[ 'single_post_image_position' ] = $page_header_settings[ 'post_header_position' ];
|
||||
}
|
||||
|
||||
$new_settings[ 'page_post_image_position' ] = $page_header_settings[ 'page_header_position' ];
|
||||
}
|
||||
|
||||
unset( $blog_settings['masonry_width'] );
|
||||
unset( $blog_settings['masonry_most_recent_width'] );
|
||||
|
||||
$update_settings = wp_parse_args( $new_settings, $blog_settings );
|
||||
update_option( 'generate_blog_settings', $update_settings );
|
||||
|
||||
// Update our migration option so we don't need to run this again
|
||||
$updated[ 'blog_visibility_updated' ] = 'true';
|
||||
$migration_settings = wp_parse_args( $updated, $settings );
|
||||
update_option( 'generate_migration_settings', $migration_settings );
|
||||
}
|
17
wp-content/plugins/gp-premium/blog/generate-blog.php
Normal file
17
wp-content/plugins/gp-premium/blog/generate-blog.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/*
|
||||
Add-on Name: Generate Blog
|
||||
Author: Thomas Usborne
|
||||
Author URI: http://edge22.com
|
||||
*/
|
||||
|
||||
// No direct access, please
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
// Define the version
|
||||
if ( ! defined( 'GENERATE_BLOG_VERSION' ) ) {
|
||||
define( 'GENERATE_BLOG_VERSION', GP_PREMIUM_VERSION );
|
||||
}
|
||||
|
||||
// Include functions identical between standalone addon and GP Premium
|
||||
require plugin_dir_path( __FILE__ ) . 'functions/generate-blog.php';
|
Reference in New Issue
Block a user