updated plugin GP Premium
version 2.0.3
This commit is contained in:
@ -215,6 +215,227 @@ function generate_premium_customizer_shortcut_controls( $wp_customize ) {
|
||||
);
|
||||
}
|
||||
|
||||
add_action( 'customize_register', 'generate_premium_layout_block_element_messages', 1000 );
|
||||
/**
|
||||
* Add shortcuts to sections we don't control in this plugin.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
function generate_premium_layout_block_element_messages( $wp_customize ) {
|
||||
if ( ! class_exists( 'WP_Customize_Panel' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( method_exists( $wp_customize, 'register_control_type' ) ) {
|
||||
$wp_customize->register_control_type( 'GeneratePress_Information_Customize_Control' );
|
||||
}
|
||||
|
||||
if ( version_compare( PHP_VERSION, '5.6', '>=' ) ) {
|
||||
$footer_sections = array(
|
||||
'generate_layout_footer',
|
||||
'footer_color_section',
|
||||
'font_footer_section',
|
||||
'generate_backgrounds_footer',
|
||||
);
|
||||
|
||||
foreach ( $footer_sections as $section ) {
|
||||
if ( $wp_customize->get_section( $section ) ) {
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Information_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_using_site_footer_element_' . $section,
|
||||
array(
|
||||
'section' => $section,
|
||||
'description' => sprintf(
|
||||
/* translators: URL to the Elements dashboard. */
|
||||
__( 'This page is using a <a href="%s">Site Footer Element</a>. Some of the options below may not apply.', 'gp-premium' ),
|
||||
admin_url( 'edit.php?post_type=gp_elements' )
|
||||
),
|
||||
'notice' => true,
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
'active_callback' => function() {
|
||||
$has_block_element = generate_has_active_element( 'site-footer', true );
|
||||
|
||||
if ( $has_block_element ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
'priority' => 0,
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$header_sections = array(
|
||||
'generate_layout_header',
|
||||
'header_color_section',
|
||||
'font_header_section',
|
||||
'generate_backgrounds_header',
|
||||
);
|
||||
|
||||
foreach ( $header_sections as $section ) {
|
||||
if ( $wp_customize->get_section( $section ) ) {
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Information_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_using_site_header_element_' . $section,
|
||||
array(
|
||||
'section' => $section,
|
||||
'description' => sprintf(
|
||||
/* translators: URL to the Elements dashboard. */
|
||||
__( 'This page is using a <a href="%s">Site Header Element</a>. Some of the options below may not apply.', 'gp-premium' ),
|
||||
admin_url( 'edit.php?post_type=gp_elements' )
|
||||
),
|
||||
'notice' => true,
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
'active_callback' => function() {
|
||||
$has_block_element = generate_has_active_element( 'site-header', true );
|
||||
|
||||
if ( $has_block_element ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
'priority' => 0,
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$sidebar_sections = array(
|
||||
'generate_layout_sidebars',
|
||||
'sidebar_widget_color_section',
|
||||
'font_widget_section',
|
||||
'generate_backgrounds_sidebars',
|
||||
);
|
||||
|
||||
foreach ( $sidebar_sections as $section ) {
|
||||
if ( $wp_customize->get_section( $section ) ) {
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Information_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_using_sidebar_element_' . $section,
|
||||
array(
|
||||
'section' => $section,
|
||||
'description' => sprintf(
|
||||
/* translators: URL to the Elements dashboard. */
|
||||
__( 'This page is using a <a href="%s">Sidebar Element</a>. Some of the options below may not apply.', 'gp-premium' ),
|
||||
admin_url( 'edit.php?post_type=gp_elements' )
|
||||
),
|
||||
'notice' => true,
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
'active_callback' => function() {
|
||||
$has_right_sidebar_block_element = generate_has_active_element( 'right-sidebar', true );
|
||||
|
||||
if ( $has_right_sidebar_block_element ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$has_left_sidebar_block_element = generate_has_active_element( 'left-sidebar', true );
|
||||
|
||||
if ( $has_left_sidebar_block_element ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
'priority' => 0,
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( $wp_customize->get_section( 'generate_blog_section' ) ) {
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Information_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_using_post_loop_item_element',
|
||||
array(
|
||||
'section' => 'generate_blog_section',
|
||||
'description' => sprintf(
|
||||
/* translators: URL to the Elements dashboard. */
|
||||
__( 'This page is using a <a href="%s">Content Template Element</a>. Some of the options below may not apply.', 'gp-premium' ),
|
||||
admin_url( 'edit.php?post_type=gp_elements' )
|
||||
),
|
||||
'notice' => true,
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
'active_callback' => function() {
|
||||
$has_block_element = generate_has_active_element( 'content-template', true );
|
||||
|
||||
if ( $has_block_element ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
'priority' => 0,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Information_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_using_page_hero_element',
|
||||
array(
|
||||
'section' => 'generate_blog_section',
|
||||
'description' => sprintf(
|
||||
/* translators: URL to the Elements dashboard. */
|
||||
__( 'This page is using a <a href="%s">Page Hero Element</a>. Some of the options below may not apply.', 'gp-premium' ),
|
||||
admin_url( 'edit.php?post_type=gp_elements' )
|
||||
),
|
||||
'notice' => true,
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
'active_callback' => function() {
|
||||
$has_block_element = generate_has_active_element( 'page-hero', true );
|
||||
|
||||
if ( $has_block_element ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
'priority' => 0,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Information_Customize_Control(
|
||||
$wp_customize,
|
||||
'generate_using_post_meta_area_element',
|
||||
array(
|
||||
'section' => 'generate_blog_section',
|
||||
'description' => sprintf(
|
||||
/* translators: URL to the Elements dashboard. */
|
||||
__( 'This page is using a <a href="%s">Post Meta Template Element</a>. Some of the options below may not apply.', 'gp-premium' ),
|
||||
admin_url( 'edit.php?post_type=gp_elements' )
|
||||
),
|
||||
'notice' => true,
|
||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||
'active_callback' => function() {
|
||||
$has_block_element = generate_has_active_element( 'post-meta-template', true );
|
||||
|
||||
if ( $has_block_element ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
'priority' => 0,
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'customize_controls_print_styles', 'generate_premium_customize_print_styles' );
|
||||
/**
|
||||
* Print control styles for the Customizer.
|
||||
|
Reference in New Issue
Block a user