updated theme GeneratePress
version 3.0.2
This commit is contained in:
@ -79,11 +79,11 @@ function generate_get_block_editor_content_width() {
|
||||
|
||||
$layout = generate_get_block_editor_sidebar_layout();
|
||||
|
||||
if ( 'left-sidebar' == $layout ) {
|
||||
if ( 'left-sidebar' === $layout ) {
|
||||
$content_width = $container_width * ( ( 100 - $left_sidebar_width ) / 100 );
|
||||
} elseif ( 'right-sidebar' == $layout ) {
|
||||
} elseif ( 'right-sidebar' === $layout ) {
|
||||
$content_width = $container_width * ( ( 100 - $right_sidebar_width ) / 100 );
|
||||
} elseif ( 'no-sidebar' == $layout ) {
|
||||
} elseif ( 'no-sidebar' === $layout ) {
|
||||
$content_width = $container_width;
|
||||
} else {
|
||||
$content_width = $container_width * ( ( 100 - ( $left_sidebar_width + $right_sidebar_width ) ) / 100 );
|
||||
@ -100,14 +100,14 @@ add_action( 'enqueue_block_editor_assets', 'generate_enqueue_backend_block_edito
|
||||
* @since 2.2
|
||||
*/
|
||||
function generate_enqueue_backend_block_editor_assets() {
|
||||
wp_enqueue_style( 'generate-block-editor-styles', get_template_directory_uri() . "/css/admin/block-editor.css", false, GENERATE_VERSION, 'all' );
|
||||
wp_enqueue_script( 'generate-block-editor-tinycolor', get_template_directory_uri() . "/js/admin/tinycolor.js", false, GENERATE_VERSION, true );
|
||||
wp_enqueue_script( 'generate-block-editor-scripts', get_template_directory_uri() . "/js/admin/block-editor.js", array( 'jquery', 'generate-block-editor-tinycolor' ), GENERATE_VERSION, true );
|
||||
wp_enqueue_style( 'generate-block-editor-styles', get_template_directory_uri() . '/assets/css/admin/block-editor.css', false, GENERATE_VERSION, 'all' );
|
||||
wp_enqueue_script( 'generate-block-editor-tinycolor', get_template_directory_uri() . '/assets/js/admin/tinycolor.js', false, GENERATE_VERSION, true );
|
||||
wp_enqueue_script( 'generate-block-editor-scripts', get_template_directory_uri() . '/assets/js/admin/block-editor.js', array( 'jquery', 'generate-block-editor-tinycolor' ), GENERATE_VERSION, true );
|
||||
|
||||
$show_editor_styles = apply_filters( 'generate_show_block_editor_styles', true );
|
||||
|
||||
if ( $show_editor_styles ) {
|
||||
wp_add_inline_style( 'generate-block-editor-styles', generate_do_inline_block_editor_css() );
|
||||
wp_add_inline_style( 'generate-block-editor-styles', wp_strip_all_tags( generate_do_inline_block_editor_css() ) );
|
||||
}
|
||||
|
||||
$color_settings = wp_parse_args(
|
||||
@ -126,19 +126,23 @@ function generate_enqueue_backend_block_editor_assets() {
|
||||
$text_color = $color_settings['content_text_color'];
|
||||
}
|
||||
|
||||
wp_localize_script( 'generate-block-editor-scripts', 'generate_block_editor', array(
|
||||
'global_sidebar_layout' => generate_get_block_editor_sidebar_layout( false ),
|
||||
'container_width' => generate_get_option( 'container_width' ),
|
||||
'right_sidebar_width' => apply_filters( 'generate_right_sidebar_width', '25' ),
|
||||
'left_sidebar_width' => apply_filters( 'generate_left_sidebar_width', '25' ),
|
||||
'content_padding_right' => absint( $spacing_settings['content_right'] ) . 'px',
|
||||
'content_padding_left' => absint( $spacing_settings['content_left'] ) . 'px',
|
||||
'content_title' => generate_get_block_editor_show_content_title() ? 'true' : 'false',
|
||||
'disable_content_title' => esc_html( 'Disable Content Title', 'generatepress' ),
|
||||
'show_content_title' => esc_html( 'Show Content Title', 'generatepress' ),
|
||||
'text_color' => $text_color,
|
||||
'show_editor_styles' => $show_editor_styles,
|
||||
) );
|
||||
wp_localize_script(
|
||||
'generate-block-editor-scripts',
|
||||
'generate_block_editor',
|
||||
array(
|
||||
'global_sidebar_layout' => generate_get_block_editor_sidebar_layout( false ),
|
||||
'container_width' => generate_get_option( 'container_width' ),
|
||||
'right_sidebar_width' => apply_filters( 'generate_right_sidebar_width', '25' ),
|
||||
'left_sidebar_width' => apply_filters( 'generate_left_sidebar_width', '25' ),
|
||||
'content_padding_right' => absint( $spacing_settings['content_right'] ) . 'px',
|
||||
'content_padding_left' => absint( $spacing_settings['content_left'] ) . 'px',
|
||||
'content_title' => generate_get_block_editor_show_content_title() ? 'true' : 'false',
|
||||
'disable_content_title' => esc_html__( 'Disable Content Title', 'generatepress' ),
|
||||
'show_content_title' => esc_html__( 'Show Content Title', 'generatepress' ),
|
||||
'text_color' => $text_color,
|
||||
'show_editor_styles' => $show_editor_styles,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -157,7 +161,7 @@ function generate_do_inline_block_editor_css() {
|
||||
generate_get_default_fonts()
|
||||
);
|
||||
|
||||
$css = new GeneratePress_CSS;
|
||||
$css = new GeneratePress_CSS();
|
||||
|
||||
$content_width = generate_get_block_editor_content_width();
|
||||
|
||||
@ -184,7 +188,7 @@ function generate_do_inline_block_editor_css() {
|
||||
$css->set_selector( 'html body.gutenberg-editor-page .block-editor-block-list__block[data-align="full"]' );
|
||||
$css->add_property( 'max-width', 'none' );
|
||||
|
||||
$css->set_selector( '.edit-post-visual-editor .block-editor-block-list__block[data-align=wide]' );
|
||||
$css->set_selector( '.wp-block[data-align="wide"]' );
|
||||
$css->add_property( 'max-width', absint( $content_width ), false, 'px' );
|
||||
|
||||
if ( apply_filters( 'generate_do_group_inner_container_style', true ) ) {
|
||||
@ -195,13 +199,13 @@ function generate_do_inline_block_editor_css() {
|
||||
$css->add_property( 'padding', generate_padding_css( $spacing_settings['content_top'], $spacing_settings['content_right'], $spacing_settings['content_bottom'], $spacing_settings['content_left'] ) );
|
||||
}
|
||||
|
||||
$css->set_selector( '.wp-block-button__link:not(.has-background)' );
|
||||
$css->add_property( 'color', esc_attr( $color_settings['form_button_text_color'] ) );
|
||||
$css->add_property( 'background-color', esc_attr( $color_settings['form_button_background_color'] ) );
|
||||
$css->set_selector( '.editor-styles-wrapper a.button, .wp-block-button__link:not(.has-background)' );
|
||||
$css->add_property( 'color', $color_settings['form_button_text_color'] );
|
||||
$css->add_property( 'background-color', $color_settings['form_button_background_color'] );
|
||||
|
||||
$css->set_selector( '.wp-block-button__link:not(.has-background):active, .wp-block-button__link:not(.has-background):focus, .wp-block-button__link:not(.has-background):hover' );
|
||||
$css->add_property( 'color', esc_attr( $color_settings['form_button_text_color_hover'] ) );
|
||||
$css->add_property( 'background-color', esc_attr( $color_settings['form_button_background_color_hover'] ) );
|
||||
$css->set_selector( '.editor-styles-wrapper a.button:hover, .editor-styles-wrapper a.button:focus, .wp-block-button__link:not(.has-background):active, .wp-block-button__link:not(.has-background):focus, .wp-block-button__link:not(.has-background):hover' );
|
||||
$css->add_property( 'color', $color_settings['form_button_text_color_hover'] );
|
||||
$css->add_property( 'background-color', $color_settings['form_button_background_color_hover'] );
|
||||
|
||||
$body_family = generate_get_font_family_css( 'font_body', 'generate_settings', generate_get_default_fonts() );
|
||||
$h1_family = generate_get_font_family_css( 'font_heading_1', 'generate_settings', generate_get_default_fonts() );
|
||||
@ -217,76 +221,88 @@ function generate_do_inline_block_editor_css() {
|
||||
$css->add_property( 'font-size', absint( $font_settings['body_font_size'] ), false, 'px' );
|
||||
|
||||
if ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$css->add_property( 'color', esc_attr( generate_get_option( 'text_color' ) ) );
|
||||
$css->add_property( 'color', generate_get_option( 'text_color' ) );
|
||||
}
|
||||
|
||||
$css->set_selector( '.content-title-visibility' );
|
||||
|
||||
if ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$css->add_property( 'color', esc_attr( generate_get_option( 'text_color' ) ) );
|
||||
$css->add_property( 'color', generate_get_option( 'text_color' ) );
|
||||
}
|
||||
|
||||
$css->set_selector( 'body .editor-styles-wrapper, body .editor-styles-wrapper p, body .editor-styles-wrapper .mce-content-body' );
|
||||
$css->add_property( 'line-height', floatval( $font_settings['body_line_height'] ) );
|
||||
|
||||
$css->set_selector( 'body .editor-styles-wrapper p' );
|
||||
$css->add_property( 'margin-top', '0px' );
|
||||
$css->add_property( 'margin-bottom', $font_settings['paragraph_margin'], false, 'em' );
|
||||
|
||||
$css->set_selector( 'body .editor-styles-wrapper h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-post-title__block .editor-post-title__input' );
|
||||
$css->add_property( 'font-family', 'inherit' === $h1_family || '' === $h1_family ? $body_family : $h1_family );
|
||||
$css->add_property( 'font-weight', esc_attr( $font_settings['heading_1_weight'] ) );
|
||||
$css->add_property( 'text-transform', esc_attr( $font_settings['heading_1_transform'] ) );
|
||||
$css->add_property( 'font-weight', $font_settings['heading_1_weight'] );
|
||||
$css->add_property( 'text-transform', $font_settings['heading_1_transform'] );
|
||||
$css->add_property( 'font-size', absint( $font_settings['heading_1_font_size'] ), false, 'px' );
|
||||
$css->add_property( 'line-height', floatval( $font_settings['heading_1_line_height'] ), false, 'em' );
|
||||
$css->add_property( 'margin-bottom', floatval( $font_settings['heading_1_margin_bottom'] ), false, 'px' );
|
||||
$css->add_property( 'margin-top', '0' );
|
||||
|
||||
if ( $color_settings['h1_color'] ) {
|
||||
$css->add_property( 'color', esc_attr( $color_settings['h1_color'] ) );
|
||||
$css->add_property( 'color', $color_settings['h1_color'] );
|
||||
} elseif ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$css->add_property( 'color', esc_attr( generate_get_option( 'text_color' ) ) );
|
||||
$css->add_property( 'color', generate_get_option( 'text_color' ) );
|
||||
}
|
||||
|
||||
if ( $color_settings['content_title_color'] ) {
|
||||
$css->set_selector( '.editor-post-title__block .editor-post-title__input' );
|
||||
$css->add_property( 'color', esc_attr( $color_settings['content_title_color'] ) );
|
||||
$css->add_property( 'color', $color_settings['content_title_color'] );
|
||||
}
|
||||
|
||||
$css->set_selector( 'body .editor-styles-wrapper h2, .wp-block-heading h2.editor-rich-text__tinymce' );
|
||||
$css->add_property( 'font-family', $h2_family );
|
||||
$css->add_property( 'font-weight', esc_attr( $font_settings['heading_2_weight'] ) );
|
||||
$css->add_property( 'text-transform', esc_attr( $font_settings['heading_2_transform'] ) );
|
||||
$css->add_property( 'font-weight', $font_settings['heading_2_weight'] );
|
||||
$css->add_property( 'text-transform', $font_settings['heading_2_transform'] );
|
||||
$css->add_property( 'font-size', absint( $font_settings['heading_2_font_size'] ), false, 'px' );
|
||||
$css->add_property( 'line-height', floatval( $font_settings['heading_2_line_height'] ), false, 'em' );
|
||||
$css->add_property( 'margin-bottom', floatval( $font_settings['heading_2_margin_bottom'] ), false, 'px' );
|
||||
$css->add_property( 'margin-top', '0' );
|
||||
|
||||
if ( $color_settings['h2_color'] ) {
|
||||
$css->add_property( 'color', esc_attr( $color_settings['h2_color'] ) );
|
||||
$css->add_property( 'color', $color_settings['h2_color'] );
|
||||
} elseif ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$css->add_property( 'color', esc_attr( generate_get_option( 'text_color' ) ) );
|
||||
$css->add_property( 'color', generate_get_option( 'text_color' ) );
|
||||
}
|
||||
|
||||
$css->set_selector( 'body .editor-styles-wrapper h3, .wp-block-heading h3.editor-rich-text__tinymce' );
|
||||
$css->add_property( 'font-family', $h3_family );
|
||||
$css->add_property( 'font-weight', esc_attr( $font_settings['heading_3_weight'] ) );
|
||||
$css->add_property( 'text-transform', esc_attr( $font_settings['heading_3_transform'] ) );
|
||||
$css->add_property( 'font-weight', $font_settings['heading_3_weight'] );
|
||||
$css->add_property( 'text-transform', $font_settings['heading_3_transform'] );
|
||||
$css->add_property( 'font-size', absint( $font_settings['heading_3_font_size'] ), false, 'px' );
|
||||
$css->add_property( 'line-height', floatval( $font_settings['heading_3_line_height'] ), false, 'em' );
|
||||
$css->add_property( 'margin-bottom', floatval( $font_settings['heading_3_margin_bottom'] ), false, 'px' );
|
||||
$css->add_property( 'margin-top', '0' );
|
||||
|
||||
if ( $color_settings['h3_color'] ) {
|
||||
$css->add_property( 'color', esc_attr( $color_settings['h3_color'] ) );
|
||||
$css->add_property( 'color', $color_settings['h3_color'] );
|
||||
} elseif ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$css->add_property( 'color', esc_attr( generate_get_option( 'text_color' ) ) );
|
||||
$css->add_property( 'color', generate_get_option( 'text_color' ) );
|
||||
}
|
||||
|
||||
$css->set_selector( 'body .editor-styles-wrapper h4, .wp-block-heading h4.editor-rich-text__tinymce' );
|
||||
$css->add_property( 'font-family', $h4_family );
|
||||
$css->add_property( 'font-weight', esc_attr( $font_settings['heading_4_weight'] ) );
|
||||
$css->add_property( 'text-transform', esc_attr( $font_settings['heading_4_transform'] ) );
|
||||
$css->add_property( 'font-weight', $font_settings['heading_4_weight'] );
|
||||
$css->add_property( 'text-transform', $font_settings['heading_4_transform'] );
|
||||
$css->add_property( 'margin-bottom', '20px' );
|
||||
$css->add_property( 'margin-top', '0' );
|
||||
|
||||
if ( '' !== $font_settings['heading_4_font_size'] ) {
|
||||
$css->add_property( 'font-size', absint( $font_settings['heading_4_font_size'] ), false, 'px' );
|
||||
@ -299,17 +315,19 @@ function generate_do_inline_block_editor_css() {
|
||||
}
|
||||
|
||||
if ( $color_settings['h4_color'] ) {
|
||||
$css->add_property( 'color', esc_attr( $color_settings['h4_color'] ) );
|
||||
$css->add_property( 'color', $color_settings['h4_color'] );
|
||||
} elseif ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$css->add_property( 'color', esc_attr( generate_get_option( 'text_color' ) ) );
|
||||
$css->add_property( 'color', generate_get_option( 'text_color' ) );
|
||||
}
|
||||
|
||||
$css->set_selector( 'body .editor-styles-wrapper h5, .wp-block-heading h5.editor-rich-text__tinymce' );
|
||||
$css->add_property( 'font-family', $h5_family );
|
||||
$css->add_property( 'font-weight', esc_attr( $font_settings['heading_5_weight'] ) );
|
||||
$css->add_property( 'text-transform', esc_attr( $font_settings['heading_5_transform'] ) );
|
||||
$css->add_property( 'font-weight', $font_settings['heading_5_weight'] );
|
||||
$css->add_property( 'text-transform', $font_settings['heading_5_transform'] );
|
||||
$css->add_property( 'margin-bottom', '20px' );
|
||||
$css->add_property( 'margin-top', '0' );
|
||||
|
||||
if ( '' !== $font_settings['heading_5_font_size'] ) {
|
||||
$css->add_property( 'font-size', absint( $font_settings['heading_5_font_size'] ), false, 'px' );
|
||||
@ -322,17 +340,19 @@ function generate_do_inline_block_editor_css() {
|
||||
}
|
||||
|
||||
if ( $color_settings['h5_color'] ) {
|
||||
$css->add_property( 'color', esc_attr( $color_settings['h5_color'] ) );
|
||||
$css->add_property( 'color', $color_settings['h5_color'] );
|
||||
} elseif ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$css->add_property( 'color', esc_attr( generate_get_option( 'text_color' ) ) );
|
||||
$css->add_property( 'color', generate_get_option( 'text_color' ) );
|
||||
}
|
||||
|
||||
$css->set_selector( 'body .editor-styles-wrapper h6, .wp-block-heading h6.editor-rich-text__tinymce' );
|
||||
$css->add_property( 'font-family', $h6_family );
|
||||
$css->add_property( 'font-weight', esc_attr( $font_settings['heading_6_weight'] ) );
|
||||
$css->add_property( 'text-transform', esc_attr( $font_settings['heading_6_transform'] ) );
|
||||
$css->add_property( 'font-weight', $font_settings['heading_6_weight'] );
|
||||
$css->add_property( 'text-transform', $font_settings['heading_6_transform'] );
|
||||
$css->add_property( 'margin-bottom', '20px' );
|
||||
$css->add_property( 'margin-top', '0' );
|
||||
|
||||
if ( '' !== $font_settings['heading_6_font_size'] ) {
|
||||
$css->add_property( 'font-size', absint( $font_settings['heading_6_font_size'] ), false, 'px' );
|
||||
@ -345,45 +365,46 @@ function generate_do_inline_block_editor_css() {
|
||||
}
|
||||
|
||||
if ( $color_settings['h6_color'] ) {
|
||||
$css->add_property( 'color', esc_attr( $color_settings['h6_color'] ) );
|
||||
$css->add_property( 'color', $color_settings['h6_color'] );
|
||||
} elseif ( $color_settings['content_text_color'] ) {
|
||||
$css->add_property( 'color', esc_attr( $color_settings['content_text_color'] ) );
|
||||
$css->add_property( 'color', $color_settings['content_text_color'] );
|
||||
} else {
|
||||
$css->add_property( 'color', esc_attr( generate_get_option( 'text_color' ) ) );
|
||||
$css->add_property( 'color', generate_get_option( 'text_color' ) );
|
||||
}
|
||||
|
||||
$css->set_selector( '.block-editor-block-list__layout .wp-block-button .wp-block-button__link' );
|
||||
$css->set_selector( '.editor-styles-wrapper a.button, .block-editor-block-list__layout .wp-block-button .wp-block-button__link' );
|
||||
$css->add_property( 'font-family', $buttons_family );
|
||||
$css->add_property( 'font-weight', esc_attr( $font_settings['buttons_font_weight'] ) );
|
||||
$css->add_property( 'text-transform', esc_attr( $font_settings['buttons_font_transform'] ) );
|
||||
$css->add_property( 'font-weight', $font_settings['buttons_font_weight'] );
|
||||
$css->add_property( 'text-transform', $font_settings['buttons_font_transform'] );
|
||||
|
||||
if ( '' !== $font_settings['buttons_font_size'] ) {
|
||||
$css->add_property( 'font-size', absint( $font_settings['buttons_font_size'] ), false, 'px' );
|
||||
}
|
||||
|
||||
$css->set_selector( 'body .editor-styles-wrapper' );
|
||||
$css->add_property( 'background-color', esc_attr( generate_get_option( 'background_color' ) ) );
|
||||
$css->add_property( 'background-color', generate_get_option( 'background_color' ) );
|
||||
|
||||
if ( $color_settings['content_background_color'] ) {
|
||||
$body_background = esc_attr( generate_get_option( 'background_color' ) );
|
||||
$content_background = esc_attr( $color_settings['content_background_color'] );
|
||||
$body_background = generate_get_option( 'background_color' );
|
||||
$content_background = $color_settings['content_background_color'];
|
||||
|
||||
$css->add_property( 'background', 'linear-gradient(' . $content_background . ',' . $content_background . '), linear-gradient(' . $body_background . ',' . $body_background . ')' );
|
||||
}
|
||||
|
||||
$css->set_selector( '.block-editor-block-list__block a, .block-editor-block-list__block a:visited' );
|
||||
|
||||
if ( $color_settings['content_link_color'] ) {
|
||||
$css->add_property( 'color', esc_attr( $color_settings['content_link_color'] ) );
|
||||
$css->add_property( 'color', $color_settings['content_link_color'] );
|
||||
} else {
|
||||
$css->add_property( 'color', esc_attr( generate_get_option( 'link_color' ) ) );
|
||||
$css->add_property( 'color', generate_get_option( 'link_color' ) );
|
||||
}
|
||||
|
||||
$css->set_selector( '.block-editor-block-list__block a:hover, .block-editor-block-list__block a:focus, .block-editor-block-list__block a:active' );
|
||||
|
||||
if ( $color_settings['content_link_hover_color'] ) {
|
||||
$css->add_property( 'color', esc_attr( $color_settings['content_link_hover_color'] ) );
|
||||
$css->add_property( 'color', $color_settings['content_link_hover_color'] );
|
||||
} else {
|
||||
$css->add_property( 'color', esc_attr( generate_get_option( 'link_color_hover' ) ) );
|
||||
$css->add_property( 'color', generate_get_option( 'link_color_hover' ) );
|
||||
}
|
||||
|
||||
return $css->css_output();
|
||||
|
@ -24,7 +24,7 @@ if ( ! class_exists( 'GeneratePress_CSS' ) ) {
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $_selector = '';
|
||||
protected $_selector = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
|
||||
|
||||
/**
|
||||
* Stores the final css output with all of its rules for the current selector.
|
||||
@ -32,7 +32,7 @@ if ( ! class_exists( 'GeneratePress_CSS' ) ) {
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $_selector_output = '';
|
||||
protected $_selector_output = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
|
||||
|
||||
/**
|
||||
* Stores all of the rules that will be added to the selector
|
||||
@ -40,7 +40,7 @@ if ( ! class_exists( 'GeneratePress_CSS' ) ) {
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $_css = '';
|
||||
protected $_css = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
|
||||
|
||||
/**
|
||||
* The string that holds all of the css to output
|
||||
@ -48,14 +48,14 @@ if ( ! class_exists( 'GeneratePress_CSS' ) ) {
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $_output = '';
|
||||
protected $_output = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
|
||||
|
||||
/**
|
||||
* Stores media queries
|
||||
*
|
||||
* @var null
|
||||
*/
|
||||
protected $_media_query = null;
|
||||
protected $_media_query = null; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
|
||||
|
||||
/**
|
||||
* The string that holds all of the css to output inside of the media query
|
||||
@ -63,7 +63,7 @@ if ( ! class_exists( 'GeneratePress_CSS' ) ) {
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $_media_query_output = '';
|
||||
protected $_media_query_output = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
|
||||
|
||||
/**
|
||||
* Sets a selector to the object and changes the current selector to a new one
|
||||
@ -71,12 +71,12 @@ if ( ! class_exists( 'GeneratePress_CSS' ) ) {
|
||||
* @access public
|
||||
* @since 1.0
|
||||
*
|
||||
* @param string $selector - the css identifier of the html that you wish to target
|
||||
* @param string $selector - the css identifier of the html that you wish to target.
|
||||
* @return $this
|
||||
*/
|
||||
public function set_selector( $selector = '' ) {
|
||||
// Render the css in the output string everytime the selector changes.
|
||||
if ( $this->_selector !== '' ) {
|
||||
if ( '' !== $this->_selector ) {
|
||||
$this->add_selector_rules_to_output();
|
||||
}
|
||||
|
||||
@ -90,13 +90,18 @@ if ( ! class_exists( 'GeneratePress_CSS' ) ) {
|
||||
* @access public
|
||||
* @since 1.0
|
||||
*
|
||||
* @param string $property - the css property
|
||||
* @param string $value - the value to be placed with the property
|
||||
* @param string $og_default - check to see if the value matches the default
|
||||
* @param string $unit - the unit for the value (px)
|
||||
* @param string $property The css property.
|
||||
* @param string $value The value to be placed with the property.
|
||||
* @param string $og_default Check to see if the value matches the default.
|
||||
* @param string $unit The unit for the value (px).
|
||||
* @return $this
|
||||
*/
|
||||
public function add_property( $property, $value, $og_default = false, $unit = false ) {
|
||||
// Setting font-size to 0 is rarely ever a good thing.
|
||||
if ( 'font-size' === $property && 0 === $value ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Add our unit to our value if it exists.
|
||||
if ( $unit && '' !== $unit ) {
|
||||
$value = $value . $unit;
|
||||
@ -106,7 +111,7 @@ if ( ! class_exists( 'GeneratePress_CSS' ) ) {
|
||||
}
|
||||
|
||||
// If we don't have a value or our value is the same as our og default, bail.
|
||||
if ( empty( $value ) || $og_default == $value ) {
|
||||
if ( ( empty( $value ) && ! is_numeric( $value ) ) || $og_default === $value ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -118,7 +123,7 @@ if ( ! class_exists( 'GeneratePress_CSS' ) ) {
|
||||
* Sets a media query in the class
|
||||
*
|
||||
* @since 1.1
|
||||
* @param string $value
|
||||
* @param string $value The media query.
|
||||
* @return $this
|
||||
*/
|
||||
public function start_media_query( $value ) {
|
||||
|
327
wp-content/themes/generatepress/inc/class-theme-update.php
Normal file
327
wp-content/themes/generatepress/inc/class-theme-update.php
Normal file
@ -0,0 +1,327 @@
|
||||
<?php
|
||||
/**
|
||||
* Migrates old options on update.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Process option updates if necessary.
|
||||
*/
|
||||
class GeneratePress_Theme_Update {
|
||||
/**
|
||||
* Class instance.
|
||||
*
|
||||
* @access private
|
||||
* @var $instance Class instance.
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Initiator
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! isset( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
if ( is_admin() ) {
|
||||
add_action( 'admin_init', __CLASS__ . '::init', 5 );
|
||||
} else {
|
||||
add_action( 'wp', __CLASS__ . '::init', 5 );
|
||||
}
|
||||
|
||||
add_action( 'admin_init', __CLASS__ . '::admin_updates', 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement theme update logic. Only run updates on existing sites.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function init() {
|
||||
if ( is_customize_preview() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$saved_version = get_option( 'generate_db_version', false );
|
||||
|
||||
if ( false === $saved_version ) {
|
||||
// Typically this would mean this is a new install, but we haven't always had the version saved, so we need to check for existing settings.
|
||||
|
||||
$existing_settings = get_option( 'generate_settings', array() );
|
||||
|
||||
// Can't count this as a user-set option since a previous migration script set it.
|
||||
if ( isset( $existing_settings['combine_css'] ) ) {
|
||||
unset( $existing_settings['combine_css'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $existing_settings ) ) {
|
||||
// We have settings, which means this is an old install with no version number.
|
||||
$saved_version = '2.0';
|
||||
} else {
|
||||
// No settings and no saved version, must be a new install.
|
||||
|
||||
if ( 'admin_init' === current_action() ) {
|
||||
// If we're in the admin, add our version to the database.
|
||||
update_option( 'generate_db_version', GENERATE_VERSION );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( version_compare( $saved_version, GENERATE_VERSION, '=' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( version_compare( $saved_version, '2.3.0', '<' ) ) {
|
||||
self::v_2_3_0();
|
||||
}
|
||||
|
||||
if ( version_compare( $saved_version, '3.0.0-alpha.1', '<' ) ) {
|
||||
self::v_3_0_0();
|
||||
}
|
||||
|
||||
// Last thing to do is update our version.
|
||||
update_option( 'generate_db_version', GENERATE_VERSION );
|
||||
}
|
||||
|
||||
/**
|
||||
* Less important updates that should only happen in the Dashboard.
|
||||
* These use a database flag instead of our version number for legacy reasons.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function admin_updates() {
|
||||
self::v_1_3_0();
|
||||
self::v_1_3_29();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove variants from font family values.
|
||||
*
|
||||
* @since 1.3.0
|
||||
*/
|
||||
public static function v_1_3_0() {
|
||||
// Don't run this if Typography add-on is activated.
|
||||
if ( function_exists( 'generate_fonts_customize_register' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$settings = get_option( 'generate_settings', array() );
|
||||
|
||||
if ( ! isset( $settings['font_body'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$value = $settings['font_body'];
|
||||
$needs_update = false;
|
||||
|
||||
// If our value has : in it.
|
||||
if ( ! empty( $value ) && strpos( $value, ':' ) !== false ) {
|
||||
// Remove the : and anything past it.
|
||||
$value = current( explode( ':', $value ) );
|
||||
|
||||
$settings['font_body'] = $value;
|
||||
$needs_update = true;
|
||||
}
|
||||
|
||||
if ( $needs_update ) {
|
||||
update_option( 'generate_settings', $settings );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move logo to custom_logo option as required by WP.org.
|
||||
*
|
||||
* @since 1.3.29
|
||||
*/
|
||||
public static function v_1_3_29() {
|
||||
if ( ! function_exists( 'the_custom_logo' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( get_theme_mod( 'custom_logo' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$settings = get_option( 'generate_settings', array() );
|
||||
|
||||
if ( ! isset( $settings['logo'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$old_value = $settings['logo'];
|
||||
|
||||
if ( empty( $old_value ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$logo = attachment_url_to_postid( $old_value );
|
||||
|
||||
if ( is_int( $logo ) ) {
|
||||
set_theme_mod( 'custom_logo', $logo );
|
||||
}
|
||||
|
||||
if ( get_theme_mod( 'custom_logo' ) ) {
|
||||
$settings['logo'] = '';
|
||||
update_option( 'generate_settings', $settings );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn off the combine CSS option for existing sites.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
public static function v_2_3_0() {
|
||||
$settings = get_option( 'generate_settings', array() );
|
||||
$update_options = false;
|
||||
|
||||
if ( ! isset( $settings['combine_css'] ) ) {
|
||||
$settings['combine_css'] = false;
|
||||
$update_options = true;
|
||||
}
|
||||
|
||||
if ( $update_options ) {
|
||||
update_option( 'generate_settings', $settings );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update sites using old defaults.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function v_3_0_0() {
|
||||
$settings = get_option( 'generate_settings', array() );
|
||||
$update_options = false;
|
||||
|
||||
$old_defaults = array(
|
||||
'icons' => 'font',
|
||||
'structure' => 'floats',
|
||||
'hide_tagline' => '',
|
||||
'container_width' => '1100',
|
||||
'nav_position_setting' => 'nav-below-header',
|
||||
'container_alignment' => 'boxes',
|
||||
'background_color' => '#efefef',
|
||||
'text_color' => '#3a3a3a',
|
||||
'header_text_color' => '#3a3a3a',
|
||||
'header_link_color' => '#3a3a3a',
|
||||
'navigation_background_color' => '#222222',
|
||||
'navigation_text_color' => '#ffffff',
|
||||
'navigation_background_hover_color' => '#3f3f3f',
|
||||
'navigation_text_hover_color' => '#ffffff',
|
||||
'navigation_background_current_color' => '#3f3f3f',
|
||||
'navigation_text_current_color' => '#ffffff',
|
||||
'subnavigation_background_color' => '#3f3f3f',
|
||||
'subnavigation_text_color' => '#ffffff',
|
||||
'subnavigation_background_hover_color' => '#4f4f4f',
|
||||
'subnavigation_text_hover_color' => '#ffffff',
|
||||
'subnavigation_background_current_color' => '#4f4f4f',
|
||||
'subnavigation_text_current_color' => '#ffffff',
|
||||
'sidebar_widget_title_color' => '#000000',
|
||||
'site_title_font_size' => '45',
|
||||
'mobile_site_title_font_size' => '30',
|
||||
'form_button_background_color' => '#666666',
|
||||
'form_button_background_color_hover' => '#3f3f3f',
|
||||
'footer_background_color' => '#222222',
|
||||
'footer_link_hover_color' => '#606060',
|
||||
'entry_meta_link_color' => '#595959',
|
||||
'entry_meta_link_color_hover' => '#1e73be',
|
||||
'blog_post_title_color' => '',
|
||||
'blog_post_title_hover_color' => '',
|
||||
'heading_1_font_size' => '40',
|
||||
'mobile_heading_1_font_size' => '30',
|
||||
'heading_1_weight' => '300',
|
||||
'heading_2_font_size' => '30',
|
||||
'mobile_heading_2_font_size' => '25',
|
||||
'heading_2_weight' => '300',
|
||||
'heading_3_font_size' => '20',
|
||||
'mobile_heading_3_font_size' => '',
|
||||
'heading_4_font_size' => '',
|
||||
'mobile_heading_4_font_size' => '',
|
||||
'heading_5_font_size' => '',
|
||||
'mobile_heading_5_font_size' => '',
|
||||
);
|
||||
|
||||
foreach ( $old_defaults as $key => $value ) {
|
||||
if ( ! isset( $settings[ $key ] ) ) {
|
||||
$settings[ $key ] = $value;
|
||||
$update_options = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $update_options ) {
|
||||
update_option( 'generate_settings', $settings );
|
||||
}
|
||||
|
||||
$spacing_settings = get_option( 'generate_spacing_settings', array() );
|
||||
$update_spacing_options = false;
|
||||
|
||||
$old_spacing_defaults = array(
|
||||
'left_sidebar_width' => '25',
|
||||
'right_sidebar_width' => '25',
|
||||
'top_bar_right' => '10',
|
||||
'top_bar_left' => '10',
|
||||
'mobile_top_bar_right' => '',
|
||||
'mobile_top_bar_left' => '',
|
||||
'header_top' => '40',
|
||||
'header_bottom' => '40',
|
||||
'mobile_header_right' => '',
|
||||
'mobile_header_left' => '',
|
||||
'mobile_widget_top' => '',
|
||||
'mobile_widget_right' => '',
|
||||
'mobile_widget_bottom' => '',
|
||||
'mobile_widget_left' => '',
|
||||
'mobile_footer_widget_container_top' => '',
|
||||
'mobile_footer_widget_container_right' => '',
|
||||
'mobile_footer_widget_container_bottom' => '',
|
||||
'mobile_footer_widget_container_left' => '',
|
||||
'footer_right' => '20',
|
||||
'footer_left' => '20',
|
||||
'mobile_footer_right' => '10',
|
||||
'mobile_footer_left' => '10',
|
||||
);
|
||||
|
||||
foreach ( $old_spacing_defaults as $key => $value ) {
|
||||
if ( ! isset( $spacing_settings[ $key ] ) ) {
|
||||
$spacing_settings[ $key ] = $value;
|
||||
$update_spacing_options = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $update_spacing_options ) {
|
||||
update_option( 'generate_spacing_settings', $spacing_settings );
|
||||
}
|
||||
|
||||
if ( $update_options || $update_spacing_options ) {
|
||||
delete_option( 'generate_dynamic_css_output' );
|
||||
delete_option( 'generate_dynamic_css_cached_version' );
|
||||
|
||||
// Reset our dynamic CSS file updated time so it regenerates.
|
||||
$dynamic_css_data = get_option( 'generatepress_dynamic_css_data', array() );
|
||||
|
||||
if ( ! empty( $dynamic_css_data ) ) {
|
||||
if ( isset( $dynamic_css_data['updated_time'] ) ) {
|
||||
unset( $dynamic_css_data['updated_time'] );
|
||||
}
|
||||
|
||||
update_option( 'generatepress_dynamic_css_data', $dynamic_css_data );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePress_Theme_Update::get_instance();
|
File diff suppressed because it is too large
Load Diff
@ -56,20 +56,28 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
}
|
||||
|
||||
if ( isset( $wp_customize->selective_refresh ) ) {
|
||||
$wp_customize->selective_refresh->add_partial( 'blogname', array(
|
||||
'selector' => '.main-title a',
|
||||
'render_callback' => 'generate_customize_partial_blogname',
|
||||
) );
|
||||
$wp_customize->selective_refresh->add_partial(
|
||||
'blogname',
|
||||
array(
|
||||
'selector' => '.main-title a',
|
||||
'render_callback' => 'generate_customize_partial_blogname',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
|
||||
'selector' => '.site-description',
|
||||
'render_callback' => 'generate_customize_partial_blogdescription',
|
||||
) );
|
||||
$wp_customize->selective_refresh->add_partial(
|
||||
'blogdescription',
|
||||
array(
|
||||
'selector' => '.site-description',
|
||||
'render_callback' => 'generate_customize_partial_blogdescription',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! defined( 'GP_PREMIUM_VERSION' ) ) {
|
||||
$wp_customize->add_section(
|
||||
new GeneratePress_Upsell_Section( $wp_customize, 'generatepress_upsell_section',
|
||||
new GeneratePress_Upsell_Section(
|
||||
$wp_customize,
|
||||
'generatepress_upsell_section',
|
||||
array(
|
||||
'pro_text' => __( 'Premium Modules Available', 'generatepress' ),
|
||||
'pro_url' => generate_get_premium_url( 'https://generatepress.com/premium' ),
|
||||
@ -186,8 +194,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
),
|
||||
'choices' => array(
|
||||
'desktop' => array(
|
||||
'min' => 30,
|
||||
'max' => 800,
|
||||
'min' => 20,
|
||||
'max' => 1200,
|
||||
'step' => 10,
|
||||
'edit' => true,
|
||||
'unit' => 'px',
|
||||
@ -213,7 +221,7 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
'type' => 'checkbox',
|
||||
'label' => esc_html__( 'Place logo next to title', 'generatepress' ),
|
||||
'section' => 'title_tagline',
|
||||
'active_callback' => 'generate_has_logo_site_branding',
|
||||
'active_callback' => 'generate_show_inline_logo_callback',
|
||||
)
|
||||
);
|
||||
|
||||
@ -228,7 +236,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[background_color]', array(
|
||||
'generate_settings[background_color]',
|
||||
array(
|
||||
'default' => $defaults['background_color'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
@ -249,7 +258,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[text_color]', array(
|
||||
'generate_settings[text_color]',
|
||||
array(
|
||||
'default' => $defaults['text_color'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
@ -270,7 +280,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[link_color]', array(
|
||||
'generate_settings[link_color]',
|
||||
array(
|
||||
'default' => $defaults['link_color'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
@ -291,7 +302,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[link_color_hover]', array(
|
||||
'generate_settings[link_color_hover]',
|
||||
array(
|
||||
'default' => $defaults['link_color_hover'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
@ -311,32 +323,36 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[link_color_visited]', array(
|
||||
'default' => $defaults['link_color_visited'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'refresh',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
if ( '' !== generate_get_option( 'link_color_visited' ) ) {
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[link_color_visited]',
|
||||
array(
|
||||
'label' => __( 'Link Color Visited', 'generatepress' ),
|
||||
'section' => 'body_section',
|
||||
'settings' => 'generate_settings[link_color_visited]',
|
||||
'default' => $defaults['link_color_visited'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
'transport' => 'refresh',
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new WP_Customize_Color_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[link_color_visited]',
|
||||
array(
|
||||
'label' => __( 'Link Color Visited', 'generatepress' ),
|
||||
'section' => 'body_section',
|
||||
'settings' => 'generate_settings[link_color_visited]',
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$color_defaults = generate_get_color_defaults();
|
||||
|
||||
if ( ! $wp_customize->get_setting( 'generate_settings[blog_post_title_color]' ) ) {
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[blog_post_title_color]', array(
|
||||
'generate_settings[blog_post_title_color]',
|
||||
array(
|
||||
'default' => $color_defaults['blog_post_title_color'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
@ -357,7 +373,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[blog_post_title_hover_color]', array(
|
||||
'generate_settings[blog_post_title_hover_color]',
|
||||
array(
|
||||
'default' => $color_defaults['blog_post_title_hover_color'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
@ -398,7 +415,7 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
'choices' => array(
|
||||
'current' => __( 'Current', 'generatepress' ),
|
||||
'default' => __( 'Default', 'generatepress' ),
|
||||
'white' => __( 'White', 'generatepress' ),
|
||||
'classic' => __( 'Classic', 'generatepress' ),
|
||||
'grey' => __( 'Grey', 'generatepress' ),
|
||||
'red' => __( 'Red', 'generatepress' ),
|
||||
'green' => __( 'Green', 'generatepress' ),
|
||||
@ -410,7 +427,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
|
||||
if ( ! $wp_customize->get_setting( 'generate_settings[navigation_background_color]' ) ) {
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[navigation_background_color]', array(
|
||||
'generate_settings[navigation_background_color]',
|
||||
array(
|
||||
'default' => $color_defaults['navigation_background_color'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_sanitize_rgba_color',
|
||||
@ -419,7 +437,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[navigation_text_color]', array(
|
||||
'generate_settings[navigation_text_color]',
|
||||
array(
|
||||
'default' => $color_defaults['navigation_text_color'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
@ -478,7 +497,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[subnavigation_text_color]', array(
|
||||
'generate_settings[subnavigation_text_color]',
|
||||
array(
|
||||
'default' => $color_defaults['subnavigation_text_color'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
@ -497,7 +517,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[subnavigation_text_hover_color]', array(
|
||||
'generate_settings[subnavigation_text_hover_color]',
|
||||
array(
|
||||
'default' => $color_defaults['subnavigation_text_hover_color'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
@ -516,7 +537,8 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[subnavigation_text_current_color]', array(
|
||||
'generate_settings[subnavigation_text_current_color]',
|
||||
array(
|
||||
'default' => $color_defaults['subnavigation_text_current_color'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_sanitize_hex_color',
|
||||
@ -545,10 +567,13 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
|
||||
if ( class_exists( 'WP_Customize_Panel' ) ) {
|
||||
if ( ! $wp_customize->get_panel( 'generate_layout_panel' ) ) {
|
||||
$wp_customize->add_panel( 'generate_layout_panel', array(
|
||||
'priority' => 25,
|
||||
'title' => __( 'Layout', 'generatepress' ),
|
||||
) );
|
||||
$wp_customize->add_panel(
|
||||
'generate_layout_panel',
|
||||
array(
|
||||
'priority' => 25,
|
||||
'title' => __( 'Layout', 'generatepress' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -696,32 +721,76 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
$wp_customize->add_setting(
|
||||
'generate_header_helper',
|
||||
array(
|
||||
'default' => 'current',
|
||||
'type' => 'option',
|
||||
'default' => 'current',
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_sanitize_preset_layout',
|
||||
'transport' => 'postMessage',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'generate_header_helper',
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => __( 'Header Presets', 'generatepress' ),
|
||||
'section' => 'generate_layout_header',
|
||||
'choices' => array(
|
||||
'current' => __( 'Current', 'generatepress' ),
|
||||
'default' => __( 'Default', 'generatepress' ),
|
||||
'nav-before-centered' => __( 'Navigation Before - Centered', 'generatepress' ),
|
||||
'nav-after-centered' => __( 'Navigation After - Centered', 'generatepress' ),
|
||||
'nav-right' => __( 'Navigation Right', 'generatepress' ),
|
||||
'nav-left' => __( 'Navigation Left', 'generatepress' ),
|
||||
'type' => 'select',
|
||||
'label' => __( 'Header Presets', 'generatepress' ),
|
||||
'section' => 'generate_layout_header',
|
||||
'choices' => array(
|
||||
'current' => __( 'Current', 'generatepress' ),
|
||||
'default' => __( 'Default', 'generatepress' ),
|
||||
'classic' => __( 'Classic', 'generatepress' ),
|
||||
'nav-before' => __( 'Navigation Before', 'generatepress' ),
|
||||
'nav-after' => __( 'Navigation After', 'generatepress' ),
|
||||
'nav-before-centered' => __( 'Navigation Before - Centered', 'generatepress' ),
|
||||
'nav-after-centered' => __( 'Navigation After - Centered', 'generatepress' ),
|
||||
'nav-left' => __( 'Navigation Left', 'generatepress' ),
|
||||
),
|
||||
'settings' => 'generate_header_helper',
|
||||
'priority' => 4,
|
||||
'settings' => 'generate_header_helper',
|
||||
'priority' => 4,
|
||||
)
|
||||
);
|
||||
|
||||
if ( ! $wp_customize->get_setting( 'generate_settings[site_title_font_size]' ) ) {
|
||||
$typography_defaults = generate_get_default_fonts();
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[site_title_font_size]',
|
||||
array(
|
||||
'default' => $typography_defaults['site_title_font_size'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! $wp_customize->get_setting( 'generate_spacing_settings[header_top]' ) ) {
|
||||
$spacing_defaults = generate_spacing_get_defaults();
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[header_top]',
|
||||
array(
|
||||
'default' => $spacing_defaults['header_top'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! $wp_customize->get_setting( 'generate_spacing_settings[header_bottom]' ) ) {
|
||||
$spacing_defaults = generate_spacing_get_defaults();
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[header_bottom]',
|
||||
array(
|
||||
'default' => $spacing_defaults['header_bottom'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[header_layout_setting]',
|
||||
array(
|
||||
@ -889,7 +958,7 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
'default' => $defaults['nav_position_setting'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_sanitize_choices',
|
||||
'transport' => ( '' !== generate_get_option( 'nav_position_setting' ) ) ? 'postMessage' : 'refresh',
|
||||
'transport' => 'refresh',
|
||||
)
|
||||
);
|
||||
|
||||
@ -1026,7 +1095,6 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
'default' => $defaults['content_layout_setting'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_sanitize_choices',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
@ -1266,9 +1334,9 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
'label' => __( 'Footer Bar Alignment', 'generatepress' ),
|
||||
'section' => 'generate_layout_footer',
|
||||
'choices' => array(
|
||||
'left' => __( 'Left','generatepress' ),
|
||||
'center' => __( 'Center','generatepress' ),
|
||||
'right' => __( 'Right','generatepress' ),
|
||||
'left' => __( 'Left', 'generatepress' ),
|
||||
'center' => __( 'Center', 'generatepress' ),
|
||||
'right' => __( 'Right', 'generatepress' ),
|
||||
),
|
||||
'settings' => 'generate_settings[footer_bar_alignment]',
|
||||
'priority' => 47,
|
||||
@ -1325,7 +1393,7 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
'label' => __( 'Content Type', 'generatepress' ),
|
||||
'section' => 'generate_blog_section',
|
||||
'choices' => array(
|
||||
'full' => __( 'Full', 'generatepress' ),
|
||||
'full' => __( 'Full Content', 'generatepress' ),
|
||||
'excerpt' => __( 'Excerpt', 'generatepress' ),
|
||||
),
|
||||
'settings' => 'generate_settings[post_content]',
|
||||
@ -1381,6 +1449,52 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
);
|
||||
}
|
||||
|
||||
$show_flexbox_option = true;
|
||||
|
||||
if ( defined( 'GP_PREMIUM_VERSION' ) && version_compare( GP_PREMIUM_VERSION, '1.11.0-alpha.1', '<' ) ) {
|
||||
$show_flexbox_option = false;
|
||||
}
|
||||
|
||||
if ( generate_is_using_flexbox() ) {
|
||||
$show_flexbox_option = true;
|
||||
}
|
||||
|
||||
$show_flexbox_option = apply_filters( 'generate_show_flexbox_customizer_option', $show_flexbox_option );
|
||||
|
||||
if ( $show_flexbox_option ) {
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[structure]',
|
||||
array(
|
||||
'default' => $defaults['structure'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'generate_sanitize_choices',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'generate_settings[structure]',
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => __( 'Structure', 'generatepress' ),
|
||||
'section' => 'generate_general_section',
|
||||
'choices' => array(
|
||||
'flexbox' => __( 'Flexbox', 'generatepress' ),
|
||||
'floats' => __( 'Floats', 'generatepress' ),
|
||||
),
|
||||
'description' => sprintf(
|
||||
'<strong>%1$s</strong> %2$s',
|
||||
__( 'Caution:', 'generatepress' ),
|
||||
sprintf(
|
||||
/* translators: Learn more here */
|
||||
__( 'Switching your structure can change how your website displays. Review your website thoroughly before publishing this change, or use a staging site to review the potential changes. Learn more %s.', 'generatepress' ),
|
||||
'<a href="https://docs.generatepress.com/article/switching-from-floats-to-flexbox/" target="_blank" rel="noopener noreferrer">' . __( 'here', 'generatepress' ) . '</a>'
|
||||
)
|
||||
),
|
||||
'settings' => 'generate_settings[structure]',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_settings[icons]',
|
||||
array(
|
||||
@ -1420,6 +1534,7 @@ if ( ! function_exists( 'generate_customize_register' ) ) {
|
||||
'label' => __( 'Combine CSS', 'generatepress' ),
|
||||
'description' => __( 'Reduce the number of CSS file requests and use a lite version of our grid system.', 'generatepress' ),
|
||||
'section' => 'generate_general_section',
|
||||
'active_callback' => 'generate_is_using_floats_callback',
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -12,9 +12,13 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Customize_Width_Slider_Control' ) ) {
|
||||
/**
|
||||
* Create our container width slider control
|
||||
*
|
||||
* @deprecated 1.3.47
|
||||
*/
|
||||
class Generate_Customize_Width_Slider_Control extends WP_Customize_Control {
|
||||
/**
|
||||
* Render content.
|
||||
*/
|
||||
public function render_content() {}
|
||||
}
|
||||
}
|
||||
@ -22,10 +26,14 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Customi
|
||||
if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'GenerateLabelControl' ) ) {
|
||||
/**
|
||||
* Heading area
|
||||
*
|
||||
* @since 0.1
|
||||
* @depreceted 1.3.41
|
||||
**/
|
||||
class GenerateLabelControl extends WP_Customize_Control {
|
||||
class GenerateLabelControl extends WP_Customize_Control { // phpcs:ignore
|
||||
/**
|
||||
* Render content.
|
||||
*/
|
||||
public function render_content() {}
|
||||
}
|
||||
}
|
||||
@ -34,14 +42,25 @@ if ( ! class_exists( 'Generate_Google_Font_Dropdown_Custom_Control' ) ) {
|
||||
/**
|
||||
* A class to create a dropdown for all google fonts
|
||||
*/
|
||||
class Generate_Google_Font_Dropdown_Custom_Control extends WP_Customize_Control {
|
||||
class Generate_Google_Font_Dropdown_Custom_Control extends WP_Customize_Control { // phpcs:ignore
|
||||
/**
|
||||
* Set type.
|
||||
*
|
||||
* @var $type
|
||||
*/
|
||||
public $type = 'gp-customizer-fonts';
|
||||
|
||||
/**
|
||||
* Enqueue scripts.
|
||||
*/
|
||||
public function enqueue() {
|
||||
wp_enqueue_script( 'generatepress-customizer-fonts', trailingslashit( get_template_directory_uri() ) . 'inc/js/typography-controls.js', array( 'customize-controls' ), GENERATE_VERSION, true );
|
||||
wp_localize_script( 'generatepress-customizer-fonts', 'gp_customize', array( 'nonce' => wp_create_nonce( 'gp_customize_nonce' ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Send variables to json.
|
||||
*/
|
||||
public function to_json() {
|
||||
parent::to_json();
|
||||
|
||||
@ -50,11 +69,14 @@ if ( ! class_exists( 'Generate_Google_Font_Dropdown_Custom_Control' ) ) {
|
||||
$this->json['value'] = $this->value();
|
||||
$this->json['default_fonts_title'] = __( 'Default fonts', 'generatepress' );
|
||||
$this->json['google_fonts_title'] = __( 'Google fonts', 'generatepress' );
|
||||
$this->json['description'] = __( 'Font family','generatepress' );
|
||||
$this->json['description'] = __( 'Font family', 'generatepress' );
|
||||
$this->json['google_fonts'] = apply_filters( 'generate_typography_customize_list', generate_get_all_google_fonts( $number_of_fonts ) );
|
||||
$this->json['default_fonts'] = generate_typography_default_fonts();
|
||||
}
|
||||
|
||||
/**
|
||||
* Render content.
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<label>
|
||||
@ -83,10 +105,24 @@ if ( ! class_exists( 'Generate_Select_Control' ) ) {
|
||||
/**
|
||||
* A class to create a dropdown for font weight
|
||||
*/
|
||||
class Generate_Select_Control extends WP_Customize_Control {
|
||||
class Generate_Select_Control extends WP_Customize_Control { // phpcs:ignore
|
||||
/**
|
||||
* Set type.
|
||||
*
|
||||
* @var $type
|
||||
*/
|
||||
public $type = 'gp-typography-select';
|
||||
|
||||
/**
|
||||
* Set choices.
|
||||
*
|
||||
* @var $choices
|
||||
*/
|
||||
public $choices = array();
|
||||
|
||||
/**
|
||||
* Send variables to json.
|
||||
*/
|
||||
public function to_json() {
|
||||
parent::to_json();
|
||||
|
||||
@ -100,6 +136,9 @@ if ( ! class_exists( 'Generate_Select_Control' ) ) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Render content.
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<# if ( ! data.choices )
|
||||
@ -122,13 +161,26 @@ if ( ! class_exists( 'Generate_Select_Control' ) ) {
|
||||
|
||||
if ( ! class_exists( 'Generate_Hidden_Input_Control' ) ) {
|
||||
/**
|
||||
* Create our hidden input control
|
||||
* Create our hidden input control
|
||||
*/
|
||||
class Generate_Hidden_Input_Control extends WP_Customize_Control {
|
||||
// Setup control type
|
||||
class Generate_Hidden_Input_Control extends WP_Customize_Control { // phpcs:ignore
|
||||
/**
|
||||
* Set type.
|
||||
*
|
||||
* @var $type
|
||||
*/
|
||||
public $type = 'gp-hidden-input';
|
||||
|
||||
/**
|
||||
* Set ID
|
||||
*
|
||||
* @var $id
|
||||
*/
|
||||
public $id = '';
|
||||
|
||||
/**
|
||||
* Send variables to json.
|
||||
*/
|
||||
public function to_json() {
|
||||
parent::to_json();
|
||||
$this->json['link'] = $this->get_link();
|
||||
@ -136,6 +188,9 @@ if ( ! class_exists( 'Generate_Hidden_Input_Control' ) ) {
|
||||
$this->json['id'] = $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render content.
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<input name="{{ data.id }}" type="text" {{{ data.link }}} value="{{{ data.value }}}" class="gp-hidden-input" />
|
||||
@ -147,84 +202,102 @@ if ( ! class_exists( 'Generate_Hidden_Input_Control' ) ) {
|
||||
if ( ! class_exists( 'Generate_Font_Weight_Custom_Control' ) ) {
|
||||
/**
|
||||
* A class to create a dropdown for font weight
|
||||
*
|
||||
* @deprecated since 1.3.40
|
||||
*/
|
||||
class Generate_Font_Weight_Custom_Control extends WP_Customize_Control {
|
||||
|
||||
public function __construct( $manager, $id, $args = array(), $options = array() ) {
|
||||
parent::__construct( $manager, $id, $args );
|
||||
}
|
||||
class Generate_Font_Weight_Custom_Control extends WP_Customize_Control { // phpcs:ignore
|
||||
|
||||
/**
|
||||
* Render the content of the category dropdown
|
||||
* Construct.
|
||||
*
|
||||
* @return HTML
|
||||
* @param object $manager The manager.
|
||||
* @param int $id The ID.
|
||||
* @param array $args The args.
|
||||
* @param array $options The options.
|
||||
*/
|
||||
public function render_content() {
|
||||
?>
|
||||
<label>
|
||||
<select <?php $this->link(); ?>>
|
||||
<?php
|
||||
printf('<option value="%s" %s>%s</option>', 'normal', selected($this->value(), 'normal', false), 'normal');
|
||||
printf('<option value="%s" %s>%s</option>', 'bold', selected($this->value(), 'bold', false), 'bold');
|
||||
printf('<option value="%s" %s>%s</option>', '100', selected($this->value(), '100', false), '100');
|
||||
printf('<option value="%s" %s>%s</option>', '200', selected($this->value(), '200', false), '200');
|
||||
printf('<option value="%s" %s>%s</option>', '300', selected($this->value(), '300', false), '300');
|
||||
printf('<option value="%s" %s>%s</option>', '400', selected($this->value(), '400', false), '400');
|
||||
printf('<option value="%s" %s>%s</option>', '500', selected($this->value(), '500', false), '500');
|
||||
printf('<option value="%s" %s>%s</option>', '600', selected($this->value(), '600', false), '600');
|
||||
printf('<option value="%s" %s>%s</option>', '700', selected($this->value(), '700', false), '700');
|
||||
printf('<option value="%s" %s>%s</option>', '800', selected($this->value(), '800', false), '800');
|
||||
printf('<option value="%s" %s>%s</option>', '900', selected($this->value(), '900', false), '900');
|
||||
?>
|
||||
</select>
|
||||
<p class="description"><?php echo esc_html( $this->label ); ?></p>
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Generate_Text_Transform_Custom_Control' ) ) {
|
||||
/**
|
||||
* A class to create a dropdown for text-transform
|
||||
* @deprecated since 1.3.40
|
||||
*/
|
||||
class Generate_Text_Transform_Custom_Control extends WP_Customize_Control {
|
||||
|
||||
public function __construct( $manager, $id, $args = array(), $options = array() ) {
|
||||
parent::__construct( $manager, $id, $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the content of the category dropdown
|
||||
*
|
||||
* @return HTML
|
||||
*/
|
||||
public function render_content() {
|
||||
?>
|
||||
<label>
|
||||
<select <?php $this->link(); ?>>
|
||||
<?php
|
||||
printf('<option value="%s" %s>%s</option>', 'none', selected($this->value(), 'none', false), 'none');
|
||||
printf('<option value="%s" %s>%s</option>', 'capitalize', selected($this->value(), 'capitalize', false), 'capitalize');
|
||||
printf('<option value="%s" %s>%s</option>', 'uppercase', selected($this->value(), 'uppercase', false), 'uppercase');
|
||||
printf('<option value="%s" %s>%s</option>', 'lowercase', selected($this->value(), 'lowercase', false), 'lowercase');
|
||||
?>
|
||||
</select>
|
||||
<p class="description"><?php echo esc_html( $this->label ); ?></p>
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
public function render_content() {
|
||||
?>
|
||||
<label>
|
||||
<select <?php $this->link(); ?>>
|
||||
<?php
|
||||
printf( '<option value="%s" %s>%s</option>', 'normal', selected( $this->value(), 'normal', false ), 'normal' );
|
||||
printf( '<option value="%s" %s>%s</option>', 'bold', selected( $this->value(), 'bold', false ), 'bold' );
|
||||
printf( '<option value="%s" %s>%s</option>', '100', selected( $this->value(), '100', false ), '100' );
|
||||
printf( '<option value="%s" %s>%s</option>', '200', selected( $this->value(), '200', false ), '200' );
|
||||
printf( '<option value="%s" %s>%s</option>', '300', selected( $this->value(), '300', false ), '300' );
|
||||
printf( '<option value="%s" %s>%s</option>', '400', selected( $this->value(), '400', false ), '400' );
|
||||
printf( '<option value="%s" %s>%s</option>', '500', selected( $this->value(), '500', false ), '500' );
|
||||
printf( '<option value="%s" %s>%s</option>', '600', selected( $this->value(), '600', false ), '600' );
|
||||
printf( '<option value="%s" %s>%s</option>', '700', selected( $this->value(), '700', false ), '700' );
|
||||
printf( '<option value="%s" %s>%s</option>', '800', selected( $this->value(), '800', false ), '800' );
|
||||
printf( '<option value="%s" %s>%s</option>', '900', selected( $this->value(), '900', false ), '900' );
|
||||
?>
|
||||
</select>
|
||||
<p class="description"><?php echo esc_html( $this->label ); ?></p>
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Generate_Text_Transform_Custom_Control' ) ) {
|
||||
/**
|
||||
* A class to create a dropdown for text-transform
|
||||
*
|
||||
* @deprecated since 1.3.40
|
||||
*/
|
||||
class Generate_Text_Transform_Custom_Control extends WP_Customize_Control { // phpcs:ignore
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
* @param object $manager The manager.
|
||||
* @param int $id The ID.
|
||||
* @param array $args The args.
|
||||
* @param array $options The options.
|
||||
*/
|
||||
public function __construct( $manager, $id, $args = array(), $options = array() ) {
|
||||
parent::__construct( $manager, $id, $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the content of the category dropdown
|
||||
*/
|
||||
public function render_content() {
|
||||
?>
|
||||
<label>
|
||||
<select <?php $this->link(); ?>>
|
||||
<?php
|
||||
printf( '<option value="%s" %s>%s</option>', 'none', selected( $this->value(), 'none', false ), 'none' );
|
||||
printf( '<option value="%s" %s>%s</option>', 'capitalize', selected( $this->value(), 'capitalize', false ), 'capitalize' );
|
||||
printf( '<option value="%s" %s>%s</option>', 'uppercase', selected( $this->value(), 'uppercase', false ), 'uppercase' );
|
||||
printf( '<option value="%s" %s>%s</option>', 'lowercase', selected( $this->value(), 'lowercase', false ), 'lowercase' );
|
||||
?>
|
||||
</select>
|
||||
<p class="description"><?php echo esc_html( $this->label ); ?></p>
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Generate_Customize_Slider_Control' ) ) {
|
||||
/**
|
||||
* Create our container width slider control
|
||||
*
|
||||
* @deprecated 1.3.47
|
||||
*/
|
||||
class Generate_Customize_Slider_Control extends WP_Customize_Control {
|
||||
class Generate_Customize_Slider_Control extends WP_Customize_Control { // phpcs:ignore
|
||||
/**
|
||||
* Render content.
|
||||
*/
|
||||
public function render_content() {}
|
||||
}
|
||||
}
|
||||
|
@ -25,9 +25,22 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Range_S
|
||||
*/
|
||||
public $type = 'generatepress-range-slider';
|
||||
|
||||
/**
|
||||
* The control description.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $description = '';
|
||||
|
||||
/**
|
||||
* The control sub-description.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $sub_description = '';
|
||||
|
||||
/**
|
||||
* Refresh the parameters passed to the JavaScript via JSON.
|
||||
*
|
||||
@ -36,7 +49,7 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Range_S
|
||||
public function to_json() {
|
||||
parent::to_json();
|
||||
|
||||
$devices = array( 'desktop','tablet','mobile' );
|
||||
$devices = array( 'desktop', 'tablet', 'mobile' );
|
||||
foreach ( $devices as $device ) {
|
||||
$this->json['choices'][ $device ]['min'] = ( isset( $this->choices[ $device ]['min'] ) ) ? $this->choices[ $device ]['min'] : '0';
|
||||
$this->json['choices'][ $device ]['max'] = ( isset( $this->choices[ $device ]['max'] ) ) ? $this->choices[ $device ]['max'] : '100';
|
||||
@ -53,10 +66,10 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Range_S
|
||||
);
|
||||
}
|
||||
|
||||
$this->json['desktop_label'] = __( 'Desktop','generatepress' );
|
||||
$this->json['tablet_label'] = __( 'Tablet','generatepress' );
|
||||
$this->json['mobile_label'] = __( 'Mobile','generatepress' );
|
||||
$this->json['reset_label'] = __( 'Reset','generatepress' );
|
||||
$this->json['desktop_label'] = __( 'Desktop', 'generatepress' );
|
||||
$this->json['tablet_label'] = __( 'Tablet', 'generatepress' );
|
||||
$this->json['mobile_label'] = __( 'Mobile', 'generatepress' );
|
||||
$this->json['reset_label'] = __( 'Reset', 'generatepress' );
|
||||
|
||||
$this->json['description'] = $this->description;
|
||||
$this->json['sub_description'] = $this->sub_description;
|
||||
@ -68,8 +81,24 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Range_S
|
||||
* @access public
|
||||
*/
|
||||
public function enqueue() {
|
||||
wp_enqueue_script( 'generatepress-range-slider', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/slider-control.js', array( 'jquery', 'customize-base', 'jquery-ui-slider' ), false, true );
|
||||
wp_enqueue_style( 'generatepress-range-slider-css', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/slider-customizer.css', null );
|
||||
wp_enqueue_script(
|
||||
'generatepress-range-slider',
|
||||
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/slider-control.js',
|
||||
array(
|
||||
'jquery',
|
||||
'customize-base',
|
||||
'jquery-ui-slider',
|
||||
),
|
||||
GENERATE_VERSION,
|
||||
true
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'generatepress-range-slider-css',
|
||||
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/slider-customizer.css',
|
||||
array(),
|
||||
GENERATE_VERSION
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,16 +16,57 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Typogra
|
||||
* @since 2.0
|
||||
*/
|
||||
class Generate_Typography_Customize_Control extends WP_Customize_Control {
|
||||
/**
|
||||
* Set the type.
|
||||
*
|
||||
* @var string $type
|
||||
*/
|
||||
public $type = 'gp-customizer-typography';
|
||||
|
||||
/**
|
||||
* Enqueue scripts.
|
||||
*/
|
||||
public function enqueue() {
|
||||
wp_enqueue_script( 'generatepress-typography-selectWoo', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/selectWoo.min.js', array( 'customize-controls', 'jquery' ), GENERATE_VERSION, true );
|
||||
wp_enqueue_style( 'generatepress-typography-selectWoo', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/selectWoo.min.css', array(), GENERATE_VERSION );
|
||||
wp_enqueue_script(
|
||||
'generatepress-typography-selectWoo',
|
||||
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/selectWoo.min.js',
|
||||
array(
|
||||
'customize-controls',
|
||||
'jquery',
|
||||
),
|
||||
GENERATE_VERSION,
|
||||
true
|
||||
);
|
||||
|
||||
wp_enqueue_script( 'generatepress-typography-customizer', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/typography-customizer.js', array( 'customize-controls', 'generatepress-typography-selectWoo' ), GENERATE_VERSION, true );
|
||||
wp_enqueue_style( 'generatepress-typography-customizer', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/typography-customizer.css', array(), GENERATE_VERSION );
|
||||
wp_enqueue_style(
|
||||
'generatepress-typography-selectWoo',
|
||||
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/selectWoo.min.css',
|
||||
array(),
|
||||
GENERATE_VERSION
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'generatepress-typography-customizer',
|
||||
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/typography-customizer.js',
|
||||
array(
|
||||
'customize-controls',
|
||||
'generatepress-typography-selectWoo',
|
||||
),
|
||||
GENERATE_VERSION,
|
||||
true
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'generatepress-typography-customizer',
|
||||
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/typography-customizer.css',
|
||||
array(),
|
||||
GENERATE_VERSION
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send variables to json.
|
||||
*/
|
||||
public function to_json() {
|
||||
parent::to_json();
|
||||
|
||||
@ -43,7 +84,7 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Typogra
|
||||
'link' => $this->get_link( $setting_key ),
|
||||
'value' => $this->value( $setting_key ),
|
||||
'default' => isset( $setting_id->default ) ? $setting_id->default : '',
|
||||
'id' => isset( $setting_id->id ) ? $setting_id->id : ''
|
||||
'id' => isset( $setting_id->id ) ? $setting_id->id : '',
|
||||
);
|
||||
|
||||
if ( 'weight' === $setting_key ) {
|
||||
@ -56,6 +97,9 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Typogra
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render content.
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<# if ( '' !== data.label ) { #>
|
||||
@ -165,6 +209,9 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Typogra
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Build font weight choices.
|
||||
*/
|
||||
public function get_font_weight_choices() {
|
||||
return array(
|
||||
'normal' => esc_html( 'normal' ),
|
||||
@ -181,6 +228,9 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Typogra
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build text transform choices.
|
||||
*/
|
||||
public function get_font_transform_choices() {
|
||||
return array(
|
||||
'none' => esc_html( 'none' ),
|
||||
|
@ -17,20 +17,57 @@ if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Customi
|
||||
* @since 0.1
|
||||
*/
|
||||
class Generate_Customize_Misc_Control extends WP_Customize_Control {
|
||||
/**
|
||||
* Set description.
|
||||
*
|
||||
* @var public $description
|
||||
*/
|
||||
public $description = '';
|
||||
|
||||
/**
|
||||
* Set URL.
|
||||
*
|
||||
* @var public $url
|
||||
*/
|
||||
public $url = '';
|
||||
|
||||
/**
|
||||
* Set type.
|
||||
*
|
||||
* @var public $type
|
||||
*/
|
||||
public $type = 'addon';
|
||||
|
||||
/**
|
||||
* Set label.
|
||||
*
|
||||
* @var public $label
|
||||
*/
|
||||
public $label = '';
|
||||
|
||||
/**
|
||||
* Enqueue scripts.
|
||||
*/
|
||||
public function enqueue() {
|
||||
wp_enqueue_style( 'generate-customizer-controls-css', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/upsell-customizer.css', array(), GENERATE_VERSION );
|
||||
wp_enqueue_style(
|
||||
'generate-customizer-controls-css',
|
||||
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/upsell-customizer.css',
|
||||
array(),
|
||||
GENERATE_VERSION
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send variables to json.
|
||||
*/
|
||||
public function to_json() {
|
||||
parent::to_json();
|
||||
$this->json['url'] = esc_url( $this->url );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render content.
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<p class="description" style="margin-top: 5px;">{{{ data.description }}}</p>
|
||||
|
@ -17,11 +17,37 @@ if ( class_exists( 'WP_Customize_Section' ) && ! class_exists( 'GeneratePress_Up
|
||||
* @since unknown
|
||||
*/
|
||||
class GeneratePress_Upsell_Section extends WP_Customize_Section {
|
||||
/**
|
||||
* Set type.
|
||||
*
|
||||
* @var public $type
|
||||
*/
|
||||
public $type = 'gp-upsell-section';
|
||||
|
||||
/**
|
||||
* Set pro URL.
|
||||
*
|
||||
* @var public $pro_url
|
||||
*/
|
||||
public $pro_url = '';
|
||||
|
||||
/**
|
||||
* Set pro text.
|
||||
*
|
||||
* @var public $pro_text
|
||||
*/
|
||||
public $pro_text = '';
|
||||
|
||||
/**
|
||||
* Set ID.
|
||||
*
|
||||
* @var public $id
|
||||
*/
|
||||
public $id = '';
|
||||
|
||||
/**
|
||||
* Send variables to json.
|
||||
*/
|
||||
public function json() {
|
||||
$json = parent::json();
|
||||
$json['pro_text'] = $this->pro_text;
|
||||
@ -30,6 +56,9 @@ if ( class_exists( 'WP_Customize_Section' ) && ! class_exists( 'GeneratePress_Up
|
||||
return $json;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render content.
|
||||
*/
|
||||
protected function render_template() {
|
||||
?>
|
||||
<li id="accordion-section-{{ data.id }}" class="generate-upsell-accordion-section control-section-{{ data.type }} cannot-expand accordion-section">
|
||||
@ -48,7 +77,19 @@ if ( ! function_exists( 'generate_customizer_controls_css' ) ) {
|
||||
* @since 1.3.41
|
||||
*/
|
||||
function generate_customizer_controls_css() {
|
||||
wp_enqueue_style( 'generate-customizer-controls-css', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/upsell-customizer.css', array(), GENERATE_VERSION );
|
||||
wp_enqueue_script( 'generatepress-upsell', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/upsell-control.js', array( 'customize-controls' ), false, true );
|
||||
wp_enqueue_style(
|
||||
'generate-customizer-controls-css',
|
||||
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/upsell-customizer.css',
|
||||
array(),
|
||||
GENERATE_VERSION
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'generatepress-upsell',
|
||||
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/upsell-control.js',
|
||||
array( 'customize-controls' ),
|
||||
GENERATE_VERSION,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,142 +1,142 @@
|
||||
.customize-control-generatepress-range-slider .generatepress-slider {
|
||||
position: relative;
|
||||
width: calc(100% - 60px);
|
||||
height: 6px;
|
||||
background-color: rgba(0,0,0,.10);
|
||||
cursor: pointer;
|
||||
-webkit-transition: background .5s;
|
||||
-moz-transition: background .5s;
|
||||
transition: background .5s;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .has-unit .generatepress-slider {
|
||||
width: calc(100% - 90px);
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .gp_range_value.hide-value {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .gp_range_value.hide-value + .generatepress-slider {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .generatepress-slider .ui-slider-handle {
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
background-color: #3498D9;
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
-webkit-transform: translateY(-50%) translateX(-4px);
|
||||
transform: translateY(-50%) translateX(-4px);
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.gp-range-title-area {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.gp-range-slider-controls {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .wrapper {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-pack: justify;
|
||||
-ms-flex-pack: justify;
|
||||
justify-content: space-between;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .gp_range_value {
|
||||
font-size: 14px;
|
||||
padding: 0;
|
||||
font-weight: 400;
|
||||
width: 50px;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .has-unit .gp_range_value {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .gp_range_value span.value {
|
||||
font-size: 12px;
|
||||
width: calc(100% - 2px);
|
||||
text-align: center;
|
||||
min-height: 30px;
|
||||
background: #FFF;
|
||||
line-height: 30px;
|
||||
border: 1px solid #DDD;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .has-unit .gp_range_value span.value {
|
||||
width: calc(100% - 32px);
|
||||
display: block;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .gp_range_value .unit {
|
||||
width: 29px;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
line-height: 30px;
|
||||
background: #fff;
|
||||
border: 1px solid #ddd;
|
||||
margin-left: 1px;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .generatepress-range-slider-reset span {
|
||||
font-size: 16px;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .gp_range_value input {
|
||||
font-size: 12px;
|
||||
padding: 0px;
|
||||
text-align: center;
|
||||
min-height: 30px;
|
||||
height: auto;
|
||||
border-radius: 0;
|
||||
border-color: #ddd;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .has-unit .gp_range_value input {
|
||||
width: calc(100% - 30px);
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .gp-range-title-area .dashicons {
|
||||
cursor: pointer;
|
||||
font-size: 11px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
color: #222;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
top: 2px;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .gp-range-title-area .dashicons:hover {
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .gp-range-title-area .dashicons.selected {
|
||||
background: #fff;
|
||||
color: #222;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .gp-device-controls > span:first-child:last-child {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .sub-description {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.customize-control-generatepress-range-slider .generatepress-slider {
|
||||
position: relative;
|
||||
width: calc(100% - 60px);
|
||||
height: 6px;
|
||||
background-color: rgba(0,0,0,.10);
|
||||
cursor: pointer;
|
||||
-webkit-transition: background .5s;
|
||||
-moz-transition: background .5s;
|
||||
transition: background .5s;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .has-unit .generatepress-slider {
|
||||
width: calc(100% - 90px);
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .gp_range_value.hide-value {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .gp_range_value.hide-value + .generatepress-slider {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .generatepress-slider .ui-slider-handle {
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
background-color: #3498D9;
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
-webkit-transform: translateY(-50%) translateX(-4px);
|
||||
transform: translateY(-50%) translateX(-4px);
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.gp-range-title-area {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.gp-range-slider-controls {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .wrapper {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-pack: justify;
|
||||
-ms-flex-pack: justify;
|
||||
justify-content: space-between;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .gp_range_value {
|
||||
font-size: 14px;
|
||||
padding: 0;
|
||||
font-weight: 400;
|
||||
width: 50px;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .has-unit .gp_range_value {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .gp_range_value span.value {
|
||||
font-size: 12px;
|
||||
width: calc(100% - 2px);
|
||||
text-align: center;
|
||||
min-height: 30px;
|
||||
background: #FFF;
|
||||
line-height: 30px;
|
||||
border: 1px solid #DDD;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .has-unit .gp_range_value span.value {
|
||||
width: calc(100% - 32px);
|
||||
display: block;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .gp_range_value .unit {
|
||||
width: 29px;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
line-height: 30px;
|
||||
background: #fff;
|
||||
border: 1px solid #ddd;
|
||||
margin-left: 1px;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .generatepress-range-slider-reset span {
|
||||
font-size: 16px;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .gp_range_value input {
|
||||
font-size: 12px;
|
||||
padding: 0px;
|
||||
text-align: center;
|
||||
min-height: 30px;
|
||||
height: auto;
|
||||
border-radius: 0;
|
||||
border-color: #ddd;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .has-unit .gp_range_value input {
|
||||
width: calc(100% - 30px);
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .gp-range-title-area .dashicons {
|
||||
cursor: pointer;
|
||||
font-size: 11px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
color: #222;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
top: 2px;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .gp-range-title-area .dashicons:hover {
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .gp-range-title-area .dashicons.selected {
|
||||
background: #fff;
|
||||
color: #222;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .gp-device-controls > span:first-child:last-child {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.customize-control-generatepress-range-slider .sub-description {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
@ -1,47 +1,47 @@
|
||||
.generatepress-font-family {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.generatepress-weight-transform-wrapper {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-pack: justify;
|
||||
-ms-flex-pack: justify;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.generatepress-font-weight,
|
||||
.generatepress-font-transform {
|
||||
width: calc(50% - 5px);
|
||||
}
|
||||
|
||||
span.select2-container.select2-container--default.select2-container--open li.select2-results__option {
|
||||
margin:0;
|
||||
}
|
||||
|
||||
span.select2-container.select2-container--default.select2-container--open{
|
||||
z-index:999999;
|
||||
}
|
||||
|
||||
.select2-selection__rendered li {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--single,
|
||||
.select2-container--default.select2-container .select2-selection--multiple,
|
||||
.select2-dropdown,
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
||||
border-color: #ddd;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-results__option[aria-selected=true] {
|
||||
color: rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
#customize-control-font_heading_1_control,
|
||||
#customize-control-font_heading_2_control,
|
||||
#customize-control-font_heading_3_control {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.generatepress-font-family {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.generatepress-weight-transform-wrapper {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-pack: justify;
|
||||
-ms-flex-pack: justify;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.generatepress-font-weight,
|
||||
.generatepress-font-transform {
|
||||
width: calc(50% - 5px);
|
||||
}
|
||||
|
||||
span.select2-container.select2-container--default.select2-container--open li.select2-results__option {
|
||||
margin:0;
|
||||
}
|
||||
|
||||
span.select2-container.select2-container--default.select2-container--open{
|
||||
z-index:999999;
|
||||
}
|
||||
|
||||
.select2-selection__rendered li {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--single,
|
||||
.select2-container--default.select2-container .select2-selection--multiple,
|
||||
.select2-dropdown,
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
||||
border-color: #ddd;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-results__option[aria-selected=true] {
|
||||
color: rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
#customize-control-font_heading_1_control,
|
||||
#customize-control-font_heading_2_control,
|
||||
#customize-control-font_heading_3_control {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
@ -44,11 +44,11 @@ li#accordion-section-generatepress_upsell_section {
|
||||
border: none;
|
||||
background: none;
|
||||
font: normal 20px/1 dashicons;
|
||||
speak: none;
|
||||
speak: never;
|
||||
display: block;
|
||||
padding: 0;
|
||||
text-indent: 0;
|
||||
text-align: center;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
// Add callback for when the header_textcolor setting exists.
|
||||
api( 'generate_settings[nav_position_setting]', function( setting ) {
|
||||
var isNavFloated, linkSettingValueToControlActiveState;
|
||||
var isNavFloated, isNavAlignable, setNavDropPointActiveState, setNavAlignmentsActiveState;
|
||||
|
||||
/**
|
||||
* Determine whether the navigation is floating.
|
||||
@ -18,12 +18,31 @@
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine whether the navigation is align-able.
|
||||
*
|
||||
* @returns {boolean} Is floating?
|
||||
*/
|
||||
isNavAlignable = function() {
|
||||
if ( 'nav-float-right' === setting.get() || 'nav-float-left' === setting.get() ) {
|
||||
var navAsHeader = api.instance( 'generate_menu_plus_settings[navigation_as_header]' );
|
||||
|
||||
if ( navAsHeader && navAsHeader.get() ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Update a control's active state according to the navigation location setting's value.
|
||||
*
|
||||
* @param {wp.customize.Control} control
|
||||
*/
|
||||
linkSettingValueToControlActiveState = function( control ) {
|
||||
setNavDropPointActiveState = function( control ) {
|
||||
var setActiveState = function() {
|
||||
control.active.set( isNavFloated() );
|
||||
};
|
||||
@ -49,33 +68,96 @@
|
||||
setting.bind( setActiveState );
|
||||
};
|
||||
|
||||
// Call linkSettingValueToControlActiveState on the navigation dropdown point.
|
||||
api.control( 'generate_settings[nav_drop_point]', linkSettingValueToControlActiveState );
|
||||
/**
|
||||
* Update a control's active state according to the navigation location setting's value.
|
||||
*
|
||||
* @param {wp.customize.Control} control
|
||||
*/
|
||||
setNavAlignmentsActiveState = function( control ) {
|
||||
var setActiveState = function() {
|
||||
control.active.set( isNavAlignable() );
|
||||
};
|
||||
|
||||
// FYI: With the following we can eliminate all of our PHP active_callback code.
|
||||
control.active.validate = isNavAlignable;
|
||||
|
||||
// Set initial active state.
|
||||
setActiveState();
|
||||
|
||||
/*
|
||||
* Update activate state whenever the setting is changed.
|
||||
* Even when the setting does have a refresh transport where the
|
||||
* server-side active callback will manage the active state upon
|
||||
* refresh, having this JS management of the active state will
|
||||
* ensure that controls will have their visibility toggled
|
||||
* immediately instead of waiting for the preview to load.
|
||||
* This is especially important if the setting has a postMessage
|
||||
* transport where changing the setting wouldn't normally cause
|
||||
* the preview to refresh and thus the server-side active_callbacks
|
||||
* would not get invoked.
|
||||
*/
|
||||
setting.bind( setActiveState );
|
||||
};
|
||||
|
||||
api.control( 'generate_settings[nav_drop_point]', setNavDropPointActiveState );
|
||||
api.control( 'generate_settings[nav_layout_setting]', setNavAlignmentsActiveState );
|
||||
api.control( 'generate_settings[nav_inner_width]', setNavAlignmentsActiveState );
|
||||
api.control( 'generate_settings[nav_alignment_setting]', setNavAlignmentsActiveState );
|
||||
} );
|
||||
|
||||
var setOption = function( headerAlignment, navLocation, navAlignment ) {
|
||||
if ( headerAlignment ) {
|
||||
api.control( 'generate_settings[header_alignment_setting]' ).setting.set( headerAlignment );
|
||||
var setOption = function( options ) {
|
||||
if ( options.headerAlignment ) {
|
||||
api.instance( 'generate_settings[header_alignment_setting]' ).set( options.headerAlignment );
|
||||
}
|
||||
|
||||
if ( navLocation ) {
|
||||
api.control( 'generate_settings[nav_position_setting]' ).setting.set( navLocation );
|
||||
if ( options.navLocation ) {
|
||||
api.instance( 'generate_settings[nav_position_setting]' ).set( options.navLocation );
|
||||
}
|
||||
|
||||
if ( navAlignment ) {
|
||||
api.control( 'generate_settings[nav_alignment_setting]' ).setting.set( navAlignment );
|
||||
if ( options.navAlignment ) {
|
||||
api.instance( 'generate_settings[nav_alignment_setting]' ).set( options.navAlignment );
|
||||
}
|
||||
|
||||
if ( options.boxAlignment ) {
|
||||
api.instance( 'generate_settings[container_alignment]' ).set( options.boxAlignment );
|
||||
}
|
||||
|
||||
if ( options.siteTitleFontSize ) {
|
||||
api.instance( 'generate_settings[site_title_font_size]' ).set( options.siteTitleFontSize );
|
||||
}
|
||||
|
||||
if ( 'undefined' !== typeof options.hideSiteTagline ) {
|
||||
api.instance( 'generate_settings[hide_tagline]' ).set( options.hideSiteTagline );
|
||||
}
|
||||
|
||||
if ( options.headerPaddingTop ) {
|
||||
api.instance( 'generate_spacing_settings[header_top]' ).set( options.headerPaddingTop );
|
||||
}
|
||||
|
||||
if ( options.headerPaddingBottom ) {
|
||||
api.instance( 'generate_spacing_settings[header_bottom]' ).set( options.headerPaddingBottom );
|
||||
}
|
||||
};
|
||||
|
||||
api( 'generate_header_helper', function( value ) {
|
||||
var headerAlignment = false,
|
||||
navLocation = false,
|
||||
navAlignment = false;
|
||||
navAlignment = false,
|
||||
boxAlignment = false,
|
||||
siteTitleFontSize = false,
|
||||
hideSiteTagline = false,
|
||||
headerPaddingTop = false,
|
||||
headerPaddingBottom = false;
|
||||
|
||||
value.bind( function( newval ) {
|
||||
var headerAlignmentSetting = api.control( 'generate_settings[header_alignment_setting]' ).setting;
|
||||
var navLocationSetting = api.control( 'generate_settings[nav_position_setting]' ).setting;
|
||||
var navAlignmentSetting = api.control( 'generate_settings[nav_alignment_setting]' ).setting;
|
||||
var headerAlignmentSetting = api.instance( 'generate_settings[header_alignment_setting]' );
|
||||
var navLocationSetting = api.instance( 'generate_settings[nav_position_setting]' );
|
||||
var navAlignmentSetting = api.instance( 'generate_settings[nav_alignment_setting]' );
|
||||
var boxAlignmentSetting = api.instance( 'generate_settings[container_alignment]' );
|
||||
var siteTitleFontSizeSetting = api.instance( 'generate_settings[site_title_font_size]' );
|
||||
var hideSiteTaglineSetting = api.instance( 'generate_settings[hide_tagline]' );
|
||||
var headerPaddingTopSetting = api.instance( 'generate_spacing_settings[header_top]' );
|
||||
var headerPaddingBottomSetting = api.instance( 'generate_spacing_settings[header_bottom]' );
|
||||
|
||||
if ( ! headerAlignmentSetting._dirty ) {
|
||||
headerAlignment = headerAlignmentSetting.get();
|
||||
@ -89,28 +171,109 @@
|
||||
navAlignment = navAlignmentSetting.get();
|
||||
}
|
||||
|
||||
if ( ! boxAlignmentSetting._dirty ) {
|
||||
boxAlignment = boxAlignmentSetting.get();
|
||||
}
|
||||
|
||||
if ( ! siteTitleFontSizeSetting._dirty ) {
|
||||
siteTitleFontSize = siteTitleFontSizeSetting.get();
|
||||
}
|
||||
|
||||
if ( ! hideSiteTaglineSetting._dirty ) {
|
||||
hideSiteTagline = hideSiteTaglineSetting.get();
|
||||
}
|
||||
|
||||
if ( ! headerPaddingTopSetting._dirty ) {
|
||||
headerPaddingTop = headerPaddingTopSetting.get();
|
||||
}
|
||||
|
||||
if ( ! headerPaddingBottomSetting._dirty ) {
|
||||
headerPaddingBottom = headerPaddingBottomSetting.get();
|
||||
}
|
||||
|
||||
var options = {
|
||||
headerAlignment: generatepress_defaults.header_alignment_setting,
|
||||
navLocation: generatepress_defaults.nav_position_setting,
|
||||
navAlignment: generatepress_defaults.nav_alignment_setting,
|
||||
boxAlignment: generatepress_defaults.container_alignment,
|
||||
siteTitleFontSize: generatepress_typography_defaults.site_title_font_size,
|
||||
hideSiteTagline: generatepress_defaults.hide_tagline,
|
||||
headerPaddingTop: generatepress_spacing_defaults.header_top,
|
||||
headerPaddingBottom: generatepress_spacing_defaults.header_bottom,
|
||||
};
|
||||
|
||||
if ( 'current' === newval ) {
|
||||
setOption( headerAlignment, navLocation, navAlignment );
|
||||
options = {
|
||||
headerAlignment: headerAlignment,
|
||||
navLocation: navLocation,
|
||||
navAlignment: navAlignment,
|
||||
boxAlignment: boxAlignment,
|
||||
siteTitleFontSize: siteTitleFontSize,
|
||||
hideSiteTagline: hideSiteTagline,
|
||||
headerPaddingTop: headerPaddingTop,
|
||||
headerPaddingBottom: headerPaddingBottom,
|
||||
};
|
||||
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'default' === newval ) {
|
||||
setOption( generatepress_defaults.header_alignment_setting, generatepress_defaults.nav_position_setting, generatepress_defaults.nav_alignment_setting );
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'classic' === newval ) {
|
||||
var options = {
|
||||
headerAlignment: 'left',
|
||||
navLocation: 'nav-below-header',
|
||||
navAlignment: 'left',
|
||||
boxAlignment: 'boxes',
|
||||
siteTitleFontSize: '45',
|
||||
hideSiteTagline: '',
|
||||
headerPaddingTop: '40',
|
||||
headerPaddingBottom: '40',
|
||||
};
|
||||
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'nav-before' === newval ) {
|
||||
options['headerAlignment'] = 'left';
|
||||
options['navLocation'] = 'nav-above-header';
|
||||
options['navAlignment'] = 'left';
|
||||
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'nav-after' === newval ) {
|
||||
options['headerAlignment'] = 'left';
|
||||
options['navLocation'] = 'nav-below-header';
|
||||
options['navAlignment'] = 'left';
|
||||
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'nav-before-centered' === newval ) {
|
||||
setOption( 'center', 'nav-above-header', 'center' );
|
||||
options['headerAlignment'] = 'center';
|
||||
options['navLocation'] = 'nav-above-header';
|
||||
options['navAlignment'] = 'center';
|
||||
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'nav-after-centered' === newval ) {
|
||||
setOption( 'center', 'nav-below-header', 'center' );
|
||||
}
|
||||
options['headerAlignment'] = 'center';
|
||||
options['navLocation'] = 'nav-below-header';
|
||||
options['navAlignment'] = 'center';
|
||||
|
||||
if ( 'nav-right' === newval ) {
|
||||
setOption( 'left', 'nav-float-right', 'left' );
|
||||
setOption( options );
|
||||
}
|
||||
|
||||
if ( 'nav-left' === newval ) {
|
||||
setOption( 'right', 'nav-float-left', 'right' );
|
||||
options['headerAlignment'] = 'left';
|
||||
options['navLocation'] = 'nav-float-left';
|
||||
options['navAlignment'] = 'right';
|
||||
|
||||
setOption( options );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
@ -231,24 +394,24 @@
|
||||
subMenuCurrentTextColorSetting.set( generatepress_color_defaults.subnavigation_text_current_color );
|
||||
}
|
||||
|
||||
if ( 'white' === newval ) {
|
||||
backgroundColorSetting.set( '#ffffff' );
|
||||
textColorSetting.set( '#000000' );
|
||||
if ( 'classic' === newval ) {
|
||||
backgroundColorSetting.set( '#222222' );
|
||||
textColorSetting.set( '#ffffff' );
|
||||
|
||||
backgroundColorHoverSetting.set( '#ffffff' );
|
||||
textColorHoverSetting.set( '#8f919e' );
|
||||
backgroundColorHoverSetting.set( '#3f3f3f' );
|
||||
textColorHoverSetting.set( '#ffffff' );
|
||||
|
||||
currentBackgroundColorSetting.set( '#ffffff' );
|
||||
currentTextColorSetting.set( '#8f919e' );
|
||||
currentBackgroundColorSetting.set( '#3f3f3f' );
|
||||
currentTextColorSetting.set( '#ffffff' );
|
||||
|
||||
subMenuBackgroundColorSetting.set( '#f6f9fc' );
|
||||
subMenuTextColorSetting.set( '#000000' );
|
||||
subMenuBackgroundColorSetting.set( '#3f3f3f' );
|
||||
subMenuTextColorSetting.set( '#ffffff' );
|
||||
|
||||
subMenuBackgroundColorHoverSetting.set( '#f6f9fc' );
|
||||
subMenuTextColorHoverSetting.set( '#8f919e' );
|
||||
subMenuBackgroundColorHoverSetting.set( '#4f4f4f' );
|
||||
subMenuTextColorHoverSetting.set( '#ffffff' );
|
||||
|
||||
subMenuCurrentBackgroundColorSetting.set( '#f6f9fc' );
|
||||
subMenuCurrentTextColorSetting.set( '#8f919e' );
|
||||
subMenuCurrentBackgroundColorSetting.set( '#4f4f4f' );
|
||||
subMenuCurrentTextColorSetting.set( '#ffffff' );
|
||||
}
|
||||
|
||||
if ( 'grey' === newval ) {
|
||||
|
@ -348,11 +348,6 @@ function generatepress_typography_live_update( id, selector, property, unit, med
|
||||
generatepress_typography_live_update( 'heading_3_line_height', 'h3', 'line-height', 'em' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Content layout
|
||||
*/
|
||||
generatepress_classes_live_update( 'content_layout_setting', [ 'one-container', 'separate-containers' ], 'body' );
|
||||
|
||||
/**
|
||||
* Top bar width
|
||||
*/
|
||||
@ -432,18 +427,25 @@ function generatepress_typography_live_update( id, selector, property, unit, med
|
||||
*/
|
||||
wp.customize( 'generate_settings[nav_layout_setting]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
var navLocation = wp.customize.value('generate_settings[nav_position_setting]')();
|
||||
|
||||
if ( $( 'body' ).hasClass( 'sticky-enabled' ) ) {
|
||||
wp.customize.preview.send( 'refresh' );
|
||||
} else {
|
||||
var mainNavigation = $( '.main-navigation' );
|
||||
|
||||
if ( 'fluid-nav' == newval ) {
|
||||
$( '.main-navigation' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
|
||||
mainNavigation.removeClass( 'grid-container' ).removeClass( 'grid-parent' );
|
||||
if ( 'full-width' !== wp.customize.value('generate_settings[nav_inner_width]')() ) {
|
||||
$( '.main-navigation .inside-navigation' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
|
||||
}
|
||||
}
|
||||
if ( 'contained-nav' == newval ) {
|
||||
$( '.main-navigation' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
|
||||
$( '.main-navigation .inside-navigation' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
|
||||
if ( ! mainNavigation.hasClass( 'has-branding' ) && generatepress_live_preview.isFlex && ( 'nav-float-right' === navLocation || 'nav-float-left' === navLocation ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
mainNavigation.addClass( 'grid-container' ).addClass( 'grid-parent' );
|
||||
}
|
||||
}
|
||||
} );
|
||||
@ -464,78 +466,33 @@ function generatepress_typography_live_update( id, selector, property, unit, med
|
||||
} );
|
||||
|
||||
/**
|
||||
* Navigation position
|
||||
* Navigation alignment
|
||||
*/
|
||||
wp.customize( 'generate_settings[nav_position_setting]', function( value ) {
|
||||
wp.customize( 'generate_settings[nav_alignment_setting]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
$( 'body' ).trigger( 'generate_navigation_location_updated' );
|
||||
var classes = [ 'left', 'center', 'right' ];
|
||||
var selector = 'body';
|
||||
var prefix = 'nav-aligned-';
|
||||
|
||||
// Update navigation alignment settings.
|
||||
$( 'body' ).removeClass( 'nav-aligned-center' );
|
||||
$( 'body' ).removeClass( 'nav-aligned-left' );
|
||||
$( 'body' ).removeClass( 'nav-aligned-right' );
|
||||
$( 'body' ).addClass( 'nav-aligned-' + wp.customize.value('generate_settings[nav_alignment_setting]')() );
|
||||
|
||||
if ( $( '.gen-sidebar-nav' ).length ) {
|
||||
wp.customize.preview.send( 'refresh' );
|
||||
return false;
|
||||
}
|
||||
if ( 'nav-left-sidebar' == newval ) {
|
||||
wp.customize.preview.send( 'refresh' );
|
||||
return false;
|
||||
}
|
||||
if ( 'nav-right-sidebar' == newval ) {
|
||||
wp.customize.preview.send( 'refresh' );
|
||||
return false;
|
||||
if ( generatepress_live_preview.isFlex ) {
|
||||
selector = '.main-navigation:not(.slideout-navigation)';
|
||||
prefix = 'nav-align-';
|
||||
}
|
||||
|
||||
if ( '' !== wp.customize.value('generate_settings[nav_drop_point]')() ) {
|
||||
wp.customize.preview.send( 'refresh' );
|
||||
return false;
|
||||
}
|
||||
jQuery.each( classes, function( i, v ) {
|
||||
jQuery( selector ).removeClass( prefix + v );
|
||||
});
|
||||
|
||||
var classes = [ 'nav-below-header', 'nav-above-header', 'nav-float-right', 'nav-float-left', 'nav-left-sidebar', 'nav-right-sidebar' ];
|
||||
if ( 'nav-left-sidebar' !== newval && 'nav-right-sidebar' !== newval ) {
|
||||
$.each( classes, function( i, v ) {
|
||||
$( 'body' ).removeClass( v );
|
||||
});
|
||||
}
|
||||
$( 'body' ).addClass( newval );
|
||||
if ( 'nav-below-header' == newval ) {
|
||||
$( '#site-navigation:first' ).insertAfter( '.site-header' ).show();
|
||||
}
|
||||
if ( 'nav-above-header' == newval ) {
|
||||
if ( $( '.top-bar:not(.secondary-navigation .top-bar)' ).length ) {
|
||||
$( '#site-navigation:first' ).insertAfter( '.top-bar' ).show();
|
||||
} else {
|
||||
$( '#site-navigation:first' ).prependTo( 'body' ).show();
|
||||
}
|
||||
}
|
||||
if ( 'nav-float-right' == newval ) {
|
||||
if ( ! $( 'body' ).hasClass( 'using-floats' ) && $( '.header-widget' ).length ) {
|
||||
$( '#site-navigation:first' ).insertBefore( '.header-widget' ).show();
|
||||
} else {
|
||||
$( '#site-navigation:first' ).appendTo( '.inside-header' ).show();
|
||||
}
|
||||
}
|
||||
if ( 'nav-float-left' == newval ) {
|
||||
$( '#site-navigation:first' ).appendTo( '.inside-header' ).show();
|
||||
}
|
||||
if ( '' == newval ) {
|
||||
if ( $( '.gen-sidebar-nav' ).length ) {
|
||||
wp.customize.preview.send( 'refresh' );
|
||||
} else {
|
||||
$( '#site-navigation:first' ).hide();
|
||||
if ( generatepress_live_preview.isFlex && generatepress_live_preview.isRTL ) {
|
||||
jQuery( selector ).addClass( prefix + newval );
|
||||
} else {
|
||||
if ( 'nav-align-left' !== prefix + newval ) {
|
||||
jQuery( selector ).addClass( prefix + newval );
|
||||
}
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
/**
|
||||
* Navigation alignment
|
||||
*/
|
||||
generatepress_classes_live_update( 'nav_alignment_setting', [ 'left', 'center', 'right' ], 'body', 'nav-aligned-' );
|
||||
|
||||
/**
|
||||
* Footer width
|
||||
*/
|
||||
@ -582,10 +539,11 @@ function generatepress_typography_live_update( id, selector, property, unit, med
|
||||
jQuery( 'body' ).on( 'generate_spacing_updated', function() {
|
||||
var containerAlignment = wp.customize( 'generate_settings[container_alignment]' ).get(),
|
||||
containerWidth = wp.customize( 'generate_settings[container_width]' ).get(),
|
||||
containerLayout = wp.customize( 'generate_settings[content_layout_setting]' ).get(),
|
||||
contentLeft = generatepress_live_preview.contentLeft,
|
||||
contentRight = generatepress_live_preview.contentRight;
|
||||
|
||||
if ( 'text' === containerAlignment ) {
|
||||
if ( ! generatepress_live_preview.isFlex && 'text' === containerAlignment ) {
|
||||
if ( typeof wp.customize( 'generate_spacing_settings[content_left]' ) !== 'undefined' ) {
|
||||
contentLeft = wp.customize( 'generate_spacing_settings[content_left]' ).get();
|
||||
}
|
||||
@ -597,13 +555,110 @@ function generatepress_typography_live_update( id, selector, property, unit, med
|
||||
var newContainerWidth = Number( containerWidth ) + Number( contentLeft ) + Number( contentRight );
|
||||
|
||||
if ( jQuery( 'style#wide_container_width' ).length ) {
|
||||
jQuery( 'style#wide_container_width' ).html( '#page{max-width:' + newContainerWidth + 'px;}' );
|
||||
jQuery( 'style#wide_container_width' ).html( 'body:not(.full-width-content) #page{max-width:' + newContainerWidth + 'px;}' );
|
||||
} else {
|
||||
jQuery( 'head' ).append( '<style id="wide_container_width">#page{max-width:' + newContainerWidth + 'px;}</style>' );
|
||||
jQuery( 'head' ).append( '<style id="wide_container_width">body:not(.full-width-content) #page{max-width:' + newContainerWidth + 'px;}</style>' );
|
||||
setTimeout(function() {
|
||||
jQuery( 'style#wide_container_width' ).not( ':last' ).remove();
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
if ( generatepress_live_preview.isFlex && 'boxes' === containerAlignment ) {
|
||||
var topBarPaddingLeft = jQuery( '.inside-top-bar' ).css( 'padding-left' ),
|
||||
topBarPaddingRight = jQuery( '.inside-top-bar' ).css( 'padding-right' ),
|
||||
headerPaddingLeft = jQuery( '.inside-header' ).css( 'padding-left' ),
|
||||
headerPaddingRight = jQuery( '.inside-header' ).css( 'padding-right' ),
|
||||
footerWidgetPaddingLeft = jQuery( '.footer-widgets-container' ).css( 'padding-left' ),
|
||||
footerWidgetPaddingRight = jQuery( '.footer-widgets-container' ).css( 'padding-right' ),
|
||||
footerBarPaddingLeft = jQuery( '.inside-footer-bar' ).css( 'padding-left' ),
|
||||
footerBarPaddingRight = jQuery( '.inside-footer-bar' ).css( 'padding-right' );
|
||||
|
||||
if ( typeof wp.customize( 'generate_spacing_settings[top_bar_left]' ) !== 'undefined' ) {
|
||||
topBarPaddingLeft = wp.customize( 'generate_spacing_settings[top_bar_left]' ).get() + 'px';
|
||||
}
|
||||
|
||||
if ( typeof wp.customize( 'generate_spacing_settings[top_bar_right]' ) !== 'undefined' ) {
|
||||
topBarPaddingRight = wp.customize( 'generate_spacing_settings[top_bar_right]' ).get() + 'px';
|
||||
}
|
||||
|
||||
if ( typeof wp.customize( 'generate_spacing_settings[header_left]' ) !== 'undefined' ) {
|
||||
headerPaddingLeft = wp.customize( 'generate_spacing_settings[header_left]' ).get() + 'px';
|
||||
}
|
||||
|
||||
if ( typeof wp.customize( 'generate_spacing_settings[header_right]' ) !== 'undefined' ) {
|
||||
headerPaddingRight = wp.customize( 'generate_spacing_settings[header_right]' ).get() + 'px';
|
||||
}
|
||||
|
||||
if ( typeof wp.customize( 'generate_spacing_settings[footer_widget_container_left]' ) !== 'undefined' ) {
|
||||
footerWidgetPaddingLeft = wp.customize( 'generate_spacing_settings[footer_widget_container_left]' ).get() + 'px';
|
||||
}
|
||||
|
||||
if ( typeof wp.customize( 'generate_spacing_settings[footer_widget_container_right]' ) !== 'undefined' ) {
|
||||
footerWidgetPaddingRight = wp.customize( 'generate_spacing_settings[footer_widget_container_right]' ).get() + 'px';
|
||||
}
|
||||
|
||||
if ( typeof wp.customize( 'generate_spacing_settings[footer_left]' ) !== 'undefined' ) {
|
||||
footerBarPaddingLeft = wp.customize( 'generate_spacing_settings[footer_left]' ).get() + 'px';
|
||||
}
|
||||
|
||||
if ( typeof wp.customize( 'generate_spacing_settings[footer_right]' ) !== 'undefined' ) {
|
||||
footerBarPaddingRight = wp.customize( 'generate_spacing_settings[footer_right]' ).get() + 'px';
|
||||
}
|
||||
|
||||
var newTopBarWidth = parseFloat( containerWidth ) + parseFloat( topBarPaddingLeft ) + parseFloat( topBarPaddingRight ),
|
||||
newHeaderWidth = parseFloat( containerWidth ) + parseFloat( headerPaddingLeft ) + parseFloat( headerPaddingRight ),
|
||||
newFooterWidgetWidth = parseFloat( containerWidth ) + parseFloat( footerWidgetPaddingLeft ) + parseFloat( footerWidgetPaddingRight ),
|
||||
newFooterBarWidth = parseFloat( containerWidth ) + parseFloat( footerBarPaddingLeft ) + parseFloat( footerBarPaddingRight );
|
||||
|
||||
if ( jQuery( 'style#box_sizing_widths' ).length ) {
|
||||
jQuery( 'style#box_sizing_widths' ).html( '.inside-top-bar.grid-container{max-width:' + newTopBarWidth + 'px;}.inside-header.grid-container{max-width:' + newHeaderWidth + 'px;}.footer-widgets-container.grid-container{max-width:' + newFooterWidgetWidth + 'px;}.inside-site-info.grid-container{max-width:' + newFooterBarWidth + 'px;}' );
|
||||
} else {
|
||||
jQuery( 'head' ).append( '<style id="box_sizing_widths">.inside-top-bar.grid-container{max-width:' + newTopBarWidth + 'px;}.inside-header.grid-container{max-width:' + newHeaderWidth + 'px;}.footer-widgets-container.grid-container{max-width:' + newFooterWidgetWidth + 'px;}.inside-site-info.grid-container{max-width:' + newFooterBarWidth + 'px;}</style>' );
|
||||
setTimeout(function() {
|
||||
jQuery( 'style#box_sizing_widths' ).not( ':last' ).remove();
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
if ( generatepress_live_preview.isFlex && 'text' === containerAlignment ) {
|
||||
var headerPaddingLeft = jQuery( '.inside-header' ).css( 'padding-left' ),
|
||||
headerPaddingRight = jQuery( '.inside-header' ).css( 'padding-right' ),
|
||||
menuItemPadding = jQuery( '.main-navigation .main-nav ul li a' ).css( 'padding-left' ),
|
||||
secondaryMenuItemPadding = jQuery( '.secondary-navigation .main-nav ul li a' ).css( 'padding-left' );
|
||||
|
||||
if ( typeof wp.customize( 'generate_spacing_settings[header_left]' ) !== 'undefined' ) {
|
||||
headerPaddingLeft = wp.customize( 'generate_spacing_settings[header_left]' ).get() + 'px';
|
||||
}
|
||||
|
||||
if ( typeof wp.customize( 'generate_spacing_settings[header_right]' ) !== 'undefined' ) {
|
||||
headerPaddingRight = wp.customize( 'generate_spacing_settings[header_right]' ).get() + 'px';
|
||||
}
|
||||
|
||||
if ( typeof wp.customize( 'generate_spacing_settings[menu_item]' ) !== 'undefined' ) {
|
||||
menuItemPadding = wp.customize( 'generate_spacing_settings[menu_item]' ).get() + 'px';
|
||||
}
|
||||
|
||||
if ( typeof wp.customize( 'generate_spacing_settings[secondary_menu_item]' ) !== 'undefined' ) {
|
||||
secondaryMenuItemPadding = wp.customize( 'generate_spacing_settings[secondary_menu_item]' ).get() + 'px';
|
||||
}
|
||||
|
||||
var newNavPaddingLeft = parseFloat( headerPaddingLeft ) - parseFloat( menuItemPadding ),
|
||||
newNavPaddingRight = parseFloat( headerPaddingRight ) - parseFloat( menuItemPadding ),
|
||||
newSecondaryNavPaddingLeft = parseFloat( headerPaddingLeft ) - parseFloat( secondaryMenuItemPadding ),
|
||||
newSecondaryNavPaddingRight = parseFloat( headerPaddingRight ) - parseFloat( secondaryMenuItemPadding );
|
||||
|
||||
if ( jQuery( 'style#navigation_padding' ).length ) {
|
||||
jQuery( 'style#navigation_padding' ).html( '.nav-below-header .main-navigation .inside-navigation.grid-container, .nav-above-header .main-navigation .inside-navigation.grid-container{padding: 0 ' + newNavPaddingRight + 'px 0 ' + newNavPaddingLeft + 'px;}' );
|
||||
jQuery( 'style#secondary_navigation_padding' ).html( '.secondary-nav-below-header .secondary-navigation .inside-navigation.grid-container, .secondary-nav-above-header .secondary-navigation .inside-navigation.grid-container{padding: 0 ' + newSecondaryNavPaddingRight + 'px 0 ' + newSecondaryNavPaddingLeft + 'px;}' );
|
||||
} else {
|
||||
jQuery( 'head' ).append( '<style id="navigation_padding">.nav-below-header .main-navigation .inside-navigation.grid-container, .nav-above-header .main-navigation .inside-navigation.grid-container{padding: 0 ' + newNavPaddingRight + 'px 0 ' + newNavPaddingLeft + 'px;}</style>' );
|
||||
jQuery( 'head' ).append( '<style id="secondary_navigation_padding">.secondary-nav-below-header .secondary-navigation .inside-navigation.grid-container, .secondary-nav-above-header .secondary-navigation .inside-navigation.grid-container{padding: 0 ' + newSecondaryNavPaddingRight + 'px 0 ' + newSecondaryNavPaddingLeft + 'px;}</style>' );
|
||||
setTimeout(function() {
|
||||
jQuery( 'style#navigation_padding' ).not( ':last' ).remove();
|
||||
jQuery( 'style#secondary_navigation_padding' ).not( ':last' ).remove();
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
} );
|
||||
} )( jQuery );
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,154 +1,154 @@
|
||||
( function( api ) {
|
||||
|
||||
api.controlConstructor['gp-customizer-typography'] = api.Control.extend( {
|
||||
ready: function() {
|
||||
var control = this;
|
||||
|
||||
control.container.on( 'change', '.generatepress-font-family select',
|
||||
function() {
|
||||
var _this = jQuery( this ),
|
||||
_value = _this.val(),
|
||||
_categoryID = _this.attr( 'data-category' ),
|
||||
_variantsID = _this.attr( 'data-variants' );
|
||||
|
||||
// Set our font family
|
||||
control.settings['family'].set( _this.val() );
|
||||
|
||||
// Bail if our controls don't exist
|
||||
if ( 'undefined' == typeof control.settings['category'] || 'undefined' == typeof control.settings['variant'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout( function() {
|
||||
// Send our request to the generate_get_all_google_fonts_ajax function
|
||||
var response = jQuery.getJSON({
|
||||
type: 'POST',
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
action: 'generate_get_all_google_fonts_ajax',
|
||||
gp_customize_nonce: gp_customize.nonce
|
||||
},
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
});
|
||||
|
||||
// Get our response
|
||||
var fonts = response.responseJSON;
|
||||
|
||||
// Create an ID from our selected font
|
||||
var id = _value.split(' ').join('_').toLowerCase();
|
||||
|
||||
// Set our values if we have them
|
||||
if ( id in fonts ) {
|
||||
|
||||
// Get existing variants if this font is already selected
|
||||
var got_variants = false;
|
||||
jQuery( '.generatepress-font-family select' ).not( _this ).each( function( key, select ) {
|
||||
var parent = jQuery( this ).closest( '.generatepress-font-family' );
|
||||
|
||||
if ( _value == jQuery( select ).val() && _this.data( 'category' ) !== jQuery( select ).data( 'category' ) ) {
|
||||
if ( ! got_variants ) {
|
||||
updated_variants = jQuery( parent.next( '.generatepress-font-variant' ).find( 'select' ) ).val();
|
||||
got_variants = true;
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
// We're using a Google font, so show the variants field
|
||||
_this.closest( '.generatepress-font-family' ).next( 'div' ).show();
|
||||
|
||||
// Remove existing variants
|
||||
jQuery( 'select[name="' + _variantsID + '"]' ).find( 'option' ).remove();
|
||||
|
||||
// Populate our select input with available variants
|
||||
jQuery.each( fonts[ id ].variants, function( key, value ) {
|
||||
jQuery( 'select[name="' + _variantsID + '"]' ).append( jQuery( '<option></option>' ).attr( 'value', value ).text( value ) );
|
||||
} );
|
||||
|
||||
// Set our variants
|
||||
if ( ! got_variants ) {
|
||||
control.settings[ 'variant' ].set( fonts[ id ].variants );
|
||||
} else {
|
||||
control.settings[ 'variant' ].set( updated_variants );
|
||||
}
|
||||
|
||||
// Set our font category
|
||||
control.settings[ 'category' ].set( fonts[ id ].category );
|
||||
jQuery( 'input[name="' + _categoryID + '"' ).val( fonts[ id ].category );
|
||||
} else {
|
||||
_this.closest( '.generatepress-font-family' ).next( 'div' ).hide();
|
||||
control.settings[ 'category' ].set( '' )
|
||||
control.settings[ 'variant' ].set( '' )
|
||||
jQuery( 'input[name="' + _categoryID + '"' ).val( '' );
|
||||
jQuery( 'select[name="' + _variantsID + '"]' ).find( 'option' ).remove();
|
||||
}
|
||||
}, 25 );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change', '.generatepress-font-variant select',
|
||||
function() {
|
||||
var _this = jQuery( this );
|
||||
var variants = _this.val();
|
||||
|
||||
control.settings['variant'].set( variants );
|
||||
|
||||
jQuery( '.generatepress-font-variant select' ).each( function( key, value ) {
|
||||
var this_control = jQuery( this ).closest( 'li' ).attr( 'id' ).replace( 'customize-control-', '' );
|
||||
var parent = jQuery( this ).closest( '.generatepress-font-variant' );
|
||||
var font_val = api.control( this_control ).settings['family'].get();
|
||||
|
||||
if ( font_val == control.settings['family'].get() && _this.attr( 'name' ) !== jQuery( value ).attr( 'name' ) ) {
|
||||
jQuery( parent.find( 'select' ) ).not( _this ).val( variants ).triggerHandler( 'change' );
|
||||
api.control( this_control ).settings['variant'].set( variants );
|
||||
}
|
||||
} );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change', '.generatepress-font-category input',
|
||||
function() {
|
||||
control.settings['category'].set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change', '.generatepress-font-weight select',
|
||||
function() {
|
||||
control.settings['weight'].set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change', '.generatepress-font-transform select',
|
||||
function() {
|
||||
control.settings['transform'].set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
} );
|
||||
|
||||
} )( wp.customize );
|
||||
|
||||
jQuery( document ).ready( function( $ ) {
|
||||
|
||||
$( '.generatepress-font-family select' ).select2();
|
||||
|
||||
$( '.generatepress-font-variant' ).each( function( key, value ) {
|
||||
var _this = $( this );
|
||||
var value = _this.data( 'saved-value' );
|
||||
|
||||
if ( value ) {
|
||||
value = value.toString().split( ',' );
|
||||
}
|
||||
|
||||
_this.find( 'select' ).select2().val( value ).trigger( 'change.select2' );
|
||||
} );
|
||||
|
||||
$( ".generatepress-font-family" ).each( function( key, value ) {
|
||||
var _this = $( this );
|
||||
if ( $.inArray( _this.find( 'select' ).val(), typography_defaults ) !== -1 ) {
|
||||
_this.next( '.generatepress-font-variant' ).hide();
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
||||
( function( api ) {
|
||||
|
||||
api.controlConstructor['gp-customizer-typography'] = api.Control.extend( {
|
||||
ready: function() {
|
||||
var control = this;
|
||||
|
||||
control.container.on( 'change', '.generatepress-font-family select',
|
||||
function() {
|
||||
var _this = jQuery( this ),
|
||||
_value = _this.val(),
|
||||
_categoryID = _this.attr( 'data-category' ),
|
||||
_variantsID = _this.attr( 'data-variants' );
|
||||
|
||||
// Set our font family
|
||||
control.settings['family'].set( _this.val() );
|
||||
|
||||
// Bail if our controls don't exist
|
||||
if ( 'undefined' == typeof control.settings['category'] || 'undefined' == typeof control.settings['variant'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout( function() {
|
||||
// Send our request to the generate_get_all_google_fonts_ajax function
|
||||
var response = jQuery.getJSON({
|
||||
type: 'POST',
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
action: 'generate_get_all_google_fonts_ajax',
|
||||
gp_customize_nonce: gp_customize.nonce
|
||||
},
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
});
|
||||
|
||||
// Get our response
|
||||
var fonts = response.responseJSON;
|
||||
|
||||
// Create an ID from our selected font
|
||||
var id = _value.split(' ').join('_').toLowerCase();
|
||||
|
||||
// Set our values if we have them
|
||||
if ( id in fonts ) {
|
||||
|
||||
// Get existing variants if this font is already selected
|
||||
var got_variants = false;
|
||||
jQuery( '.generatepress-font-family select' ).not( _this ).each( function( key, select ) {
|
||||
var parent = jQuery( this ).closest( '.generatepress-font-family' );
|
||||
|
||||
if ( _value == jQuery( select ).val() && _this.data( 'category' ) !== jQuery( select ).data( 'category' ) ) {
|
||||
if ( ! got_variants ) {
|
||||
updated_variants = jQuery( parent.next( '.generatepress-font-variant' ).find( 'select' ) ).val();
|
||||
got_variants = true;
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
// We're using a Google font, so show the variants field
|
||||
_this.closest( '.generatepress-font-family' ).next( 'div' ).show();
|
||||
|
||||
// Remove existing variants
|
||||
jQuery( 'select[name="' + _variantsID + '"]' ).find( 'option' ).remove();
|
||||
|
||||
// Populate our select input with available variants
|
||||
jQuery.each( fonts[ id ].variants, function( key, value ) {
|
||||
jQuery( 'select[name="' + _variantsID + '"]' ).append( jQuery( '<option></option>' ).attr( 'value', value ).text( value ) );
|
||||
} );
|
||||
|
||||
// Set our variants
|
||||
if ( ! got_variants ) {
|
||||
control.settings[ 'variant' ].set( fonts[ id ].variants );
|
||||
} else {
|
||||
control.settings[ 'variant' ].set( updated_variants );
|
||||
}
|
||||
|
||||
// Set our font category
|
||||
control.settings[ 'category' ].set( fonts[ id ].category );
|
||||
jQuery( 'input[name="' + _categoryID + '"' ).val( fonts[ id ].category );
|
||||
} else {
|
||||
_this.closest( '.generatepress-font-family' ).next( 'div' ).hide();
|
||||
control.settings[ 'category' ].set( '' )
|
||||
control.settings[ 'variant' ].set( '' )
|
||||
jQuery( 'input[name="' + _categoryID + '"' ).val( '' );
|
||||
jQuery( 'select[name="' + _variantsID + '"]' ).find( 'option' ).remove();
|
||||
}
|
||||
}, 25 );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change', '.generatepress-font-variant select',
|
||||
function() {
|
||||
var _this = jQuery( this );
|
||||
var variants = _this.val();
|
||||
|
||||
control.settings['variant'].set( variants );
|
||||
|
||||
jQuery( '.generatepress-font-variant select' ).each( function( key, value ) {
|
||||
var this_control = jQuery( this ).closest( 'li' ).attr( 'id' ).replace( 'customize-control-', '' );
|
||||
var parent = jQuery( this ).closest( '.generatepress-font-variant' );
|
||||
var font_val = api.control( this_control ).settings['family'].get();
|
||||
|
||||
if ( font_val == control.settings['family'].get() && _this.attr( 'name' ) !== jQuery( value ).attr( 'name' ) ) {
|
||||
jQuery( parent.find( 'select' ) ).not( _this ).val( variants ).triggerHandler( 'change' );
|
||||
api.control( this_control ).settings['variant'].set( variants );
|
||||
}
|
||||
} );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change', '.generatepress-font-category input',
|
||||
function() {
|
||||
control.settings['category'].set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change', '.generatepress-font-weight select',
|
||||
function() {
|
||||
control.settings['weight'].set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
control.container.on( 'change', '.generatepress-font-transform select',
|
||||
function() {
|
||||
control.settings['transform'].set( jQuery( this ).val() );
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
} );
|
||||
|
||||
} )( wp.customize );
|
||||
|
||||
jQuery( document ).ready( function( $ ) {
|
||||
|
||||
$( '.generatepress-font-family select' ).select2();
|
||||
|
||||
$( '.generatepress-font-variant' ).each( function( key, value ) {
|
||||
var _this = $( this );
|
||||
var value = _this.data( 'saved-value' );
|
||||
|
||||
if ( value ) {
|
||||
value = value.toString().split( ',' );
|
||||
}
|
||||
|
||||
_this.find( 'select' ).select2().val( value ).trigger( 'change.select2' );
|
||||
} );
|
||||
|
||||
$( ".generatepress-font-family" ).each( function( key, value ) {
|
||||
var _this = $( this );
|
||||
if ( $.inArray( _this.find( 'select' ).val(), typography_defaults ) !== -1 ) {
|
||||
_this.next( '.generatepress-font-variant' ).hide();
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
||||
|
@ -9,15 +9,15 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
// Controls
|
||||
// Controls.
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-range-control.php';
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-typography-control.php';
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-upsell-section.php';
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-upsell-control.php';
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-deprecated.php';
|
||||
|
||||
// Helper functions
|
||||
// Helper functions.
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'helpers.php';
|
||||
|
||||
// Deprecated
|
||||
// Deprecated.
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'deprecated.php';
|
||||
|
@ -15,24 +15,25 @@ if ( ! function_exists( 'generate_sanitize_typography' ) ) {
|
||||
*
|
||||
* @since 1.1.10
|
||||
* @deprecated 1.3.45
|
||||
* @param string $input The value to check.
|
||||
*/
|
||||
function generate_sanitize_typography( $input ) {
|
||||
// Grab all of our fonts
|
||||
// Grab all of our fonts.
|
||||
$fonts = generate_get_all_google_fonts();
|
||||
|
||||
// Loop through all of them and grab their names
|
||||
// Loop through all of them and grab their names.
|
||||
$font_names = array();
|
||||
foreach ( $fonts as $k => $fam ) {
|
||||
$font_names[] = $fam['name'];
|
||||
}
|
||||
|
||||
// Get all non-Google font names
|
||||
// Get all non-Google font names.
|
||||
$not_google = generate_typography_default_fonts();
|
||||
|
||||
// Merge them both into one array
|
||||
// Merge them both into one array.
|
||||
$valid = array_merge( $font_names, $not_google );
|
||||
|
||||
// Sanitize
|
||||
// Sanitize.
|
||||
if ( in_array( $input, $valid ) ) {
|
||||
return $input;
|
||||
} else {
|
||||
@ -47,6 +48,7 @@ if ( ! function_exists( 'generate_sanitize_font_weight' ) ) {
|
||||
*
|
||||
* @since 1.1.10
|
||||
* @deprecated 1.3.40
|
||||
* @param string $input The value to check.
|
||||
*/
|
||||
function generate_sanitize_font_weight( $input ) {
|
||||
|
||||
@ -78,6 +80,7 @@ if ( ! function_exists( 'generate_sanitize_text_transform' ) ) {
|
||||
*
|
||||
* @since 1.1.10
|
||||
* @deprecated 1.3.40
|
||||
* @param string $input The value to check.
|
||||
*/
|
||||
function generate_sanitize_text_transform( $input ) {
|
||||
|
||||
@ -86,7 +89,7 @@ if ( ! function_exists( 'generate_sanitize_text_transform' ) ) {
|
||||
'capitalize',
|
||||
'uppercase',
|
||||
'lowercase',
|
||||
);
|
||||
);
|
||||
|
||||
if ( in_array( $input, $valid ) ) {
|
||||
return $input;
|
||||
@ -99,6 +102,7 @@ if ( ! function_exists( 'generate_sanitize_text_transform' ) ) {
|
||||
if ( ! function_exists( 'generate_typography_customize_preview_css' ) ) {
|
||||
/**
|
||||
* Hide the hidden input control
|
||||
*
|
||||
* @since 1.3.40
|
||||
*/
|
||||
function generate_typography_customize_preview_css() {
|
||||
@ -109,3 +113,21 @@ if ( ! function_exists( 'generate_typography_customize_preview_css' ) ) {
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_hidden_navigation' ) && function_exists( 'is_customize_preview' ) ) {
|
||||
/**
|
||||
* Adds a hidden navigation if no navigation is set
|
||||
* This allows us to use postMessage to position the navigation when it doesn't exist
|
||||
*
|
||||
* @since 1.3.40
|
||||
*/
|
||||
function generate_hidden_navigation() {
|
||||
if ( is_customize_preview() && function_exists( 'generate_navigation_position' ) ) {
|
||||
?>
|
||||
<div style="display:none;">
|
||||
<?php generate_navigation_position(); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,25 +43,6 @@ if ( ! function_exists( 'generate_is_top_bar_active' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_hidden_navigation' ) && function_exists( 'is_customize_preview' ) ) {
|
||||
add_action( 'wp_footer', 'generate_hidden_navigation' );
|
||||
/**
|
||||
* Adds a hidden navigation if no navigation is set
|
||||
* This allows us to use postMessage to position the navigation when it doesn't exist
|
||||
*
|
||||
* @since 1.3.40
|
||||
*/
|
||||
function generate_hidden_navigation() {
|
||||
if ( is_customize_preview() && function_exists( 'generate_navigation_position' ) ) {
|
||||
?>
|
||||
<div style="display:none;">
|
||||
<?php generate_navigation_position(); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_customize_partial_blogname' ) ) {
|
||||
/**
|
||||
* Render the site title for the selective refresh partial.
|
||||
@ -92,16 +73,16 @@ if ( ! function_exists( 'generate_enqueue_color_palettes' ) ) {
|
||||
* @since 1.3.42
|
||||
*/
|
||||
function generate_enqueue_color_palettes() {
|
||||
// Old versions of WP don't get nice things
|
||||
// Old versions of WP don't get nice things.
|
||||
if ( ! function_exists( 'wp_add_inline_script' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Grab our palette array and turn it into JS
|
||||
$palettes = json_encode( generate_get_default_color_palettes() );
|
||||
// Grab our palette array and turn it into JS.
|
||||
$palettes = wp_json_encode( generate_get_default_color_palettes() );
|
||||
|
||||
// Add our custom palettes
|
||||
// json_encode takes care of escaping
|
||||
// Add our custom palettes.
|
||||
// json_encode takes care of escaping.
|
||||
wp_add_inline_script( 'wp-color-picker', 'jQuery.wp.wpColorPicker.prototype.options.palettes = ' . $palettes . ';' );
|
||||
}
|
||||
}
|
||||
@ -111,6 +92,7 @@ if ( ! function_exists( 'generate_sanitize_integer' ) ) {
|
||||
* Sanitize integers.
|
||||
*
|
||||
* @since 1.0.8
|
||||
* @param string $input The value to check.
|
||||
*/
|
||||
function generate_sanitize_integer( $input ) {
|
||||
return absint( $input );
|
||||
@ -122,6 +104,7 @@ if ( ! function_exists( 'generate_sanitize_decimal_integer' ) ) {
|
||||
* Sanitize integers that can use decimals.
|
||||
*
|
||||
* @since 1.3.41
|
||||
* @param string $input The value to check.
|
||||
*/
|
||||
function generate_sanitize_decimal_integer( $input ) {
|
||||
return abs( floatval( $input ) );
|
||||
@ -132,8 +115,10 @@ if ( ! function_exists( 'generate_sanitize_decimal_integer' ) ) {
|
||||
* Sanitize a positive number, but allow an empty value.
|
||||
*
|
||||
* @since 2.2
|
||||
* @param string $input The value to check.
|
||||
*/
|
||||
function generate_sanitize_empty_absint( $input ) {
|
||||
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose.
|
||||
if ( '' == $input ) {
|
||||
return '';
|
||||
}
|
||||
@ -146,8 +131,10 @@ if ( ! function_exists( 'generate_sanitize_checkbox' ) ) {
|
||||
* Sanitize checkbox values.
|
||||
*
|
||||
* @since 1.0.8
|
||||
* @param string $checked The value to check.
|
||||
*/
|
||||
function generate_sanitize_checkbox( $checked ) {
|
||||
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose.
|
||||
return ( ( isset( $checked ) && true == $checked ) ? true : false );
|
||||
}
|
||||
}
|
||||
@ -158,19 +145,20 @@ if ( ! function_exists( 'generate_sanitize_blog_excerpt' ) ) {
|
||||
* Needed because GP Premium calls the control ID which is different from the settings ID.
|
||||
*
|
||||
* @since 1.0.8
|
||||
* @param string $input The value to check.
|
||||
*/
|
||||
function generate_sanitize_blog_excerpt( $input ) {
|
||||
$valid = array(
|
||||
'full',
|
||||
'excerpt'
|
||||
);
|
||||
function generate_sanitize_blog_excerpt( $input ) {
|
||||
$valid = array(
|
||||
'full',
|
||||
'excerpt',
|
||||
);
|
||||
|
||||
if ( in_array( $input, $valid ) ) {
|
||||
return $input;
|
||||
} else {
|
||||
return 'full';
|
||||
}
|
||||
}
|
||||
if ( in_array( $input, $valid ) ) {
|
||||
return $input;
|
||||
} else {
|
||||
return 'full';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_sanitize_hex_color' ) ) {
|
||||
@ -179,25 +167,28 @@ if ( ! function_exists( 'generate_sanitize_hex_color' ) ) {
|
||||
* Allow blank value.
|
||||
*
|
||||
* @since 1.2.9.6
|
||||
* @param string $color The color to check.
|
||||
*/
|
||||
function generate_sanitize_hex_color( $color ) {
|
||||
if ( '' === $color ) {
|
||||
return '';
|
||||
}
|
||||
function generate_sanitize_hex_color( $color ) {
|
||||
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose.
|
||||
if ( '' === $color ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// 3 or 6 hex digits, or the empty string.
|
||||
if ( preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) {
|
||||
return $color;
|
||||
}
|
||||
// 3 or 6 hex digits, or the empty string.
|
||||
if ( preg_match( '|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) {
|
||||
return $color;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize RGBA colors.
|
||||
*
|
||||
* @since 2.2
|
||||
* @param string $color The color to check.
|
||||
*/
|
||||
function generate_sanitize_rgba_color( $color ) {
|
||||
if ( '' === $color ) {
|
||||
@ -211,7 +202,7 @@ function generate_sanitize_rgba_color( $color ) {
|
||||
$color = str_replace( ' ', '', $color );
|
||||
sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha );
|
||||
|
||||
return 'rgba('.$red.','.$green.','.$blue.','.$alpha.')';
|
||||
return 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $alpha . ')';
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_sanitize_choices' ) ) {
|
||||
@ -219,17 +210,19 @@ if ( ! function_exists( 'generate_sanitize_choices' ) ) {
|
||||
* Sanitize choices.
|
||||
*
|
||||
* @since 1.3.24
|
||||
* @param string $input The value to check.
|
||||
* @param object $setting The setting object.
|
||||
*/
|
||||
function generate_sanitize_choices( $input, $setting ) {
|
||||
// Ensure input is a slug
|
||||
// Ensure input is a slug.
|
||||
$input = sanitize_key( $input );
|
||||
|
||||
// Get list of choices from the control
|
||||
// associated with the setting
|
||||
// Get list of choices from the control.
|
||||
// associated with the setting.
|
||||
$choices = $setting->manager->get_control( $setting->id )->choices;
|
||||
|
||||
// If the input is a valid key, return it;
|
||||
// otherwise, return the default
|
||||
// If the input is a valid key, return it.
|
||||
// otherwise, return the default.
|
||||
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
|
||||
}
|
||||
}
|
||||
@ -238,6 +231,7 @@ if ( ! function_exists( 'generate_sanitize_choices' ) ) {
|
||||
* Sanitize our Google Font variants
|
||||
*
|
||||
* @since 2.0
|
||||
* @param string $input The value to check.
|
||||
*/
|
||||
function generate_sanitize_variants( $input ) {
|
||||
if ( is_array( $input ) ) {
|
||||
@ -256,9 +250,11 @@ add_action( 'customize_controls_enqueue_scripts', 'generate_do_control_inline_sc
|
||||
* @since 2.0
|
||||
*/
|
||||
function generate_do_control_inline_scripts() {
|
||||
wp_localize_script( 'generatepress-typography-customizer', 'gp_customize',
|
||||
wp_localize_script(
|
||||
'generatepress-typography-customizer',
|
||||
'gp_customize',
|
||||
array(
|
||||
'nonce' => wp_create_nonce( 'gp_customize_nonce' )
|
||||
'nonce' => wp_create_nonce( 'gp_customize_nonce' ),
|
||||
)
|
||||
);
|
||||
|
||||
@ -268,7 +264,7 @@ function generate_do_control_inline_scripts() {
|
||||
'generatepress-typography-customizer',
|
||||
'generatePressTypography',
|
||||
array(
|
||||
'googleFonts' => apply_filters( 'generate_typography_customize_list', generate_get_all_google_fonts( $number_of_fonts ) )
|
||||
'googleFonts' => apply_filters( 'generate_typography_customize_list', generate_get_all_google_fonts( $number_of_fonts ) ),
|
||||
)
|
||||
);
|
||||
|
||||
@ -277,6 +273,8 @@ function generate_do_control_inline_scripts() {
|
||||
wp_enqueue_script( 'generatepress-customizer-controls', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/customizer-controls.js', array( 'customize-controls', 'jquery' ), GENERATE_VERSION, true );
|
||||
wp_localize_script( 'generatepress-customizer-controls', 'generatepress_defaults', generate_get_defaults() );
|
||||
wp_localize_script( 'generatepress-customizer-controls', 'generatepress_color_defaults', generate_get_color_defaults() );
|
||||
wp_localize_script( 'generatepress-customizer-controls', 'generatepress_typography_defaults', generate_get_default_fonts() );
|
||||
wp_localize_script( 'generatepress-customizer-controls', 'generatepress_spacing_defaults', generate_spacing_get_defaults() );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_customizer_live_preview' ) ) {
|
||||
@ -294,13 +292,19 @@ if ( ! function_exists( 'generate_customizer_live_preview' ) ) {
|
||||
|
||||
wp_enqueue_script( 'generate-themecustomizer', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/js/customizer-live-preview.js', array( 'customize-preview' ), GENERATE_VERSION, true );
|
||||
|
||||
wp_localize_script( 'generate-themecustomizer', 'generatepress_live_preview', array(
|
||||
'mobile' => generate_get_media_query( 'mobile' ),
|
||||
'tablet' => generate_get_media_query( 'tablet' ),
|
||||
'desktop' => generate_get_media_query( 'desktop' ),
|
||||
'contentLeft' => absint( $spacing_settings['content_left'] ),
|
||||
'contentRight' => absint( $spacing_settings['content_right'] ),
|
||||
) );
|
||||
wp_localize_script(
|
||||
'generate-themecustomizer',
|
||||
'generatepress_live_preview',
|
||||
array(
|
||||
'mobile' => generate_get_media_query( 'mobile' ),
|
||||
'tablet' => generate_get_media_query( 'tablet' ),
|
||||
'desktop' => generate_get_media_query( 'desktop' ),
|
||||
'contentLeft' => absint( $spacing_settings['content_left'] ),
|
||||
'contentRight' => absint( $spacing_settings['content_right'] ),
|
||||
'isFlex' => generate_is_using_flexbox(),
|
||||
'isRTL' => is_rtl(),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -325,6 +329,20 @@ function generate_has_custom_logo_callback() {
|
||||
*
|
||||
* @since 2.2
|
||||
*/
|
||||
function generate_sanitize_preset_layout( $input ) {
|
||||
function generate_sanitize_preset_layout() {
|
||||
return 'current';
|
||||
}
|
||||
|
||||
/**
|
||||
* Display options if we're using the Floats structure.
|
||||
*/
|
||||
function generate_is_using_floats_callback() {
|
||||
return 'floats' === generate_get_option( 'structure' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to determine whether to show the inline logo option.
|
||||
*/
|
||||
function generate_show_inline_logo_callback() {
|
||||
return 'floats' === generate_get_option( 'structure' ) && generate_has_logo_site_branding();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ if ( ! function_exists( 'generate_create_menu' ) ) {
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_create_menu() {
|
||||
$generate_page = add_theme_page( 'GeneratePress', 'GeneratePress', apply_filters( 'generate_dashboard_page_capability', 'edit_theme_options' ), 'generate-options', 'generate_settings_page' );
|
||||
$generate_page = add_theme_page( esc_html__( 'GeneratePress', 'generatepress' ), esc_html__( 'GeneratePress', 'generatepress' ), apply_filters( 'generate_dashboard_page_capability', 'edit_theme_options' ), 'generate-options', 'generate_settings_page' );
|
||||
add_action( "admin_print_styles-$generate_page", 'generate_options_styles' );
|
||||
}
|
||||
}
|
||||
@ -29,7 +29,7 @@ if ( ! function_exists( 'generate_options_styles' ) ) {
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_options_styles() {
|
||||
wp_enqueue_style( 'generate-options', get_template_directory_uri() . '/css/admin/style.css', array(), GENERATE_VERSION );
|
||||
wp_enqueue_style( 'generate-options', get_template_directory_uri() . '/assets/css/admin/style.css', array(), GENERATE_VERSION );
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,14 +46,14 @@ if ( ! function_exists( 'generate_settings_page' ) ) {
|
||||
<div class="gp-masthead clearfix">
|
||||
<div class="gp-container">
|
||||
<div class="gp-title">
|
||||
<a href="<?php echo generate_get_premium_url( 'https://generatepress.com' ); // WPCS: XSS ok, sanitization ok. ?>" target="_blank">GeneratePress</a> <span class="gp-version"><?php echo GENERATE_VERSION; // WPCS: XSS ok ?></span>
|
||||
<a href="<?php echo generate_get_premium_url( 'https://generatepress.com' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in function. ?>" target="_blank">GeneratePress</a> <span class="gp-version"><?php echo esc_html( GENERATE_VERSION ); ?></span>
|
||||
</div>
|
||||
<div class="gp-masthead-links">
|
||||
<?php if ( ! defined( 'GP_PREMIUM_VERSION' ) ) : ?>
|
||||
<a style="font-weight: bold;" href="<?php echo generate_get_premium_url( 'https://generatepress.com/premium/' ); // WPCS: XSS ok, sanitization ok. ?>" target="_blank"><?php esc_html_e( 'Premium', 'generatepress' );?></a>
|
||||
<a style="font-weight: bold;" href="<?php echo generate_get_premium_url( 'https://generatepress.com/premium/' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in function. ?>" target="_blank"><?php esc_html_e( 'Premium', 'generatepress' ); ?></a>
|
||||
<?php endif; ?>
|
||||
<a href="<?php echo esc_url( 'https://generatepress.com/support' ); ?>" target="_blank"><?php esc_html_e( 'Support', 'generatepress' ); ?></a>
|
||||
<a href="<?php echo esc_url( 'https://docs.generatepress.com' ); ?>" target="_blank"><?php esc_html_e( 'Documentation', 'generatepress' );?></a>
|
||||
<a href="<?php echo esc_url( 'https://docs.generatepress.com' ); ?>" target="_blank"><?php esc_html_e( 'Documentation', 'generatepress' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -87,7 +87,8 @@ if ( ! function_exists( 'generate_settings_page' ) ) {
|
||||
<?php do_settings_sections( 'generate-settings-group' ); ?>
|
||||
<div class="customize-button hide-on-desktop">
|
||||
<?php
|
||||
printf( '<a id="generate_customize_button" class="button button-primary" href="%1$s">%2$s</a>',
|
||||
printf(
|
||||
'<a id="generate_customize_button" class="button button-primary" href="%1$s">%2$s</a>',
|
||||
esc_url( admin_url( 'customize.php' ) ),
|
||||
esc_html__( 'Customize', 'generatepress' )
|
||||
);
|
||||
@ -107,69 +108,72 @@ if ( ! function_exists( 'generate_settings_page' ) ) {
|
||||
<?php
|
||||
$modules = array(
|
||||
'Backgrounds' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#backgrounds', false ),
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#backgrounds', false ),
|
||||
),
|
||||
'Blog' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#blog', false ),
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#blog', false ),
|
||||
),
|
||||
'Colors' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#colors', false ),
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#colors', false ),
|
||||
),
|
||||
'Copyright' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#copyright', false ),
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#copyright', false ),
|
||||
),
|
||||
'Disable Elements' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#disable-elements', false ),
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#disable-elements', false ),
|
||||
),
|
||||
'Elements' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#elements', false ),
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#elements', false ),
|
||||
),
|
||||
'Import / Export' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#import-export', false ),
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#import-export', false ),
|
||||
),
|
||||
'Menu Plus' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#menu-plus', false ),
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#menu-plus', false ),
|
||||
),
|
||||
'Secondary Nav' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#secondary-nav', false ),
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#secondary-nav', false ),
|
||||
),
|
||||
'Sections' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#sections', false ),
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#sections', false ),
|
||||
),
|
||||
'Site Library' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/site-library', false ),
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/site-library', false ),
|
||||
),
|
||||
'Spacing' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#spacing', false ),
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#spacing', false ),
|
||||
),
|
||||
'Typography' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#typography', false ),
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#typography', false ),
|
||||
),
|
||||
'WooCommerce' => array(
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#woocommerce', false ),
|
||||
'url' => generate_get_premium_url( 'https://generatepress.com/premium/#woocommerce', false ),
|
||||
),
|
||||
);
|
||||
|
||||
if ( ! defined( 'GP_PREMIUM_VERSION' ) ) : ?>
|
||||
if ( ! defined( 'GP_PREMIUM_VERSION' ) ) :
|
||||
?>
|
||||
<div class="postbox generate-metabox">
|
||||
<h3 class="hndle"><?php esc_html_e( 'Premium Modules', 'generatepress' ); ?></h3>
|
||||
<div class="inside" style="margin:0;padding:0;">
|
||||
<div class="premium-addons">
|
||||
<?php foreach( $modules as $module => $info ) { ?>
|
||||
<div class="add-on activated gp-clear addon-container grid-parent">
|
||||
<div class="addon-name column-addon-name" style="">
|
||||
<a href="<?php echo esc_url( $info['url'] ); ?>" target="_blank"><?php echo esc_html( $module ); ?></a>
|
||||
<?php
|
||||
foreach ( $modules as $module => $info ) {
|
||||
?>
|
||||
<div class="add-on activated gp-clear addon-container grid-parent">
|
||||
<div class="addon-name column-addon-name" style="">
|
||||
<a href="<?php echo esc_url( $info['url'] ); ?>" target="_blank"><?php echo esc_html( $module ); ?></a>
|
||||
</div>
|
||||
<div class="addon-action addon-addon-action" style="text-align:right;">
|
||||
<a href="<?php echo esc_url( $info['url'] ); ?>" target="_blank"><?php esc_html_e( 'Learn more', 'generatepress' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="addon-action addon-addon-action" style="text-align:right;">
|
||||
<a href="<?php echo esc_url( $info['url'] ); ?>" target="_blank"><?php esc_html_e( 'Learn more', 'generatepress' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gp-clear"></div>
|
||||
<div class="gp-clear"></div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
<?php
|
||||
endif;
|
||||
|
||||
/**
|
||||
@ -254,7 +258,7 @@ if ( ! function_exists( 'generate_settings_page' ) ) {
|
||||
?>
|
||||
|
||||
<div class="postbox generate-metabox" id="gen-delete">
|
||||
<h3 class="hndle"><?php esc_html_e( 'Reset Settings', 'generatepress' );?></h3>
|
||||
<h3 class="hndle"><?php esc_html_e( 'Reset Settings', 'generatepress' ); ?></h3>
|
||||
<div class="inside">
|
||||
<p><?php esc_html_e( 'Deleting your settings can not be undone.', 'generatepress' ); ?></p>
|
||||
<form method="post">
|
||||
@ -263,9 +267,14 @@ if ( ! function_exists( 'generate_settings_page' ) ) {
|
||||
<?php
|
||||
$warning = 'return confirm("' . esc_html__( 'Warning: This will delete your settings.', 'generatepress' ) . '")';
|
||||
wp_nonce_field( 'generate_reset_customizer_nonce', 'generate_reset_customizer_nonce' );
|
||||
submit_button( esc_attr__( 'Reset', 'generatepress' ), 'button-primary', 'submit', false,
|
||||
|
||||
submit_button(
|
||||
esc_attr__( 'Reset', 'generatepress' ),
|
||||
'button-primary',
|
||||
'submit',
|
||||
false,
|
||||
array(
|
||||
'onclick' => esc_js( $warning )
|
||||
'onclick' => esc_js( $warning ),
|
||||
)
|
||||
);
|
||||
?>
|
||||
@ -288,7 +297,7 @@ if ( ! function_exists( 'generate_settings_page' ) ) {
|
||||
<div class="gp-options-footer">
|
||||
<span>
|
||||
<?php
|
||||
printf( // WPCS: XSS ok
|
||||
printf(
|
||||
/* translators: %s: Heart icon */
|
||||
_x( 'Made with %s by Tom Usborne', 'made with love', 'generatepress' ),
|
||||
'<span style="color:#D04848" class="dashicons dashicons-heart"></span>'
|
||||
@ -350,16 +359,18 @@ if ( ! function_exists( 'generate_admin_errors' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isset( $_GET['settings-updated'] ) && 'true' == $_GET['settings-updated'] ) {
|
||||
add_settings_error( 'generate-notices', 'true', esc_html__( 'Settings saved.', 'generatepress' ), 'updated' );
|
||||
if ( isset( $_GET['settings-updated'] ) && 'true' === $_GET['settings-updated'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only checking. False positive.
|
||||
add_settings_error( 'generate-notices', 'true', esc_html__( 'Settings saved.', 'generatepress' ), 'updated' );
|
||||
}
|
||||
|
||||
if ( isset( $_GET['status'] ) && 'imported' == $_GET['status'] ) {
|
||||
add_settings_error( 'generate-notices', 'imported', esc_html__( 'Import successful.', 'generatepress' ), 'updated' );
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only checking. False positive.
|
||||
if ( isset( $_GET['status'] ) && 'imported' === $_GET['status'] ) {
|
||||
add_settings_error( 'generate-notices', 'imported', esc_html__( 'Import successful.', 'generatepress' ), 'updated' );
|
||||
}
|
||||
|
||||
if ( isset( $_GET['status'] ) && 'reset' == $_GET['status'] ) {
|
||||
add_settings_error( 'generate-notices', 'reset', esc_html__( 'Settings removed.', 'generatepress' ), 'updated' );
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only checking. False positive.
|
||||
if ( isset( $_GET['status'] ) && 'reset' === $_GET['status'] ) {
|
||||
add_settings_error( 'generate-notices', 'reset', esc_html__( 'Settings removed.', 'generatepress' ), 'updated' );
|
||||
}
|
||||
|
||||
settings_errors( 'generate-notices' );
|
||||
|
@ -16,10 +16,11 @@ if ( ! function_exists( 'generate_get_defaults' ) ) {
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_get_defaults() {
|
||||
return apply_filters( 'generate_option_defaults',
|
||||
return apply_filters(
|
||||
'generate_option_defaults',
|
||||
array(
|
||||
'hide_title' => '',
|
||||
'hide_tagline' => '',
|
||||
'hide_tagline' => true,
|
||||
'logo' => '',
|
||||
'inline_logo_site_branding' => false,
|
||||
'retina_logo' => '',
|
||||
@ -27,18 +28,18 @@ if ( ! function_exists( 'generate_get_defaults' ) ) {
|
||||
'top_bar_width' => 'full',
|
||||
'top_bar_inner_width' => 'contained',
|
||||
'top_bar_alignment' => 'right',
|
||||
'container_width' => '1100',
|
||||
'container_alignment' => 'boxes',
|
||||
'container_width' => '1200',
|
||||
'container_alignment' => 'text',
|
||||
'header_layout_setting' => 'fluid-header',
|
||||
'header_inner_width' => 'contained',
|
||||
'nav_alignment_setting' => ( is_rtl() ) ? 'right' : 'left',
|
||||
'header_alignment_setting' => ( is_rtl() ) ? 'right' : 'left',
|
||||
'nav_alignment_setting' => is_rtl() ? 'right' : 'left',
|
||||
'header_alignment_setting' => is_rtl() ? 'right' : 'left',
|
||||
'nav_layout_setting' => 'fluid-nav',
|
||||
'nav_inner_width' => 'contained',
|
||||
'nav_position_setting' => 'nav-below-header',
|
||||
'nav_position_setting' => 'nav-float-right',
|
||||
'nav_drop_point' => '',
|
||||
'nav_dropdown_type' => 'hover',
|
||||
'nav_dropdown_direction' => 'right',
|
||||
'nav_dropdown_direction' => is_rtl() ? 'left' : 'right',
|
||||
'nav_search' => 'disable',
|
||||
'content_layout_setting' => 'separate-containers',
|
||||
'layout_setting' => 'right-sidebar',
|
||||
@ -50,15 +51,16 @@ if ( ! function_exists( 'generate_get_defaults' ) ) {
|
||||
'footer_widget_setting' => '3',
|
||||
'footer_bar_alignment' => 'right',
|
||||
'back_to_top' => '',
|
||||
'background_color' => '#efefef',
|
||||
'text_color' => '#3a3a3a',
|
||||
'background_color' => '#f7f8f9',
|
||||
'text_color' => '#222222',
|
||||
'link_color' => '#1e73be',
|
||||
'link_color_hover' => '#000000',
|
||||
'link_color_visited' => '',
|
||||
'font_awesome_essentials' => true,
|
||||
'icons' => 'font',
|
||||
'icons' => 'svg',
|
||||
'combine_css' => true,
|
||||
'dynamic_css_cache' => true,
|
||||
'structure' => 'flexbox',
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -69,30 +71,31 @@ if ( ! function_exists( 'generate_get_color_defaults' ) ) {
|
||||
* Set default options
|
||||
*/
|
||||
function generate_get_color_defaults() {
|
||||
return apply_filters( 'generate_color_option_defaults',
|
||||
return apply_filters(
|
||||
'generate_color_option_defaults',
|
||||
array(
|
||||
'top_bar_background_color' => '#636363',
|
||||
'top_bar_text_color' => '#ffffff',
|
||||
'top_bar_link_color' => '#ffffff',
|
||||
'top_bar_link_color_hover' => '#303030',
|
||||
'header_background_color' => '#ffffff',
|
||||
'header_text_color' => '#3a3a3a',
|
||||
'header_link_color' => '#3a3a3a',
|
||||
'header_text_color' => '',
|
||||
'header_link_color' => '',
|
||||
'header_link_hover_color' => '',
|
||||
'site_title_color' => '#222222',
|
||||
'site_tagline_color' => '#757575',
|
||||
'navigation_background_color' => '#222222',
|
||||
'navigation_text_color' => '#ffffff',
|
||||
'navigation_background_hover_color' => '#3f3f3f',
|
||||
'navigation_text_hover_color' => '#ffffff',
|
||||
'navigation_background_current_color' => '#3f3f3f',
|
||||
'navigation_text_current_color' => '#ffffff',
|
||||
'subnavigation_background_color' => '#3f3f3f',
|
||||
'subnavigation_text_color' => '#ffffff',
|
||||
'subnavigation_background_hover_color' => '#4f4f4f',
|
||||
'subnavigation_text_hover_color' => '#ffffff',
|
||||
'subnavigation_background_current_color' => '#4f4f4f',
|
||||
'subnavigation_text_current_color' => '#ffffff',
|
||||
'navigation_background_color' => '#ffffff',
|
||||
'navigation_text_color' => '#515151',
|
||||
'navigation_background_hover_color' => '#ffffff',
|
||||
'navigation_text_hover_color' => '#7a8896',
|
||||
'navigation_background_current_color' => '#ffffff',
|
||||
'navigation_text_current_color' => '#7a8896',
|
||||
'subnavigation_background_color' => '#eaeaea',
|
||||
'subnavigation_text_color' => '#515151',
|
||||
'subnavigation_background_hover_color' => '#eaeaea',
|
||||
'subnavigation_text_hover_color' => '#7a8896',
|
||||
'subnavigation_background_current_color' => '#eaeaea',
|
||||
'subnavigation_text_current_color' => '#7a8896',
|
||||
'navigation_search_background_color' => '',
|
||||
'navigation_search_text_color' => '',
|
||||
'content_background_color' => '#ffffff',
|
||||
@ -100,11 +103,11 @@ if ( ! function_exists( 'generate_get_color_defaults' ) ) {
|
||||
'content_link_color' => '',
|
||||
'content_link_hover_color' => '',
|
||||
'content_title_color' => '',
|
||||
'blog_post_title_color' => '',
|
||||
'blog_post_title_hover_color' => '',
|
||||
'blog_post_title_color' => '#222222',
|
||||
'blog_post_title_hover_color' => '#55555e',
|
||||
'entry_meta_text_color' => '#595959',
|
||||
'entry_meta_link_color' => '#595959',
|
||||
'entry_meta_link_color_hover' => '#1e73be',
|
||||
'entry_meta_link_color' => '',
|
||||
'entry_meta_link_color_hover' => '',
|
||||
'h1_color' => '',
|
||||
'h2_color' => '',
|
||||
'h3_color' => '',
|
||||
@ -115,24 +118,24 @@ if ( ! function_exists( 'generate_get_color_defaults' ) ) {
|
||||
'sidebar_widget_text_color' => '',
|
||||
'sidebar_widget_link_color' => '',
|
||||
'sidebar_widget_link_hover_color' => '',
|
||||
'sidebar_widget_title_color' => '#000000',
|
||||
'sidebar_widget_title_color' => '',
|
||||
'footer_widget_background_color' => '#ffffff',
|
||||
'footer_widget_text_color' => '',
|
||||
'footer_widget_link_color' => '',
|
||||
'footer_widget_link_hover_color' => '',
|
||||
'footer_widget_title_color' => '#000000',
|
||||
'footer_background_color' => '#222222',
|
||||
'footer_background_color' => '#55555e',
|
||||
'footer_text_color' => '#ffffff',
|
||||
'footer_link_color' => '#ffffff',
|
||||
'footer_link_hover_color' => '#606060',
|
||||
'footer_link_hover_color' => '#d3d3d3',
|
||||
'form_background_color' => '#fafafa',
|
||||
'form_text_color' => '#666666',
|
||||
'form_background_color_focus' => '#ffffff',
|
||||
'form_text_color_focus' => '#666666',
|
||||
'form_border_color' => '#cccccc',
|
||||
'form_border_color_focus' => '#bfbfbf',
|
||||
'form_button_background_color' => '#666666',
|
||||
'form_button_background_color_hover' => '#3f3f3f',
|
||||
'form_button_background_color' => '#55555e',
|
||||
'form_button_background_color_hover' => '#3f4047',
|
||||
'form_button_text_color' => '#ffffff',
|
||||
'form_button_text_color_hover' => '#ffffff',
|
||||
'back_to_top_background_color' => 'rgba( 0,0,0,0.4 )',
|
||||
@ -161,8 +164,8 @@ if ( ! function_exists( 'generate_get_default_fonts' ) ) {
|
||||
'body_font_weight' => 'normal',
|
||||
'body_font_transform' => 'none',
|
||||
'body_font_size' => '17',
|
||||
'body_line_height' => '1.5', // no unit
|
||||
'paragraph_margin' => '1.5', // em
|
||||
'body_line_height' => '1.5', // no unit.
|
||||
'paragraph_margin' => '1.5', // em.
|
||||
'font_top_bar' => 'inherit',
|
||||
'font_top_bar_category' => '',
|
||||
'font_top_bar_variants' => '',
|
||||
@ -174,8 +177,8 @@ if ( ! function_exists( 'generate_get_default_fonts' ) ) {
|
||||
'font_site_title_variants' => '',
|
||||
'site_title_font_weight' => 'bold',
|
||||
'site_title_font_transform' => 'none',
|
||||
'site_title_font_size' => '45',
|
||||
'mobile_site_title_font_size' => '30',
|
||||
'site_title_font_size' => '25',
|
||||
'mobile_site_title_font_size' => '',
|
||||
'font_site_tagline' => 'inherit',
|
||||
'font_site_tagline_category' => '',
|
||||
'font_site_tagline_variants' => '',
|
||||
@ -205,50 +208,53 @@ if ( ! function_exists( 'generate_get_default_fonts' ) ) {
|
||||
'font_heading_1' => 'inherit',
|
||||
'font_heading_1_category' => '',
|
||||
'font_heading_1_variants' => '',
|
||||
'heading_1_weight' => '300',
|
||||
'heading_1_weight' => 'normal',
|
||||
'heading_1_transform' => 'none',
|
||||
'heading_1_font_size' => '40',
|
||||
'heading_1_line_height' => '1.2', // em
|
||||
'heading_1_font_size' => '42',
|
||||
'heading_1_line_height' => '1.2', // em.
|
||||
'heading_1_margin_bottom' => '20',
|
||||
'mobile_heading_1_font_size' => '30',
|
||||
'mobile_heading_1_font_size' => '31',
|
||||
'font_heading_2' => 'inherit',
|
||||
'font_heading_2_category' => '',
|
||||
'font_heading_2_variants' => '',
|
||||
'heading_2_weight' => '300',
|
||||
'heading_2_weight' => 'normal',
|
||||
'heading_2_transform' => 'none',
|
||||
'heading_2_font_size' => '30',
|
||||
'heading_2_line_height' => '1.2', // em
|
||||
'heading_2_font_size' => '35',
|
||||
'heading_2_line_height' => '1.2', // em.
|
||||
'heading_2_margin_bottom' => '20',
|
||||
'mobile_heading_2_font_size' => '25',
|
||||
'mobile_heading_2_font_size' => '27',
|
||||
'font_heading_3' => 'inherit',
|
||||
'font_heading_3_category' => '',
|
||||
'font_heading_3_variants' => '',
|
||||
'heading_3_weight' => 'normal',
|
||||
'heading_3_transform' => 'none',
|
||||
'heading_3_font_size' => '20',
|
||||
'heading_3_line_height' => '1.2', // em
|
||||
'heading_3_font_size' => '29',
|
||||
'heading_3_line_height' => '1.2', // em.
|
||||
'heading_3_margin_bottom' => '20',
|
||||
'mobile_heading_3_font_size' => '24',
|
||||
'font_heading_4' => 'inherit',
|
||||
'font_heading_4_category' => '',
|
||||
'font_heading_4_variants' => '',
|
||||
'heading_4_weight' => 'normal',
|
||||
'heading_4_transform' => 'none',
|
||||
'heading_4_font_size' => '',
|
||||
'heading_4_line_height' => '', // em
|
||||
'heading_4_font_size' => '24',
|
||||
'heading_4_line_height' => '', // em.
|
||||
'mobile_heading_4_font_size' => '22',
|
||||
'font_heading_5' => 'inherit',
|
||||
'font_heading_5_category' => '',
|
||||
'font_heading_5_variants' => '',
|
||||
'heading_5_weight' => 'normal',
|
||||
'heading_5_transform' => 'none',
|
||||
'heading_5_font_size' => '',
|
||||
'heading_5_line_height' => '', // em
|
||||
'heading_5_font_size' => '20',
|
||||
'heading_5_line_height' => '', // em.
|
||||
'mobile_heading_5_font_size' => '19',
|
||||
'font_heading_6' => 'inherit',
|
||||
'font_heading_6_category' => '',
|
||||
'font_heading_6_variants' => '',
|
||||
'heading_6_weight' => 'normal',
|
||||
'heading_6_transform' => 'none',
|
||||
'heading_6_font_size' => '',
|
||||
'heading_6_line_height' => '', // em
|
||||
'heading_6_line_height' => '', // em.
|
||||
'font_footer' => 'inherit',
|
||||
'font_footer_category' => '',
|
||||
'font_footer_variants' => '',
|
||||
@ -277,12 +283,16 @@ if ( ! function_exists( 'generate_spacing_get_defaults' ) ) {
|
||||
function generate_spacing_get_defaults( $filter = true ) {
|
||||
$defaults = array(
|
||||
'top_bar_top' => '10',
|
||||
'top_bar_right' => '10',
|
||||
'top_bar_right' => '40',
|
||||
'top_bar_bottom' => '10',
|
||||
'top_bar_left' => '10',
|
||||
'header_top' => '40',
|
||||
'top_bar_left' => '40',
|
||||
'mobile_top_bar_top' => '',
|
||||
'mobile_top_bar_right' => '30',
|
||||
'mobile_top_bar_bottom' => '',
|
||||
'mobile_top_bar_left' => '30',
|
||||
'header_top' => '20',
|
||||
'header_right' => '40',
|
||||
'header_bottom' => '40',
|
||||
'header_bottom' => '20',
|
||||
'header_left' => '40',
|
||||
'menu_item' => '20',
|
||||
'menu_item_height' => '60',
|
||||
@ -298,8 +308,8 @@ if ( ! function_exists( 'generate_spacing_get_defaults' ) ) {
|
||||
'mobile_content_left' => '30',
|
||||
'separator' => '20',
|
||||
'mobile_separator' => '',
|
||||
'left_sidebar_width' => '25',
|
||||
'right_sidebar_width' => '25',
|
||||
'left_sidebar_width' => '30',
|
||||
'right_sidebar_width' => '30',
|
||||
'widget_top' => '40',
|
||||
'widget_right' => '40',
|
||||
'widget_bottom' => '40',
|
||||
@ -310,9 +320,13 @@ if ( ! function_exists( 'generate_spacing_get_defaults' ) ) {
|
||||
'footer_widget_container_left' => '40',
|
||||
'footer_widget_separator' => '40',
|
||||
'footer_top' => '20',
|
||||
'footer_right' => '20',
|
||||
'footer_right' => '40',
|
||||
'footer_bottom' => '20',
|
||||
'footer_left' => '20',
|
||||
'footer_left' => '40',
|
||||
'mobile_footer_top' => '',
|
||||
'mobile_footer_right' => '30',
|
||||
'mobile_footer_bottom' => '',
|
||||
'mobile_footer_left' => '30',
|
||||
);
|
||||
|
||||
if ( $filter ) {
|
||||
|
@ -9,24 +9,28 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
// Deprecated constants
|
||||
// Deprecated constants.
|
||||
define( 'GENERATE_URI', get_template_directory_uri() );
|
||||
define( 'GENERATE_DIR', get_template_directory() );
|
||||
|
||||
if ( ! function_exists( 'generate_paging_nav' ) ) {
|
||||
/**
|
||||
* Build the pagination links
|
||||
*
|
||||
* @since 1.3.35
|
||||
* @deprecated 1.3.45
|
||||
*/
|
||||
function generate_paging_nav() {
|
||||
_deprecated_function( __FUNCTION__, '1.3.45', 'the_posts_navigation()' );
|
||||
|
||||
if ( function_exists( 'the_posts_pagination' ) ) {
|
||||
the_posts_pagination( array(
|
||||
'mid_size' => apply_filters( 'generate_pagination_mid_size', 1 ),
|
||||
'prev_text' => __( '← Previous', 'generatepress' ),
|
||||
'next_text' => __( 'Next →', 'generatepress' )
|
||||
) );
|
||||
the_posts_pagination(
|
||||
array(
|
||||
'mid_size' => apply_filters( 'generate_pagination_mid_size', 1 ),
|
||||
'prev_text' => __( '← Previous', 'generatepress' ),
|
||||
'next_text' => __( 'Next →', 'generatepress' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -34,26 +38,29 @@ if ( ! function_exists( 'generate_paging_nav' ) ) {
|
||||
if ( ! function_exists( 'generate_additional_spacing' ) ) {
|
||||
/**
|
||||
* Add fallback CSS for our mobile search icon color
|
||||
*
|
||||
* @deprecated 1.3.47
|
||||
*/
|
||||
function generate_additional_spacing() {
|
||||
// No longer needed
|
||||
// No longer needed.
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_mobile_search_spacing_fallback_css' ) ) {
|
||||
/**
|
||||
* Enqueue our mobile search icon color fallback CSS
|
||||
*
|
||||
* @deprecated 1.3.47
|
||||
*/
|
||||
function generate_mobile_search_spacing_fallback_css() {
|
||||
// No longer needed
|
||||
// No longer needed.
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_addons_available' ) ) {
|
||||
/**
|
||||
* Check to see if there's any addons not already activated
|
||||
*
|
||||
* @since 1.0.9
|
||||
* @deprecated 1.3.47
|
||||
*/
|
||||
@ -67,6 +74,7 @@ if ( ! function_exists( 'generate_addons_available' ) ) {
|
||||
if ( ! function_exists( 'generate_no_addons' ) ) {
|
||||
/**
|
||||
* Check to see if no addons are activated
|
||||
*
|
||||
* @since 1.0.9
|
||||
* @deprecated 1.3.47
|
||||
*/
|
||||
@ -80,6 +88,7 @@ if ( ! function_exists( 'generate_no_addons' ) ) {
|
||||
if ( ! function_exists( 'generate_get_min_suffix' ) ) {
|
||||
/**
|
||||
* Figure out if we should use minified scripts or not
|
||||
*
|
||||
* @since 1.3.29
|
||||
* @deprecated 2.0
|
||||
*/
|
||||
@ -89,96 +98,192 @@ if ( ! function_exists( 'generate_get_min_suffix' ) ) {
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_add_layout_meta_box' ) ) {
|
||||
/**
|
||||
* Add layout metabox.
|
||||
*
|
||||
* @since 0.1
|
||||
* @deprecated 2.0
|
||||
*/
|
||||
function generate_add_layout_meta_box() {
|
||||
_deprecated_function( __FUNCTION__, '2.0', 'generate_register_layout_meta_box()' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_show_layout_meta_box' ) ) {
|
||||
/**
|
||||
* Show layout metabox.
|
||||
*
|
||||
* @since 0.1
|
||||
* @deprecated 2.0
|
||||
*/
|
||||
function generate_show_layout_meta_box() {
|
||||
_deprecated_function( __FUNCTION__, '2.0', 'generate_do_layout_meta_box()' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_save_layout_meta' ) ) {
|
||||
/**
|
||||
* Save layout metabox.
|
||||
*
|
||||
* @since 0.1
|
||||
* @deprecated 2.0
|
||||
*/
|
||||
function generate_save_layout_meta() {
|
||||
_deprecated_function( __FUNCTION__, '2.0', 'generate_save_layout_meta_data()' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_add_footer_widget_meta_box' ) ) {
|
||||
/**
|
||||
* Add footer widget metabox.
|
||||
*
|
||||
* @since 0.1
|
||||
* @deprecated 2.0
|
||||
*/
|
||||
function generate_add_footer_widget_meta_box() {
|
||||
_deprecated_function( __FUNCTION__, '2.0', 'generate_register_layout_meta_box()' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_show_footer_widget_meta_box' ) ) {
|
||||
/**
|
||||
* Show footer widget metabox.
|
||||
*
|
||||
* @since 0.1
|
||||
* @deprecated 2.0
|
||||
*/
|
||||
function generate_show_footer_widget_meta_box() {
|
||||
_deprecated_function( __FUNCTION__, '2.0', 'generate_do_layout_meta_box()' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_save_footer_widget_meta' ) ) {
|
||||
/**
|
||||
* Save footer widget metabox.
|
||||
*
|
||||
* @since 0.1
|
||||
* @deprecated 2.0
|
||||
*/
|
||||
function generate_save_footer_widget_meta() {
|
||||
_deprecated_function( __FUNCTION__, '2.0', 'generate_save_layout_meta_data()' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_add_page_builder_meta_box' ) ) {
|
||||
/**
|
||||
* Add page builder metabox.
|
||||
*
|
||||
* @since 0.1
|
||||
* @deprecated 2.0
|
||||
*/
|
||||
function generate_add_page_builder_meta_box() {
|
||||
_deprecated_function( __FUNCTION__, '2.0', 'generate_register_layout_meta_box()' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_show_page_builder_meta_box' ) ) {
|
||||
/**
|
||||
* Show page builder metabox.
|
||||
*
|
||||
* @since 0.1
|
||||
* @deprecated 2.0
|
||||
*/
|
||||
function generate_show_page_builder_meta_box() {
|
||||
_deprecated_function( __FUNCTION__, '2.0', 'generate_do_layout_meta_box()' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_save_page_builder_meta' ) ) {
|
||||
/**
|
||||
* Save page builder metabox.
|
||||
*
|
||||
* @since 0.1
|
||||
* @deprecated 2.0
|
||||
*/
|
||||
function generate_save_page_builder_meta() {
|
||||
_deprecated_function( __FUNCTION__, '2.0', 'generate_save_layout_meta_data()' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_add_de_meta_box' ) ) {
|
||||
/**
|
||||
* Add disable elements metabox.
|
||||
*
|
||||
* @since 0.1
|
||||
* @deprecated 2.0
|
||||
*/
|
||||
function generate_add_de_meta_box() {
|
||||
_deprecated_function( __FUNCTION__, '2.0', 'generate_register_layout_meta_box()' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_show_de_meta_box' ) ) {
|
||||
/**
|
||||
* Show disable elements metabox.
|
||||
*
|
||||
* @since 0.1
|
||||
* @deprecated 2.0
|
||||
*/
|
||||
function generate_show_de_meta_box() {
|
||||
_deprecated_function( __FUNCTION__, '2.0', 'generate_do_layout_meta_box()' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_save_de_meta' ) ) {
|
||||
/**
|
||||
* Save disable elements metabox.
|
||||
*
|
||||
* @since 0.1
|
||||
* @deprecated 2.0
|
||||
*/
|
||||
function generate_save_de_meta() {
|
||||
_deprecated_function( __FUNCTION__, '2.0', 'generate_save_layout_meta_data()' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_add_base_inline_css' ) ) {
|
||||
/**
|
||||
* Add base inline CSS.
|
||||
*
|
||||
* @since 0.1
|
||||
* @deprecated 2.0
|
||||
*/
|
||||
function generate_add_base_inline_css() {
|
||||
_deprecated_function( __FUNCTION__, '2.0', 'generate_enqueue_dynamic_css()' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_color_scripts' ) ) {
|
||||
/**
|
||||
* Enqueue base colors inline CSS.
|
||||
*
|
||||
* @since 0.1
|
||||
* @deprecated 2.0
|
||||
*/
|
||||
function generate_color_scripts() {
|
||||
_deprecated_function( __FUNCTION__, '2.0', 'generate_enqueue_dynamic_css()' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_typography_scripts' ) ) {
|
||||
/**
|
||||
* Enqueue typography CSS.
|
||||
*
|
||||
* @since 0.1
|
||||
* @deprecated 2.0
|
||||
*/
|
||||
function generate_typography_scripts() {
|
||||
_deprecated_function( __FUNCTION__, '2.0', 'generate_enqueue_dynamic_css()' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_spacing_scripts' ) ) {
|
||||
/**
|
||||
* Enqueue spacing CSS.
|
||||
*
|
||||
* @since 0.1
|
||||
* @deprecated 2.0
|
||||
*/
|
||||
function generate_spacing_scripts() {
|
||||
_deprecated_function( __FUNCTION__, '2.0', 'generate_enqueue_dynamic_css()' );
|
||||
}
|
||||
@ -190,7 +295,7 @@ if ( ! function_exists( 'generate_get_setting' ) ) {
|
||||
*
|
||||
* @since 1.3.40
|
||||
*
|
||||
* @param string $option The option name to look up.
|
||||
* @param string $setting The option name to look up.
|
||||
* @return string The option value.
|
||||
* @todo Ability to specify different option name and defaults.
|
||||
*/
|
||||
@ -206,8 +311,8 @@ if ( ! function_exists( 'generate_right_sidebar_class' ) ) {
|
||||
* @param string|array $class One or more classes to add to the class list.
|
||||
*/
|
||||
function generate_right_sidebar_class( $class = '' ) {
|
||||
// Separates classes with a single space, collates classes for post DIV
|
||||
echo 'class="' . join( ' ', generate_get_right_sidebar_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
|
||||
// Separates classes with a single space, collates classes for post DIV.
|
||||
echo 'class="' . join( ' ', generate_get_right_sidebar_class( $class ) ) . '"'; // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
@ -245,8 +350,8 @@ if ( ! function_exists( 'generate_left_sidebar_class' ) ) {
|
||||
* @param string|array $class One or more classes to add to the class list.
|
||||
*/
|
||||
function generate_left_sidebar_class( $class = '' ) {
|
||||
// Separates classes with a single space, collates classes for post DIV
|
||||
echo 'class="' . join( ' ', generate_get_left_sidebar_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
|
||||
// Separates classes with a single space, collates classes for post DIV.
|
||||
echo 'class="' . join( ' ', generate_get_left_sidebar_class( $class ) ) . '"'; // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,8 +389,8 @@ if ( ! function_exists( 'generate_content_class' ) ) {
|
||||
* @param string|array $class One or more classes to add to the class list.
|
||||
*/
|
||||
function generate_content_class( $class = '' ) {
|
||||
// Separates classes with a single space, collates classes for post DIV
|
||||
echo 'class="' . join( ' ', generate_get_content_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
|
||||
// Separates classes with a single space, collates classes for post DIV.
|
||||
echo 'class="' . join( ' ', generate_get_content_class( $class ) ) . '"'; // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
@ -323,8 +428,8 @@ if ( ! function_exists( 'generate_header_class' ) ) {
|
||||
* @param string|array $class One or more classes to add to the class list.
|
||||
*/
|
||||
function generate_header_class( $class = '' ) {
|
||||
// Separates classes with a single space, collates classes for post DIV
|
||||
echo 'class="' . join( ' ', generate_get_header_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
|
||||
// Separates classes with a single space, collates classes for post DIV.
|
||||
echo 'class="' . join( ' ', generate_get_header_class( $class ) ) . '"'; // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
@ -362,8 +467,8 @@ if ( ! function_exists( 'generate_inside_header_class' ) ) {
|
||||
* @param string|array $class One or more classes to add to the class list.
|
||||
*/
|
||||
function generate_inside_header_class( $class = '' ) {
|
||||
// Separates classes with a single space, collates classes for post DIV
|
||||
echo 'class="' . join( ' ', generate_get_inside_header_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
|
||||
// Separates classes with a single space, collates classes for post DIV.
|
||||
echo 'class="' . join( ' ', generate_get_inside_header_class( $class ) ) . '"'; // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
@ -401,8 +506,8 @@ if ( ! function_exists( 'generate_container_class' ) ) {
|
||||
* @param string|array $class One or more classes to add to the class list.
|
||||
*/
|
||||
function generate_container_class( $class = '' ) {
|
||||
// Separates classes with a single space, collates classes for post DIV
|
||||
echo 'class="' . join( ' ', generate_get_container_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
|
||||
// Separates classes with a single space, collates classes for post DIV.
|
||||
echo 'class="' . join( ' ', generate_get_container_class( $class ) ) . '"'; // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
@ -440,8 +545,8 @@ if ( ! function_exists( 'generate_navigation_class' ) ) {
|
||||
* @param string|array $class One or more classes to add to the class list.
|
||||
*/
|
||||
function generate_navigation_class( $class = '' ) {
|
||||
// Separates classes with a single space, collates classes for post DIV
|
||||
echo 'class="' . join( ' ', generate_get_navigation_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
|
||||
// Separates classes with a single space, collates classes for post DIV.
|
||||
echo 'class="' . join( ' ', generate_get_navigation_class( $class ) ) . '"'; // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
@ -493,8 +598,8 @@ if ( ! function_exists( 'generate_inside_navigation_class' ) ) {
|
||||
|
||||
$return = apply_filters( 'generate_inside_navigation_class', $classes, $class );
|
||||
|
||||
// Separates classes with a single space, collates classes for post DIV
|
||||
echo 'class="' . join( ' ', $return ) . '"'; // WPCS: XSS ok, sanitization ok.
|
||||
// Separates classes with a single space, collates classes for post DIV.
|
||||
echo 'class="' . join( ' ', $return ) . '"'; // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
@ -506,8 +611,8 @@ if ( ! function_exists( 'generate_menu_class' ) ) {
|
||||
* @param string|array $class One or more classes to add to the class list.
|
||||
*/
|
||||
function generate_menu_class( $class = '' ) {
|
||||
// Separates classes with a single space, collates classes for post DIV
|
||||
echo 'class="' . join( ' ', generate_get_menu_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
|
||||
// Separates classes with a single space, collates classes for post DIV.
|
||||
echo 'class="' . join( ' ', generate_get_menu_class( $class ) ) . '"'; // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
@ -545,8 +650,8 @@ if ( ! function_exists( 'generate_main_class' ) ) {
|
||||
* @param string|array $class One or more classes to add to the class list.
|
||||
*/
|
||||
function generate_main_class( $class = '' ) {
|
||||
// Separates classes with a single space, collates classes for post DIV
|
||||
echo 'class="' . join( ' ', generate_get_main_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
|
||||
// Separates classes with a single space, collates classes for post DIV.
|
||||
echo 'class="' . join( ' ', generate_get_main_class( $class ) ) . '"'; // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
@ -584,8 +689,8 @@ if ( ! function_exists( 'generate_footer_class' ) ) {
|
||||
* @param string|array $class One or more classes to add to the class list.
|
||||
*/
|
||||
function generate_footer_class( $class = '' ) {
|
||||
// Separates classes with a single space, collates classes for post DIV
|
||||
echo 'class="' . join( ' ', generate_get_footer_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
|
||||
// Separates classes with a single space, collates classes for post DIV.
|
||||
echo 'class="' . join( ' ', generate_get_footer_class( $class ) ) . '"'; // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
@ -637,8 +742,8 @@ if ( ! function_exists( 'generate_inside_footer_class' ) ) {
|
||||
|
||||
$return = apply_filters( 'generate_inside_footer_class', $classes, $class );
|
||||
|
||||
// Separates classes with a single space, collates classes for post DIV
|
||||
echo 'class="' . join( ' ', $return ) . '"'; // WPCS: XSS ok, sanitization ok.
|
||||
// Separates classes with a single space, collates classes for post DIV.
|
||||
echo 'class="' . join( ' ', $return ) . '"'; // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
@ -664,8 +769,8 @@ if ( ! function_exists( 'generate_top_bar_class' ) ) {
|
||||
|
||||
$return = apply_filters( 'generate_top_bar_class', $classes, $class );
|
||||
|
||||
// Separates classes with a single space, collates classes for post DIV
|
||||
echo 'class="' . join( ' ', $return ) . '"'; // WPCS: XSS ok, sanitization ok.
|
||||
// Separates classes with a single space, collates classes for post DIV.
|
||||
echo 'class="' . join( ' ', $return ) . '"'; // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
@ -676,23 +781,23 @@ if ( ! function_exists( 'generate_body_schema' ) ) {
|
||||
* @since 1.3.15
|
||||
*/
|
||||
function generate_body_schema() {
|
||||
// Set up blog variable
|
||||
// Set up blog variable.
|
||||
$blog = ( is_home() || is_archive() || is_attachment() || is_tax() || is_single() ) ? true : false;
|
||||
|
||||
// Set up default itemtype
|
||||
// Set up default itemtype.
|
||||
$itemtype = 'WebPage';
|
||||
|
||||
// Get itemtype for the blog
|
||||
// Get itemtype for the blog.
|
||||
$itemtype = ( $blog ) ? 'Blog' : $itemtype;
|
||||
|
||||
// Get itemtype for search results
|
||||
// Get itemtype for search results.
|
||||
$itemtype = ( is_search() ) ? 'SearchResultsPage' : $itemtype;
|
||||
|
||||
// Get the result
|
||||
// Get the result.
|
||||
$result = esc_html( apply_filters( 'generate_body_itemtype', $itemtype ) );
|
||||
|
||||
// Return our HTML
|
||||
echo "itemtype='https://schema.org/$result' itemscope='itemscope'"; // WPCS: XSS ok, sanitization ok.
|
||||
// Return our HTML.
|
||||
echo "itemtype='https://schema.org/$result' itemscope='itemscope'"; // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
@ -700,13 +805,110 @@ if ( ! function_exists( 'generate_article_schema' ) ) {
|
||||
/**
|
||||
* Figure out which schema tags to apply to the <article> element
|
||||
* The function determines the itemtype: generate_article_schema( 'BlogPosting' )
|
||||
*
|
||||
* @since 1.3.15
|
||||
* @param string $type The type of schema.
|
||||
*/
|
||||
function generate_article_schema( $type = 'CreativeWork' ) {
|
||||
// Get the itemtype
|
||||
// Get the itemtype.
|
||||
$itemtype = esc_html( apply_filters( 'generate_article_itemtype', $type ) );
|
||||
|
||||
// Print the results
|
||||
echo "itemtype='https://schema.org/$itemtype' itemscope='itemscope'"; // WPCS: XSS ok, sanitization ok.
|
||||
// Print the results.
|
||||
echo "itemtype='https://schema.org/$itemtype' itemscope='itemscope'"; // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process database updates if necessary.
|
||||
* There's nothing in here yet, but we're setting the version to use later.
|
||||
*
|
||||
* @since 2.1
|
||||
* @deprecated 3.0.0
|
||||
*/
|
||||
function generate_do_admin_db_updates() {
|
||||
// Replaced by Generate_Theme_Update().
|
||||
}
|
||||
|
||||
/**
|
||||
* Process important database updates when someone visits the front or backend.
|
||||
*
|
||||
* @since 2.3
|
||||
* @deprecated 3.0.0
|
||||
*/
|
||||
function generate_do_db_updates() {
|
||||
// Replaced by Generate_Theme_Update().
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_update_logo_setting' ) ) {
|
||||
/**
|
||||
* Migrate the old logo database entry to the new custom_logo theme mod (WordPress 4.5)
|
||||
*
|
||||
* @since 1.3.29
|
||||
* @deprecated 3.0.0
|
||||
*/
|
||||
function generate_update_logo_setting() {
|
||||
// Replaced by Generate_Theme_Update().
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_typography_convert_values' ) ) {
|
||||
/**
|
||||
* Take the old body font value and strip it of variants
|
||||
* This should only run once
|
||||
*
|
||||
* @since 1.3.0
|
||||
* @deprecated 3.0.0
|
||||
*/
|
||||
function generate_typography_convert_values() {
|
||||
// Replaced by Generate_Theme_Update().
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute functions after existing sites update.
|
||||
*
|
||||
* We check to see if options already exist. If they do, we can assume the user has
|
||||
* updated the theme, and not installed it from scratch.
|
||||
*
|
||||
* We run this right away in the Dashboard to avoid other migration functions from
|
||||
* setting options and causing these functions to run on fresh installs.
|
||||
*
|
||||
* @since 2.0
|
||||
* @deprecated 3.0.0
|
||||
*/
|
||||
function generate_migrate_existing_settings() {
|
||||
// Replaced by Generate_Theme_Update().
|
||||
}
|
||||
|
||||
/**
|
||||
* Output CSS for the icon fonts.
|
||||
*
|
||||
* @since 2.3
|
||||
* @deprecated 3.0.0
|
||||
*/
|
||||
function generate_do_icon_css() {
|
||||
$output = false;
|
||||
|
||||
if ( 'font' === generate_get_option( 'icons' ) ) {
|
||||
$url = trailingslashit( get_template_directory_uri() );
|
||||
|
||||
if ( defined( 'GENERATE_MENU_PLUS_VERSION' ) ) {
|
||||
$output .= '.main-navigation .slideout-toggle a:before,
|
||||
.slide-opened .slideout-overlay .slideout-exit:before {
|
||||
font-family: GeneratePress;
|
||||
}
|
||||
|
||||
.slideout-navigation .dropdown-menu-toggle:before {
|
||||
content: "\f107" !important;
|
||||
}
|
||||
|
||||
.slideout-navigation .sfHover > a .dropdown-menu-toggle:before {
|
||||
content: "\f106" !important;
|
||||
}';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $output ) {
|
||||
return str_replace( array( "\r", "\n", "\t" ), '', $output );
|
||||
}
|
||||
}
|
||||
|
@ -18,41 +18,87 @@ if ( ! function_exists( 'generate_scripts' ) ) {
|
||||
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
||||
$dir_uri = get_template_directory_uri();
|
||||
|
||||
if ( generate_get_option( 'combine_css' ) && $suffix ) {
|
||||
wp_enqueue_style( 'generate-style', $dir_uri . "/css/all.min.css", array(), GENERATE_VERSION, 'all' );
|
||||
} else {
|
||||
$lite = '';
|
||||
if ( apply_filters( 'generate_unsemantic_grid_lite', false ) ) {
|
||||
$lite = '-lite';
|
||||
if ( generate_is_using_flexbox() ) {
|
||||
if ( is_singular() && comments_open() ) {
|
||||
wp_enqueue_style( 'generate-comments', $dir_uri . "/assets/css/components/comments{$suffix}.css", array(), GENERATE_VERSION, 'all' );
|
||||
}
|
||||
|
||||
wp_enqueue_style( 'generate-style-grid', $dir_uri . "/css/unsemantic-grid{$lite}{$suffix}.css", false, GENERATE_VERSION, 'all' );
|
||||
wp_enqueue_style( 'generate-style', $dir_uri . "/style{$suffix}.css", array(), GENERATE_VERSION, 'all' );
|
||||
wp_enqueue_style( 'generate-mobile-style', $dir_uri . "/css/mobile{$suffix}.css", array( 'generate-style' ), GENERATE_VERSION, 'all' );
|
||||
if (
|
||||
is_active_sidebar( 'top-bar' ) ||
|
||||
is_active_sidebar( 'footer-bar' ) ||
|
||||
is_active_sidebar( 'footer-1' ) ||
|
||||
is_active_sidebar( 'footer-2' ) ||
|
||||
is_active_sidebar( 'footer-3' ) ||
|
||||
is_active_sidebar( 'footer-4' ) ||
|
||||
is_active_sidebar( 'footer-5' )
|
||||
) {
|
||||
wp_enqueue_style( 'generate-widget-areas', $dir_uri . "/assets/css/components/widget-areas{$suffix}.css", array(), GENERATE_VERSION, 'all' );
|
||||
}
|
||||
|
||||
wp_enqueue_style( 'generate-style', $dir_uri . "/assets/css/main{$suffix}.css", array(), GENERATE_VERSION, 'all' );
|
||||
} else {
|
||||
if ( generate_get_option( 'combine_css' ) && $suffix ) {
|
||||
wp_enqueue_style( 'generate-style', $dir_uri . "/assets/css/all{$suffix}.css", array(), GENERATE_VERSION, 'all' );
|
||||
} else {
|
||||
wp_enqueue_style( 'generate-style-grid', $dir_uri . "/assets/css/unsemantic-grid{$suffix}.css", false, GENERATE_VERSION, 'all' );
|
||||
wp_enqueue_style( 'generate-style', $dir_uri . "/assets/css/style{$suffix}.css", array(), GENERATE_VERSION, 'all' );
|
||||
wp_enqueue_style( 'generate-mobile-style', $dir_uri . "/assets/css/mobile{$suffix}.css", array(), GENERATE_VERSION, 'all' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_child_theme() ) {
|
||||
wp_enqueue_style( 'generate-child', get_stylesheet_uri(), array( 'generate-style' ), filemtime( get_stylesheet_directory() . '/style.css' ), 'all' );
|
||||
if ( 'font' === generate_get_option( 'icons' ) ) {
|
||||
wp_enqueue_style( 'generate-font-icons', $dir_uri . "/assets/css/components/font-icons{$suffix}.css", array(), GENERATE_VERSION, 'all' );
|
||||
}
|
||||
|
||||
if ( ! apply_filters( 'generate_fontawesome_essentials', false ) ) {
|
||||
wp_enqueue_style( 'font-awesome', $dir_uri . "/css/font-awesome{$suffix}.css", false, '4.7', 'all' );
|
||||
wp_enqueue_style( 'font-awesome', $dir_uri . "/assets/css/components/font-awesome{$suffix}.css", false, '4.7', 'all' );
|
||||
}
|
||||
|
||||
if ( is_rtl() ) {
|
||||
if ( generate_is_using_flexbox() ) {
|
||||
wp_enqueue_style( 'generate-rtl', $dir_uri . "/assets/css/main-rtl{$suffix}.css", array(), GENERATE_VERSION, 'all' );
|
||||
} else {
|
||||
wp_enqueue_style( 'generate-rtl', $dir_uri . "/assets/css/style-rtl{$suffix}.css", array(), GENERATE_VERSION, 'all' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_child_theme() && apply_filters( 'generate_load_child_theme_stylesheet', true ) ) {
|
||||
wp_enqueue_style( 'generate-child', get_stylesheet_uri(), array( 'generate-style' ), filemtime( get_stylesheet_directory() . '/style.css' ), 'all' );
|
||||
}
|
||||
|
||||
if ( function_exists( 'wp_script_add_data' ) ) {
|
||||
wp_enqueue_script( 'generate-classlist', $dir_uri . "/js/classList{$suffix}.js", array(), GENERATE_VERSION, true );
|
||||
wp_enqueue_script( 'generate-classlist', $dir_uri . "/assets/js/classList{$suffix}.js", array(), GENERATE_VERSION, true );
|
||||
wp_script_add_data( 'generate-classlist', 'conditional', 'lte IE 11' );
|
||||
}
|
||||
|
||||
wp_enqueue_script( 'generate-menu', $dir_uri . "/js/menu{$suffix}.js", array(), GENERATE_VERSION, true );
|
||||
wp_enqueue_script( 'generate-a11y', $dir_uri . "/js/a11y{$suffix}.js", array(), GENERATE_VERSION, true );
|
||||
if ( apply_filters( 'generate_combine_js', true ) && $suffix ) {
|
||||
wp_enqueue_script( 'generate-main', $dir_uri . "/assets/js/main{$suffix}.js", array(), GENERATE_VERSION, true );
|
||||
$script_handle = 'generate-main';
|
||||
} else {
|
||||
wp_enqueue_script( 'generate-menu', $dir_uri . "/assets/js/menu{$suffix}.js", array(), GENERATE_VERSION, true );
|
||||
wp_enqueue_script( 'generate-a11y', $dir_uri . "/assets/js/a11y{$suffix}.js", array(), GENERATE_VERSION, true );
|
||||
$script_handle = 'generate-menu';
|
||||
}
|
||||
|
||||
wp_localize_script(
|
||||
$script_handle,
|
||||
'generatepressMenu',
|
||||
apply_filters(
|
||||
'generate_localize_js_args',
|
||||
array(
|
||||
'toggleOpenedSubMenus' => true,
|
||||
'openSubMenuLabel' => esc_attr__( 'Open Sub-Menu', 'generatepress' ),
|
||||
'closeSubMenuLabel' => esc_attr__( 'Close Sub-Menu', 'generatepress' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if ( 'click' === generate_get_option( 'nav_dropdown_type' ) || 'click-arrow' === generate_get_option( 'nav_dropdown_type' ) ) {
|
||||
wp_enqueue_script( 'generate-dropdown-click', $dir_uri . "/js/dropdown-click{$suffix}.js", array( 'generate-menu' ), GENERATE_VERSION, true );
|
||||
wp_enqueue_script( 'generate-dropdown-click', $dir_uri . "/assets/js/dropdown-click{$suffix}.js", array(), GENERATE_VERSION, true );
|
||||
}
|
||||
|
||||
if ( 'enable' === generate_get_option( 'nav_search' ) ) {
|
||||
wp_enqueue_script( 'generate-navigation-search', $dir_uri . "/js/navigation-search{$suffix}.js", array( 'generate-menu' ), GENERATE_VERSION, true );
|
||||
wp_enqueue_script( 'generate-navigation-search', $dir_uri . "/assets/js/navigation-search{$suffix}.js", array(), GENERATE_VERSION, true );
|
||||
|
||||
wp_localize_script(
|
||||
'generate-navigation-search',
|
||||
@ -65,7 +111,7 @@ if ( ! function_exists( 'generate_scripts' ) ) {
|
||||
}
|
||||
|
||||
if ( 'enable' === generate_get_option( 'back_to_top' ) ) {
|
||||
wp_enqueue_script( 'generate-back-to-top', $dir_uri . "/js/back-to-top{$suffix}.js", array(), GENERATE_VERSION, true );
|
||||
wp_enqueue_script( 'generate-back-to-top', $dir_uri . "/assets/js/back-to-top{$suffix}.js", array(), GENERATE_VERSION, true );
|
||||
}
|
||||
|
||||
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
|
||||
@ -89,19 +135,21 @@ if ( ! function_exists( 'generate_widgets_init' ) ) {
|
||||
'footer-3' => __( 'Footer Widget 3', 'generatepress' ),
|
||||
'footer-4' => __( 'Footer Widget 4', 'generatepress' ),
|
||||
'footer-5' => __( 'Footer Widget 5', 'generatepress' ),
|
||||
'footer-bar' => __( 'Footer Bar','generatepress' ),
|
||||
'top-bar' => __( 'Top Bar','generatepress' ),
|
||||
'footer-bar' => __( 'Footer Bar', 'generatepress' ),
|
||||
'top-bar' => __( 'Top Bar', 'generatepress' ),
|
||||
);
|
||||
|
||||
foreach ( $widgets as $id => $name ) {
|
||||
register_sidebar( array(
|
||||
'name' => $name,
|
||||
'id' => $id,
|
||||
'before_widget' => '<aside id="%1$s" class="widget inner-padding %2$s">',
|
||||
'after_widget' => '</aside>',
|
||||
'before_title' => apply_filters( 'generate_start_widget_title', '<h2 class="widget-title">' ),
|
||||
'after_title' => apply_filters( 'generate_end_widget_title', '</h2>' ),
|
||||
) );
|
||||
register_sidebar(
|
||||
array(
|
||||
'name' => $name,
|
||||
'id' => $id,
|
||||
'before_widget' => '<aside id="%1$s" class="widget inner-padding %2$s">',
|
||||
'after_widget' => '</aside>',
|
||||
'before_title' => apply_filters( 'generate_start_widget_title', '<h2 class="widget-title">' ),
|
||||
'after_title' => apply_filters( 'generate_end_widget_title', '</h2>' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -121,11 +169,11 @@ if ( ! function_exists( 'generate_smart_content_width' ) ) {
|
||||
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
|
||||
$layout = generate_get_layout();
|
||||
|
||||
if ( 'left-sidebar' == $layout ) {
|
||||
if ( 'left-sidebar' === $layout ) {
|
||||
$content_width = $container_width * ( ( 100 - $left_sidebar_width ) / 100 );
|
||||
} elseif ( 'right-sidebar' == $layout ) {
|
||||
} elseif ( 'right-sidebar' === $layout ) {
|
||||
$content_width = $container_width * ( ( 100 - $right_sidebar_width ) / 100 );
|
||||
} elseif ( 'no-sidebar' == $layout ) {
|
||||
} elseif ( 'no-sidebar' === $layout ) {
|
||||
$content_width = $container_width;
|
||||
} else {
|
||||
$content_width = $container_width * ( ( 100 - ( $left_sidebar_width + $right_sidebar_width ) ) / 100 );
|
||||
@ -205,8 +253,8 @@ if ( ! function_exists( 'generate_remove_caption_padding' ) ) {
|
||||
/**
|
||||
* Remove WordPress's default padding on images with captions
|
||||
*
|
||||
* @param int $width Default WP .wp-caption width (image width + 10px)
|
||||
* @return int Updated width to remove 10px padding
|
||||
* @param int $width Default WP .wp-caption width (image width + 10px).
|
||||
* @return int Updated width to remove 10px padding.
|
||||
*/
|
||||
function generate_remove_caption_padding( $width ) {
|
||||
return $width - 10;
|
||||
@ -216,7 +264,10 @@ if ( ! function_exists( 'generate_remove_caption_padding' ) ) {
|
||||
if ( ! function_exists( 'generate_enhanced_image_navigation' ) ) {
|
||||
add_filter( 'attachment_link', 'generate_enhanced_image_navigation', 10, 2 );
|
||||
/**
|
||||
* Filter in a link to a content ID attribute for the next/previous image links on image attachment pages
|
||||
* Filter in a link to a content ID attribute for the next/previous image links on image attachment pages.
|
||||
*
|
||||
* @param string $url The input URL.
|
||||
* @param int $id The ID of the post.
|
||||
*/
|
||||
function generate_enhanced_image_navigation( $url, $id ) {
|
||||
if ( ! is_attachment() && ! wp_attachment_is_image( $id ) ) {
|
||||
@ -224,6 +275,7 @@ if ( ! function_exists( 'generate_enhanced_image_navigation' ) ) {
|
||||
}
|
||||
|
||||
$image = get_post( $id );
|
||||
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentially loose.
|
||||
if ( ! empty( $image->post_parent ) && $image->post_parent != $id ) {
|
||||
$url .= '#main';
|
||||
}
|
||||
@ -241,15 +293,17 @@ if ( ! function_exists( 'generate_categorized_blog' ) ) {
|
||||
* @return bool True of there is more than one category, false otherwise.
|
||||
*/
|
||||
function generate_categorized_blog() {
|
||||
if ( false === ( $all_the_cool_cats = get_transient( 'generate_categories' ) ) ) {
|
||||
if ( false === ( $all_the_cool_cats = get_transient( 'generate_categories' ) ) ) { // phpcs:ignore
|
||||
// Create an array of all the categories that are attached to posts.
|
||||
$all_the_cool_cats = get_categories( array(
|
||||
'fields' => 'ids',
|
||||
'hide_empty' => 1,
|
||||
$all_the_cool_cats = get_categories(
|
||||
array(
|
||||
'fields' => 'ids',
|
||||
'hide_empty' => 1,
|
||||
|
||||
// We only need to know if there is more than one category.
|
||||
'number' => 2,
|
||||
) );
|
||||
// We only need to know if there is more than one category.
|
||||
'number' => 2,
|
||||
)
|
||||
);
|
||||
|
||||
// Count the number of categories that are attached to the posts.
|
||||
$all_the_cool_cats = count( $all_the_cool_cats );
|
||||
@ -269,7 +323,7 @@ if ( ! function_exists( 'generate_categorized_blog' ) ) {
|
||||
|
||||
if ( ! function_exists( 'generate_category_transient_flusher' ) ) {
|
||||
add_action( 'edit_category', 'generate_category_transient_flusher' );
|
||||
add_action( 'save_post', 'generate_category_transient_flusher' );
|
||||
add_action( 'save_post', 'generate_category_transient_flusher' );
|
||||
/**
|
||||
* Flush out the transients used in {@see generate_categorized_blog()}.
|
||||
*
|
||||
@ -309,7 +363,7 @@ add_filter( 'generate_fontawesome_essentials', 'generate_set_font_awesome_essent
|
||||
*
|
||||
* @since 2.0
|
||||
*
|
||||
* @param bool $essentials
|
||||
* @param bool $essentials The existing value.
|
||||
* @return bool
|
||||
*/
|
||||
function generate_set_font_awesome_essentials( $essentials ) {
|
||||
@ -326,7 +380,7 @@ add_filter( 'generate_dynamic_css_skip_cache', 'generate_skip_dynamic_css_cache'
|
||||
*
|
||||
* @since 2.0
|
||||
*
|
||||
* @param bool $cache
|
||||
* @param bool $cache The existing value.
|
||||
* @return bool
|
||||
*/
|
||||
function generate_skip_dynamic_css_cache( $cache ) {
|
||||
@ -341,6 +395,8 @@ add_filter( 'wp_headers', 'generate_set_wp_headers' );
|
||||
/**
|
||||
* Set any necessary headers.
|
||||
*
|
||||
* @param array $headers The existing headers.
|
||||
*
|
||||
* @since 2.3
|
||||
*/
|
||||
function generate_set_wp_headers( $headers ) {
|
||||
@ -348,3 +404,33 @@ function generate_set_wp_headers( $headers ) {
|
||||
|
||||
return $headers;
|
||||
}
|
||||
|
||||
add_filter( 'generate_after_element_class_attribute', 'generate_set_microdata_markup', 10, 2 );
|
||||
/**
|
||||
* Adds microdata to elements.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param string $output The existing output after the class attribute.
|
||||
* @param string $context What element we're targeting.
|
||||
*/
|
||||
function generate_set_microdata_markup( $output, $context ) {
|
||||
if ( 'left_sidebar' === $context || 'right_sidebar' === $context ) {
|
||||
$context = 'sidebar';
|
||||
}
|
||||
|
||||
if ( 'footer' === $context ) {
|
||||
return $output;
|
||||
}
|
||||
|
||||
if ( 'site-info' === $context ) {
|
||||
$context = 'footer';
|
||||
}
|
||||
|
||||
$microdata = generate_get_microdata( $context );
|
||||
|
||||
if ( $microdata ) {
|
||||
return $microdata;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
@ -9,160 +9,41 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Display HTML classes for an element.
|
||||
*
|
||||
* @since 2.2
|
||||
*
|
||||
* @param string $context The element we're targeting.
|
||||
* @param string|array $class One or more classes to add to the class list.
|
||||
*/
|
||||
function generate_do_element_classes( $context, $class = '' ) {
|
||||
echo 'class="' . join( ' ', generate_get_element_classes( $context, $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve HTML classes for an element.
|
||||
*
|
||||
* @since 2.2
|
||||
*
|
||||
* @param string $context The element we're targeting.
|
||||
* @param string|array $class One or more classes to add to the class list.
|
||||
* @return array Array of classes.
|
||||
*/
|
||||
function generate_get_element_classes( $context, $class = '' ) {
|
||||
$classes = array();
|
||||
|
||||
if ( ! empty( $class ) ) {
|
||||
if ( ! is_array( $class ) ) {
|
||||
$class = preg_split( '#\s+#', $class );
|
||||
}
|
||||
|
||||
$classes = array_merge( $classes, $class );
|
||||
}
|
||||
|
||||
$classes = array_map( 'esc_attr', $classes );
|
||||
|
||||
return apply_filters( "generate_{$context}_class", $classes, $class );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get any necessary microdata.
|
||||
*
|
||||
* @since 2.2
|
||||
*
|
||||
* @param string $context The element to target.
|
||||
* @return string Our final attribute to add to the element.
|
||||
*/
|
||||
function generate_get_microdata( $context ) {
|
||||
$data = false;
|
||||
|
||||
if ( 'microdata' !== apply_filters( 'generate_schema_type', 'microdata' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( 'body' === $context ) {
|
||||
$type = 'WebPage';
|
||||
|
||||
if ( is_home() || is_archive() || is_attachment() || is_tax() || is_single() ) {
|
||||
$type = 'Blog';
|
||||
}
|
||||
|
||||
if ( is_search() ) {
|
||||
$type = 'SearchResultsPage';
|
||||
}
|
||||
|
||||
$type = apply_filters( 'generate_body_itemtype', $type );
|
||||
|
||||
$data = sprintf(
|
||||
'itemtype="https://schema.org/%s" itemscope',
|
||||
esc_html( $type )
|
||||
);
|
||||
}
|
||||
|
||||
if ( 'header' === $context ) {
|
||||
$data = 'itemtype="https://schema.org/WPHeader" itemscope';
|
||||
}
|
||||
|
||||
if ( 'navigation' === $context ) {
|
||||
$data = 'itemtype="https://schema.org/SiteNavigationElement" itemscope';
|
||||
}
|
||||
|
||||
if ( 'article' === $context ) {
|
||||
$type = apply_filters( 'generate_article_itemtype', 'CreativeWork' );
|
||||
|
||||
$data = sprintf(
|
||||
'itemtype="https://schema.org/%s" itemscope',
|
||||
esc_html( $type )
|
||||
);
|
||||
}
|
||||
|
||||
if ( 'post-author' === $context ) {
|
||||
$data = 'itemprop="author" itemtype="https://schema.org/Person" itemscope';
|
||||
}
|
||||
|
||||
if ( 'comment-body' === $context ) {
|
||||
$data = 'itemtype="https://schema.org/Comment" itemscope';
|
||||
}
|
||||
|
||||
if ( 'comment-author' === $context ) {
|
||||
$data = 'itemprop="author" itemtype="https://schema.org/Person" itemscope';
|
||||
}
|
||||
|
||||
if ( 'sidebar' === $context ) {
|
||||
$data = 'itemtype="https://schema.org/WPSideBar" itemscope';
|
||||
}
|
||||
|
||||
if ( 'footer' === $context ) {
|
||||
$data = 'itemtype="https://schema.org/WPFooter" itemscope';
|
||||
}
|
||||
|
||||
if ( $data ) {
|
||||
return apply_filters( "generate_{$context}_microdata", $data );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output our microdata for an element.
|
||||
*
|
||||
* @since 2.2
|
||||
*
|
||||
* @param $context The element to target.
|
||||
* @return string The microdata.
|
||||
*/
|
||||
function generate_do_microdata( $context ) {
|
||||
echo generate_get_microdata( $context ); // WPCS: XSS ok, sanitization ok.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_body_classes' ) ) {
|
||||
add_filter( 'body_class', 'generate_body_classes' );
|
||||
/**
|
||||
* Adds custom classes to the array of body classes.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_body_classes( $classes ) {
|
||||
$sidebar_layout = generate_get_layout();
|
||||
$navigation_location = generate_get_navigation_location();
|
||||
$navigation_alignment = generate_get_option( 'nav_alignment_setting' );
|
||||
$navigation_dropdown = generate_get_option( 'nav_dropdown_type' );
|
||||
$header_layout = generate_get_option( 'header_layout_setting' );
|
||||
$header_alignment = generate_get_option( 'header_alignment_setting' );
|
||||
$content_layout = generate_get_option( 'content_layout_setting' );
|
||||
$footer_widgets = generate_get_footer_widgets();
|
||||
$sidebar_layout = generate_get_layout();
|
||||
$navigation_location = generate_get_navigation_location();
|
||||
$navigation_alignment = generate_get_option( 'nav_alignment_setting' );
|
||||
$navigation_dropdown = generate_get_option( 'nav_dropdown_type' );
|
||||
$header_alignment = generate_get_option( 'header_alignment_setting' );
|
||||
$content_layout = generate_get_option( 'content_layout_setting' );
|
||||
|
||||
// These values all have defaults, but we like to be extra careful.
|
||||
$classes[] = ( $sidebar_layout ) ? $sidebar_layout : 'right-sidebar';
|
||||
$classes[] = ( $navigation_location ) ? $navigation_location : 'nav-below-header';
|
||||
$classes[] = ( $header_layout ) ? $header_layout : 'fluid-header';
|
||||
$classes[] = ( $content_layout ) ? $content_layout : 'separate-containers';
|
||||
$classes[] = ( '' !== $footer_widgets ) ? 'active-footer-widgets-' . absint( $footer_widgets ) : 'active-footer-widgets-3';
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$footer_widgets = generate_get_footer_widgets();
|
||||
$header_layout = generate_get_option( 'header_layout_setting' );
|
||||
|
||||
$classes[] = ( $header_layout ) ? $header_layout : 'fluid-header';
|
||||
$classes[] = ( '' !== $footer_widgets ) ? 'active-footer-widgets-' . absint( $footer_widgets ) : 'active-footer-widgets-3';
|
||||
}
|
||||
|
||||
if ( 'enable' === generate_get_option( 'nav_search' ) ) {
|
||||
$classes[] = 'nav-search-enabled';
|
||||
}
|
||||
|
||||
// Only necessary for nav before or after header.
|
||||
if ( 'nav-below-header' === $navigation_location || 'nav-above-header' === $navigation_location ) {
|
||||
if ( ! generate_is_using_flexbox() && 'nav-below-header' === $navigation_location || 'nav-above-header' === $navigation_location ) {
|
||||
if ( 'center' === $navigation_alignment ) {
|
||||
$classes[] = 'nav-aligned-center';
|
||||
} elseif ( 'right' === $navigation_alignment ) {
|
||||
@ -219,6 +100,7 @@ if ( ! function_exists( 'generate_top_bar_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to the header.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_top_bar_classes( $classes ) {
|
||||
@ -226,7 +108,10 @@ if ( ! function_exists( 'generate_top_bar_classes' ) ) {
|
||||
|
||||
if ( 'contained' === generate_get_option( 'top_bar_width' ) ) {
|
||||
$classes[] = 'grid-container';
|
||||
$classes[] = 'grid-parent';
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$classes[] = 'grid-parent';
|
||||
}
|
||||
}
|
||||
|
||||
$classes[] = 'top-bar-align-' . esc_attr( generate_get_option( 'top_bar_alignment' ) );
|
||||
@ -240,33 +125,38 @@ if ( ! function_exists( 'generate_right_sidebar_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to the right sidebar.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_right_sidebar_classes( $classes ) {
|
||||
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
|
||||
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
|
||||
|
||||
$right_sidebar_tablet_width = apply_filters( 'generate_right_sidebar_tablet_width', $right_sidebar_width );
|
||||
$left_sidebar_tablet_width = apply_filters( 'generate_left_sidebar_tablet_width', $left_sidebar_width );
|
||||
|
||||
$classes[] = 'widget-area';
|
||||
$classes[] = 'grid-' . $right_sidebar_width;
|
||||
$classes[] = 'tablet-grid-' . $right_sidebar_tablet_width;
|
||||
$classes[] = 'grid-parent';
|
||||
$classes[] = 'sidebar';
|
||||
$classes[] = 'is-right-sidebar';
|
||||
|
||||
// Get the layout
|
||||
$layout = generate_get_layout();
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
|
||||
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
|
||||
|
||||
if ( '' !== $layout ) {
|
||||
switch ( $layout ) {
|
||||
case 'both-left' :
|
||||
$total_sidebar_width = $left_sidebar_width + $right_sidebar_width;
|
||||
$classes[] = 'pull-' . ( 100 - $total_sidebar_width );
|
||||
$right_sidebar_tablet_width = apply_filters( 'generate_right_sidebar_tablet_width', $right_sidebar_width );
|
||||
$left_sidebar_tablet_width = apply_filters( 'generate_left_sidebar_tablet_width', $left_sidebar_width );
|
||||
|
||||
$total_sidebar_tablet_width = $left_sidebar_tablet_width + $right_sidebar_tablet_width;
|
||||
$classes[] = 'tablet-pull-' . ( 100 - $total_sidebar_tablet_width );
|
||||
break;
|
||||
$classes[] = 'grid-' . $right_sidebar_width;
|
||||
$classes[] = 'tablet-grid-' . $right_sidebar_tablet_width;
|
||||
$classes[] = 'grid-parent';
|
||||
|
||||
// Get the layout.
|
||||
$layout = generate_get_layout();
|
||||
|
||||
if ( '' !== $layout ) {
|
||||
switch ( $layout ) {
|
||||
case 'both-left':
|
||||
$total_sidebar_width = $left_sidebar_width + $right_sidebar_width;
|
||||
$classes[] = 'pull-' . ( 100 - $total_sidebar_width );
|
||||
|
||||
$total_sidebar_tablet_width = $left_sidebar_tablet_width + $right_sidebar_tablet_width;
|
||||
$classes[] = 'tablet-pull-' . ( 100 - $total_sidebar_tablet_width );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -279,39 +169,44 @@ if ( ! function_exists( 'generate_left_sidebar_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to the left sidebar.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_left_sidebar_classes( $classes ) {
|
||||
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
|
||||
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
|
||||
$total_sidebar_width = $left_sidebar_width + $right_sidebar_width;
|
||||
|
||||
$right_sidebar_tablet_width = apply_filters( 'generate_right_sidebar_tablet_width', $right_sidebar_width );
|
||||
$left_sidebar_tablet_width = apply_filters( 'generate_left_sidebar_tablet_width', $left_sidebar_width );
|
||||
$total_sidebar_tablet_width = $left_sidebar_tablet_width + $right_sidebar_tablet_width;
|
||||
|
||||
$classes[] = 'widget-area';
|
||||
$classes[] = 'grid-' . $left_sidebar_width;
|
||||
$classes[] = 'tablet-grid-' . $left_sidebar_tablet_width;
|
||||
$classes[] = 'mobile-grid-100';
|
||||
$classes[] = 'grid-parent';
|
||||
$classes[] = 'sidebar';
|
||||
$classes[] = 'is-left-sidebar';
|
||||
|
||||
// Get the layout
|
||||
$layout = generate_get_layout();
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
|
||||
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
|
||||
$total_sidebar_width = $left_sidebar_width + $right_sidebar_width;
|
||||
|
||||
if ( '' !== $layout ) {
|
||||
switch ( $layout ) {
|
||||
case 'left-sidebar' :
|
||||
$classes[] = 'pull-' . ( 100 - $left_sidebar_width );
|
||||
$classes[] = 'tablet-pull-' . ( 100 - $left_sidebar_tablet_width );
|
||||
break;
|
||||
$right_sidebar_tablet_width = apply_filters( 'generate_right_sidebar_tablet_width', $right_sidebar_width );
|
||||
$left_sidebar_tablet_width = apply_filters( 'generate_left_sidebar_tablet_width', $left_sidebar_width );
|
||||
$total_sidebar_tablet_width = $left_sidebar_tablet_width + $right_sidebar_tablet_width;
|
||||
|
||||
case 'both-sidebars' :
|
||||
case 'both-left' :
|
||||
$classes[] = 'pull-' . ( 100 - $total_sidebar_width );
|
||||
$classes[] = 'tablet-pull-' . ( 100 - $total_sidebar_tablet_width );
|
||||
break;
|
||||
$classes[] = 'grid-' . $left_sidebar_width;
|
||||
$classes[] = 'tablet-grid-' . $left_sidebar_tablet_width;
|
||||
$classes[] = 'mobile-grid-100';
|
||||
$classes[] = 'grid-parent';
|
||||
|
||||
// Get the layout.
|
||||
$layout = generate_get_layout();
|
||||
|
||||
if ( '' !== $layout ) {
|
||||
switch ( $layout ) {
|
||||
case 'left-sidebar':
|
||||
$classes[] = 'pull-' . ( 100 - $left_sidebar_width );
|
||||
$classes[] = 'tablet-pull-' . ( 100 - $left_sidebar_tablet_width );
|
||||
break;
|
||||
|
||||
case 'both-sidebars':
|
||||
case 'both-left':
|
||||
$classes[] = 'pull-' . ( 100 - $total_sidebar_width );
|
||||
$classes[] = 'tablet-pull-' . ( 100 - $total_sidebar_tablet_width );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,62 +219,66 @@ if ( ! function_exists( 'generate_content_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to the content container.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_content_classes( $classes ) {
|
||||
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
|
||||
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
|
||||
$total_sidebar_width = $left_sidebar_width + $right_sidebar_width;
|
||||
|
||||
$right_sidebar_tablet_width = apply_filters( 'generate_right_sidebar_tablet_width', $right_sidebar_width );
|
||||
$left_sidebar_tablet_width = apply_filters( 'generate_left_sidebar_tablet_width', $left_sidebar_width );
|
||||
$total_sidebar_tablet_width = $left_sidebar_tablet_width + $right_sidebar_tablet_width;
|
||||
|
||||
$classes[] = 'content-area';
|
||||
$classes[] = 'grid-parent';
|
||||
$classes[] = 'mobile-grid-100';
|
||||
|
||||
// Get the layout
|
||||
$layout = generate_get_layout();
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' );
|
||||
$left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' );
|
||||
$total_sidebar_width = $left_sidebar_width + $right_sidebar_width;
|
||||
|
||||
if ( '' !== $layout ) {
|
||||
switch ( $layout ) {
|
||||
$right_sidebar_tablet_width = apply_filters( 'generate_right_sidebar_tablet_width', $right_sidebar_width );
|
||||
$left_sidebar_tablet_width = apply_filters( 'generate_left_sidebar_tablet_width', $left_sidebar_width );
|
||||
$total_sidebar_tablet_width = $left_sidebar_tablet_width + $right_sidebar_tablet_width;
|
||||
|
||||
case 'right-sidebar' :
|
||||
$classes[] = 'grid-' . ( 100 - $right_sidebar_width );
|
||||
$classes[] = 'tablet-grid-' . ( 100 - $right_sidebar_tablet_width );
|
||||
break;
|
||||
$classes[] = 'grid-parent';
|
||||
$classes[] = 'mobile-grid-100';
|
||||
|
||||
case 'left-sidebar' :
|
||||
$classes[] = 'push-' . $left_sidebar_width;
|
||||
$classes[] = 'grid-' . ( 100 - $left_sidebar_width );
|
||||
$classes[] = 'tablet-push-' . $left_sidebar_tablet_width;
|
||||
$classes[] = 'tablet-grid-' . ( 100 - $left_sidebar_tablet_width );
|
||||
break;
|
||||
// Get the layout.
|
||||
$layout = generate_get_layout();
|
||||
|
||||
case 'no-sidebar' :
|
||||
$classes[] = 'grid-100';
|
||||
$classes[] = 'tablet-grid-100';
|
||||
break;
|
||||
if ( '' !== $layout ) {
|
||||
switch ( $layout ) {
|
||||
|
||||
case 'both-sidebars' :
|
||||
$classes[] = 'push-' . $left_sidebar_width;
|
||||
$classes[] = 'grid-' . ( 100 - $total_sidebar_width );
|
||||
$classes[] = 'tablet-push-' . $left_sidebar_tablet_width;
|
||||
$classes[] = 'tablet-grid-' . ( 100 - $total_sidebar_tablet_width );
|
||||
break;
|
||||
case 'right-sidebar':
|
||||
$classes[] = 'grid-' . ( 100 - $right_sidebar_width );
|
||||
$classes[] = 'tablet-grid-' . ( 100 - $right_sidebar_tablet_width );
|
||||
break;
|
||||
|
||||
case 'both-right' :
|
||||
$classes[] = 'grid-' . ( 100 - $total_sidebar_width );
|
||||
$classes[] = 'tablet-grid-' . ( 100 - $total_sidebar_tablet_width );
|
||||
break;
|
||||
case 'left-sidebar':
|
||||
$classes[] = 'push-' . $left_sidebar_width;
|
||||
$classes[] = 'grid-' . ( 100 - $left_sidebar_width );
|
||||
$classes[] = 'tablet-push-' . $left_sidebar_tablet_width;
|
||||
$classes[] = 'tablet-grid-' . ( 100 - $left_sidebar_tablet_width );
|
||||
break;
|
||||
|
||||
case 'both-left' :
|
||||
$classes[] = 'push-' . $total_sidebar_width;
|
||||
$classes[] = 'grid-' . ( 100 - $total_sidebar_width );
|
||||
$classes[] = 'tablet-push-' . $total_sidebar_tablet_width;
|
||||
$classes[] = 'tablet-grid-' . ( 100 - $total_sidebar_tablet_width );
|
||||
break;
|
||||
case 'no-sidebar':
|
||||
$classes[] = 'grid-100';
|
||||
$classes[] = 'tablet-grid-100';
|
||||
break;
|
||||
|
||||
case 'both-sidebars':
|
||||
$classes[] = 'push-' . $left_sidebar_width;
|
||||
$classes[] = 'grid-' . ( 100 - $total_sidebar_width );
|
||||
$classes[] = 'tablet-push-' . $left_sidebar_tablet_width;
|
||||
$classes[] = 'tablet-grid-' . ( 100 - $total_sidebar_tablet_width );
|
||||
break;
|
||||
|
||||
case 'both-right':
|
||||
$classes[] = 'grid-' . ( 100 - $total_sidebar_width );
|
||||
$classes[] = 'tablet-grid-' . ( 100 - $total_sidebar_tablet_width );
|
||||
break;
|
||||
|
||||
case 'both-left':
|
||||
$classes[] = 'push-' . $total_sidebar_width;
|
||||
$classes[] = 'grid-' . ( 100 - $total_sidebar_width );
|
||||
$classes[] = 'tablet-push-' . $total_sidebar_tablet_width;
|
||||
$classes[] = 'tablet-grid-' . ( 100 - $total_sidebar_tablet_width );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -392,6 +291,7 @@ if ( ! function_exists( 'generate_header_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to the header.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_header_classes( $classes ) {
|
||||
@ -399,7 +299,14 @@ if ( ! function_exists( 'generate_header_classes' ) ) {
|
||||
|
||||
if ( 'contained-header' === generate_get_option( 'header_layout_setting' ) ) {
|
||||
$classes[] = 'grid-container';
|
||||
$classes[] = 'grid-parent';
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$classes[] = 'grid-parent';
|
||||
}
|
||||
}
|
||||
|
||||
if ( generate_has_inline_mobile_toggle() ) {
|
||||
$classes[] = 'has-inline-mobile-toggle';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
@ -411,6 +318,7 @@ if ( ! function_exists( 'generate_inside_header_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to inside the header.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_inside_header_classes( $classes ) {
|
||||
@ -418,7 +326,10 @@ if ( ! function_exists( 'generate_inside_header_classes' ) ) {
|
||||
|
||||
if ( 'full-width' !== generate_get_option( 'header_inner_width' ) ) {
|
||||
$classes[] = 'grid-container';
|
||||
$classes[] = 'grid-parent';
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$classes[] = 'grid-parent';
|
||||
}
|
||||
}
|
||||
|
||||
return $classes;
|
||||
@ -430,29 +341,65 @@ if ( ! function_exists( 'generate_navigation_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to the navigation.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_navigation_classes( $classes ) {
|
||||
$classes[] = 'main-navigation';
|
||||
|
||||
if ( 'contained-nav' === generate_get_option( 'nav_layout_setting' ) ) {
|
||||
$classes[] = 'grid-container';
|
||||
$classes[] = 'grid-parent';
|
||||
}
|
||||
if ( generate_is_using_flexbox() ) {
|
||||
$navigation_location = generate_get_navigation_location();
|
||||
|
||||
if ( 'left' === generate_get_option( 'nav_dropdown_direction' ) ) {
|
||||
$nav_layout = generate_get_option( 'nav_position_setting' );
|
||||
|
||||
switch ( $nav_layout ) {
|
||||
case 'nav-below-header':
|
||||
case 'nav-above-header':
|
||||
case 'nav-float-right':
|
||||
case 'nav-float-left':
|
||||
$classes[] = 'sub-menu-left';
|
||||
break;
|
||||
if ( 'nav-float-right' !== $navigation_location && 'nav-float-left' !== $navigation_location ) {
|
||||
$classes[] = 'grid-container';
|
||||
}
|
||||
} else {
|
||||
$classes[] = 'grid-container';
|
||||
$classes[] = 'grid-parent';
|
||||
}
|
||||
}
|
||||
|
||||
if ( generate_is_using_flexbox() ) {
|
||||
$nav_alignment = generate_get_option( 'nav_alignment_setting' );
|
||||
|
||||
if ( 'center' === $nav_alignment ) {
|
||||
$classes[] = 'nav-align-center';
|
||||
} elseif ( 'right' === $nav_alignment ) {
|
||||
$classes[] = 'nav-align-right';
|
||||
} elseif ( is_rtl() && 'left' === $nav_alignment ) {
|
||||
$classes[] = 'nav-align-left';
|
||||
}
|
||||
|
||||
if ( generate_has_menu_bar_items() ) {
|
||||
$classes[] = 'has-menu-bar-items';
|
||||
}
|
||||
}
|
||||
|
||||
$submenu_direction = 'right';
|
||||
|
||||
if ( 'left' === generate_get_option( 'nav_dropdown_direction' ) ) {
|
||||
$submenu_direction = 'left';
|
||||
}
|
||||
|
||||
if ( 'nav-left-sidebar' === generate_get_navigation_location() ) {
|
||||
$submenu_direction = 'right';
|
||||
|
||||
if ( 'both-right' === generate_get_layout() ) {
|
||||
$submenu_direction = 'left';
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'nav-right-sidebar' === generate_get_navigation_location() ) {
|
||||
$submenu_direction = 'left';
|
||||
|
||||
if ( 'both-left' === generate_get_layout() ) {
|
||||
$submenu_direction = 'right';
|
||||
}
|
||||
}
|
||||
|
||||
$classes[] = 'sub-menu-' . $submenu_direction;
|
||||
|
||||
return $classes;
|
||||
}
|
||||
}
|
||||
@ -462,6 +409,7 @@ if ( ! function_exists( 'generate_inside_navigation_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to the inner navigation.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 1.3.41
|
||||
*/
|
||||
function generate_inside_navigation_classes( $classes ) {
|
||||
@ -469,7 +417,10 @@ if ( ! function_exists( 'generate_inside_navigation_classes' ) ) {
|
||||
|
||||
if ( 'full-width' !== generate_get_option( 'nav_inner_width' ) ) {
|
||||
$classes[] = 'grid-container';
|
||||
$classes[] = 'grid-parent';
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$classes[] = 'grid-parent';
|
||||
}
|
||||
}
|
||||
|
||||
return $classes;
|
||||
@ -481,6 +432,7 @@ if ( ! function_exists( 'generate_menu_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to the menu.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_menu_classes( $classes ) {
|
||||
@ -496,6 +448,7 @@ if ( ! function_exists( 'generate_footer_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to the footer.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_footer_classes( $classes ) {
|
||||
@ -503,7 +456,10 @@ if ( ! function_exists( 'generate_footer_classes' ) ) {
|
||||
|
||||
if ( 'contained-footer' === generate_get_option( 'footer_layout_setting' ) ) {
|
||||
$classes[] = 'grid-container';
|
||||
$classes[] = 'grid-parent';
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$classes[] = 'grid-parent';
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_active_sidebar( 'footer-bar' ) ) {
|
||||
@ -520,6 +476,7 @@ if ( ! function_exists( 'generate_inside_footer_classes' ) ) {
|
||||
/**
|
||||
* Adds custom classes to the footer.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_inside_footer_classes( $classes ) {
|
||||
@ -527,7 +484,10 @@ if ( ! function_exists( 'generate_inside_footer_classes' ) ) {
|
||||
|
||||
if ( 'full-width' !== generate_get_option( 'footer_inner_width' ) ) {
|
||||
$classes[] = 'grid-container';
|
||||
$classes[] = 'grid-parent';
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$classes[] = 'grid-parent';
|
||||
}
|
||||
}
|
||||
|
||||
return $classes;
|
||||
@ -538,6 +498,8 @@ if ( ! function_exists( 'generate_main_classes' ) ) {
|
||||
add_filter( 'generate_main_class', 'generate_main_classes' );
|
||||
/**
|
||||
* Adds custom classes to the <main> element
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 1.1.0
|
||||
*/
|
||||
function generate_main_classes( $classes ) {
|
||||
@ -547,16 +509,57 @@ if ( ! function_exists( 'generate_main_classes' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'generate_page_class', 'generate_do_page_container_classes' );
|
||||
/**
|
||||
* Adds custom classes to the #page element
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_do_page_container_classes( $classes ) {
|
||||
$classes[] = 'site';
|
||||
$classes[] = 'grid-container';
|
||||
$classes[] = 'container';
|
||||
|
||||
if ( generate_is_using_hatom() ) {
|
||||
$classes[] = 'hfeed';
|
||||
}
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$classes[] = 'grid-parent';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
add_filter( 'generate_comment-author_class', 'generate_do_comment_author_classes' );
|
||||
/**
|
||||
* Adds custom classes to the comment author element
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_do_comment_author_classes( $classes ) {
|
||||
$classes[] = 'comment-author';
|
||||
|
||||
if ( generate_is_using_hatom() ) {
|
||||
$classes[] = 'vcard';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_post_classes' ) ) {
|
||||
add_filter( 'post_class', 'generate_post_classes' );
|
||||
/**
|
||||
* Adds custom classes to the <article> element.
|
||||
* Remove .hentry class from pages to comply with structural data guidelines.
|
||||
*
|
||||
* @param array $classes The existing classes.
|
||||
* @since 1.3.39
|
||||
*/
|
||||
function generate_post_classes( $classes ) {
|
||||
if ( 'page' == get_post_type() ) {
|
||||
if ( 'page' === get_post_type() || ! generate_is_using_hatom() ) {
|
||||
$classes = array_diff( $classes, array( 'hentry' ) );
|
||||
}
|
||||
|
||||
|
@ -23,8 +23,8 @@ function generate_enqueue_meta_box_scripts( $hook ) {
|
||||
$screen = get_current_screen();
|
||||
$post_type = $screen->id;
|
||||
|
||||
if ( in_array( $post_type, ( array ) $post_types ) ) {
|
||||
wp_enqueue_style( 'generate-layout-metabox', get_template_directory_uri() . '/css/admin/meta-box.css', array(), GENERATE_VERSION );
|
||||
if ( in_array( $post_type, (array) $post_types ) ) {
|
||||
wp_enqueue_style( 'generate-layout-metabox', get_template_directory_uri() . '/assets/css/admin/meta-box.css', array(), GENERATE_VERSION );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -44,6 +44,15 @@ function generate_register_layout_meta_box() {
|
||||
define( 'GENERATE_LAYOUT_META_BOX', true );
|
||||
}
|
||||
|
||||
global $post;
|
||||
|
||||
$blog_id = get_option( 'page_for_posts' );
|
||||
|
||||
// No need for the Layout metabox on the blog page.
|
||||
if ( $blog_id && (int) $blog_id === (int) $post->ID ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$post_types = get_post_types( array( 'public' => true ) );
|
||||
|
||||
foreach ( $post_types as $type ) {
|
||||
@ -74,7 +83,8 @@ function generate_do_layout_meta_box( $post ) {
|
||||
$stored_meta['_generate-full-width-content'][0] = ( isset( $stored_meta['_generate-full-width-content'][0] ) ) ? $stored_meta['_generate-full-width-content'][0] : '';
|
||||
$stored_meta['_generate-disable-headline'][0] = ( isset( $stored_meta['_generate-disable-headline'][0] ) ) ? $stored_meta['_generate-disable-headline'][0] : '';
|
||||
|
||||
$tabs = apply_filters( 'generate_metabox_tabs',
|
||||
$tabs = apply_filters(
|
||||
'generate_metabox_tabs',
|
||||
array(
|
||||
'sidebars' => array(
|
||||
'title' => esc_html__( 'Sidebars', 'generatepress' ),
|
||||
@ -92,7 +102,7 @@ function generate_do_layout_meta_box( $post ) {
|
||||
'class' => '',
|
||||
),
|
||||
'container' => array(
|
||||
'title' => esc_html__( 'Page Builder Container', 'generatepress' ),
|
||||
'title' => esc_html__( 'Content Container', 'generatepress' ),
|
||||
'target' => '#generate-layout-page-builder-container',
|
||||
'class' => '',
|
||||
),
|
||||
@ -120,7 +130,7 @@ function generate_do_layout_meta_box( $post ) {
|
||||
<div id="generate-meta-box-container">
|
||||
<ul class="generate-meta-box-menu">
|
||||
<?php
|
||||
foreach ( ( array ) $tabs as $tab => $data ) {
|
||||
foreach ( (array) $tabs as $tab => $data ) {
|
||||
echo '<li class="' . esc_attr( $data['class'] ) . '"><a data-target="' . esc_attr( $data['target'] ) . '" href="#">' . esc_html( $data['title'] ) . '</a></li>';
|
||||
}
|
||||
|
||||
@ -130,113 +140,60 @@ function generate_do_layout_meta_box( $post ) {
|
||||
<div class="generate-meta-box-content">
|
||||
<div id="generate-layout-sidebars">
|
||||
<div class="generate_layouts">
|
||||
<label for="meta-generate-layout-global" style="display:block;margin-bottom:10px;">
|
||||
<input type="radio" name="_generate-sidebar-layout-meta" id="meta-generate-layout-global" value="" <?php checked( $stored_meta['_generate-sidebar-layout-meta'][0], '' ); ?>>
|
||||
<?php esc_html_e( 'Default', 'generatepress' );?>
|
||||
</label>
|
||||
<label for="generate-sidebar-layout" class="generate-layout-metabox-section-title"><?php esc_html_e( 'Sidebar Layout', 'generatepress' ); ?></label>
|
||||
|
||||
<label for="meta-generate-layout-one" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( 'Right Sidebar', 'generatepress' );?>">
|
||||
<input type="radio" name="_generate-sidebar-layout-meta" id="meta-generate-layout-one" value="right-sidebar" <?php checked( $stored_meta['_generate-sidebar-layout-meta'][0], 'right-sidebar' ); ?>>
|
||||
<?php esc_html_e( 'Content', 'generatepress' );?> / <strong><?php echo esc_html_x( 'Sidebar', 'Short name for meta box', 'generatepress' ); ?></strong>
|
||||
</label>
|
||||
|
||||
<label for="meta-generate-layout-two" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( 'Left Sidebar', 'generatepress' );?>">
|
||||
<input type="radio" name="_generate-sidebar-layout-meta" id="meta-generate-layout-two" value="left-sidebar" <?php checked( $stored_meta['_generate-sidebar-layout-meta'][0], 'left-sidebar' ); ?>>
|
||||
<strong><?php echo esc_html_x( 'Sidebar', 'Short name for meta box', 'generatepress' ); ?></strong> / <?php esc_html_e( 'Content', 'generatepress' );?>
|
||||
</label>
|
||||
|
||||
<label for="meta-generate-layout-three" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( 'No Sidebars', 'generatepress' );?>">
|
||||
<input type="radio" name="_generate-sidebar-layout-meta" id="meta-generate-layout-three" value="no-sidebar" <?php checked( $stored_meta['_generate-sidebar-layout-meta'][0], 'no-sidebar' ); ?>>
|
||||
<?php esc_html_e( 'Content (no sidebars)', 'generatepress' );?>
|
||||
</label>
|
||||
|
||||
<label for="meta-generate-layout-four" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( 'Both Sidebars', 'generatepress' );?>">
|
||||
<input type="radio" name="_generate-sidebar-layout-meta" id="meta-generate-layout-four" value="both-sidebars" <?php checked( $stored_meta['_generate-sidebar-layout-meta'][0], 'both-sidebars' ); ?>>
|
||||
<strong><?php echo esc_html_x( 'Sidebar', 'Short name for meta box', 'generatepress' ); ?></strong> / <?php esc_html_e( 'Content', 'generatepress' );?> / <strong><?php echo esc_html_x( 'Sidebar', 'Short name for meta box', 'generatepress' ); ?></strong>
|
||||
</label>
|
||||
|
||||
<label for="meta-generate-layout-five" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( 'Both Sidebars on Left', 'generatepress' );?>">
|
||||
<input type="radio" name="_generate-sidebar-layout-meta" id="meta-generate-layout-five" value="both-left" <?php checked( $stored_meta['_generate-sidebar-layout-meta'][0], 'both-left' ); ?>>
|
||||
<strong><?php echo esc_html_x( 'Sidebar', 'Short name for meta box', 'generatepress' ); ?></strong> / <strong><?php echo esc_html_x( 'Sidebar', 'Short name for meta box', 'generatepress' ); ?></strong> / <?php esc_html_e( 'Content', 'generatepress' );?>
|
||||
</label>
|
||||
|
||||
<label for="meta-generate-layout-six" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( 'Both Sidebars on Right', 'generatepress' );?>">
|
||||
<input type="radio" name="_generate-sidebar-layout-meta" id="meta-generate-layout-six" value="both-right" <?php checked( $stored_meta['_generate-sidebar-layout-meta'][0], 'both-right' ); ?>>
|
||||
<?php esc_html_e( 'Content', 'generatepress' );?> / <strong><?php echo esc_html_x( 'Sidebar', 'Short name for meta box', 'generatepress' ); ?></strong> / <strong><?php echo esc_html_x( 'Sidebar', 'Short name for meta box', 'generatepress' ); ?></strong>
|
||||
</label>
|
||||
<select name="_generate-sidebar-layout-meta" id="generate-sidebar-layout">
|
||||
<option value="" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], '' ); ?>><?php esc_html_e( 'Default', 'generatepress' ); ?></option>
|
||||
<option value="right-sidebar" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], 'right-sidebar' ); ?>><?php esc_html_e( 'Right Sidebar', 'generatepress' ); ?></option>
|
||||
<option value="left-sidebar" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], 'left-sidebar' ); ?>><?php esc_html_e( 'Left Sidebar', 'generatepress' ); ?></option>
|
||||
<option value="no-sidebar" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], 'no-sidebar' ); ?>><?php esc_html_e( 'No Sidebars', 'generatepress' ); ?></option>
|
||||
<option value="both-sidebars" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], 'both-sidebars' ); ?>><?php esc_html_e( 'Both Sidebars', 'generatepress' ); ?></option>
|
||||
<option value="both-left" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], 'both-left' ); ?>><?php esc_html_e( 'Both Sidebars on Left', 'generatepress' ); ?></option>
|
||||
<option value="both-right" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], 'both-right' ); ?>><?php esc_html_e( 'Both Sidebars on Right', 'generatepress' ); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="generate-layout-footer-widgets" style="display: none;">
|
||||
<div class="generate_footer_widget">
|
||||
<label for="meta-generate-footer-widget-global" style="display:block;margin-bottom:10px;">
|
||||
<input type="radio" name="_generate-footer-widget-meta" id="meta-generate-footer-widget-global" value="" <?php checked( $stored_meta['_generate-footer-widget-meta'][0], '' ); ?>>
|
||||
<?php esc_html_e( 'Default', 'generatepress' );?>
|
||||
</label>
|
||||
<label for="generate-footer-widget" class="generate-layout-metabox-section-title"><?php esc_html_e( 'Footer Widgets', 'generatepress' ); ?></label>
|
||||
|
||||
<label for="meta-generate-footer-widget-zero" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( '0 Widgets', 'generatepress' );?>">
|
||||
<input type="radio" name="_generate-footer-widget-meta" id="meta-generate-footer-widget-zero" value="0" <?php checked( $stored_meta['_generate-footer-widget-meta'][0], '0' ); ?>>
|
||||
<?php esc_html_e( '0 Widgets', 'generatepress' );?>
|
||||
</label>
|
||||
|
||||
<label for="meta-generate-footer-widget-one" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( '1 Widget', 'generatepress' );?>">
|
||||
<input type="radio" name="_generate-footer-widget-meta" id="meta-generate-footer-widget-one" value="1" <?php checked( $stored_meta['_generate-footer-widget-meta'][0], '1' ); ?>>
|
||||
<?php esc_html_e( '1 Widget', 'generatepress' );?>
|
||||
</label>
|
||||
|
||||
<label for="meta-generate-footer-widget-two" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( '2 Widgets', 'generatepress' );?>">
|
||||
<input type="radio" name="_generate-footer-widget-meta" id="meta-generate-footer-widget-two" value="2" <?php checked( $stored_meta['_generate-footer-widget-meta'][0], '2' ); ?>>
|
||||
<?php esc_html_e( '2 Widgets', 'generatepress' );?>
|
||||
</label>
|
||||
|
||||
<label for="meta-generate-footer-widget-three" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( '3 Widgets', 'generatepress' );?>">
|
||||
<input type="radio" name="_generate-footer-widget-meta" id="meta-generate-footer-widget-three" value="3" <?php checked( $stored_meta['_generate-footer-widget-meta'][0], '3' ); ?>>
|
||||
<?php esc_html_e( '3 Widgets', 'generatepress' );?>
|
||||
</label>
|
||||
|
||||
<label for="meta-generate-footer-widget-four" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( '4 Widgets', 'generatepress' );?>">
|
||||
<input type="radio" name="_generate-footer-widget-meta" id="meta-generate-footer-widget-four" value="4" <?php checked( $stored_meta['_generate-footer-widget-meta'][0], '4' ); ?>>
|
||||
<?php esc_html_e( '4 Widgets', 'generatepress' );?>
|
||||
</label>
|
||||
|
||||
<label for="meta-generate-footer-widget-five" style="display:block;margin-bottom:3px;" title="<?php esc_attr_e( '5 Widgets', 'generatepress' );?>">
|
||||
<input type="radio" name="_generate-footer-widget-meta" id="meta-generate-footer-widget-five" value="5" <?php checked( $stored_meta['_generate-footer-widget-meta'][0], '5' ); ?>>
|
||||
<?php esc_html_e( '5 Widgets', 'generatepress' );?>
|
||||
</label>
|
||||
<select name="_generate-footer-widget-meta" id="generate-footer-widget">
|
||||
<option value="" <?php selected( $stored_meta['_generate-footer-widget-meta'][0], '' ); ?>><?php esc_html_e( 'Default', 'generatepress' ); ?></option>
|
||||
<option value="0" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], '0' ); ?>><?php esc_html_e( '0 Widgets', 'generatepress' ); ?></option>
|
||||
<option value="1" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], '1' ); ?>><?php esc_html_e( '1 Widgets', 'generatepress' ); ?></option>
|
||||
<option value="2" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], '2' ); ?>><?php esc_html_e( '2 Widgets', 'generatepress' ); ?></option>
|
||||
<option value="3" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], '3' ); ?>><?php esc_html_e( '3 Widgets', 'generatepress' ); ?></option>
|
||||
<option value="4" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], '4' ); ?>><?php esc_html_e( '4 Widgets', 'generatepress' ); ?></option>
|
||||
<option value="5" <?php selected( $stored_meta['_generate-sidebar-layout-meta'][0], '5' ); ?>><?php esc_html_e( '5 Widgets', 'generatepress' ); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="generate-layout-page-builder-container" style="display: none;">
|
||||
<label for="_generate-full-width-content" class="generate-layout-metabox-section-title"><?php esc_html_e( 'Content Container', 'generatepress' ); ?></label>
|
||||
|
||||
<p class="page-builder-content" style="color:#666;font-size:13px;margin-top:0;">
|
||||
<?php esc_html_e( 'Choose your page builder content container type. Both options remove the content padding for you.', 'generatepress' ) ;?>
|
||||
<?php esc_html_e( 'Choose your content container type.', 'generatepress' ); ?>
|
||||
</p>
|
||||
|
||||
<p class="generate_full_width_template">
|
||||
<label for="default-content" style="display:block;margin-bottom:10px;">
|
||||
<input type="radio" name="_generate-full-width-content" id="default-content" value="" <?php checked( $stored_meta['_generate-full-width-content'][0], '' ); ?>>
|
||||
<?php esc_html_e( 'Default', 'generatepress' );?>
|
||||
</label>
|
||||
|
||||
<label id="full-width-content" for="_generate-full-width-content" style="display:block;margin-bottom:10px;">
|
||||
<input type="radio" name="_generate-full-width-content" id="_generate-full-width-content" value="true" <?php checked( $stored_meta['_generate-full-width-content'][0], 'true' ); ?>>
|
||||
<?php esc_html_e( 'Full Width', 'generatepress' );?>
|
||||
</label>
|
||||
|
||||
<label id="generate-remove-padding" for="_generate-remove-content-padding" style="display:block;margin-bottom:10px;">
|
||||
<input type="radio" name="_generate-full-width-content" id="_generate-remove-content-padding" value="contained" <?php checked( $stored_meta['_generate-full-width-content'][0], 'contained' ); ?>>
|
||||
<?php esc_html_e( 'Contained', 'generatepress' );?>
|
||||
</label>
|
||||
</p>
|
||||
<select name="_generate-full-width-content" id="_generate-full-width-content">
|
||||
<option value="" <?php selected( $stored_meta['_generate-full-width-content'][0], '' ); ?>><?php esc_html_e( 'Default', 'generatepress' ); ?></option>
|
||||
<option value="true" <?php selected( $stored_meta['_generate-full-width-content'][0], 'true' ); ?>><?php esc_html_e( 'Full Width', 'generatepress' ); ?></option>
|
||||
<option value="contained" <?php selected( $stored_meta['_generate-full-width-content'][0], 'contained' ); ?>><?php esc_html_e( 'Contained', 'generatepress' ); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div id="generate-layout-disable-elements" style="display: none;">
|
||||
<label class="generate-layout-metabox-section-title"><?php esc_html_e( 'Disable Elements', 'generatepress' ); ?></label>
|
||||
<?php if ( ! defined( 'GENERATE_DE_VERSION' ) ) : ?>
|
||||
<div class="generate_disable_elements">
|
||||
<label for="meta-generate-disable-headline" style="display:block;margin: 0 0 1em;" title="<?php esc_attr_e( 'Content Title', 'generatepress' );?>">
|
||||
<label for="meta-generate-disable-headline" style="display:block;margin: 0 0 1em;" title="<?php esc_attr_e( 'Content Title', 'generatepress' ); ?>">
|
||||
<input type="checkbox" name="_generate-disable-headline" id="meta-generate-disable-headline" value="true" <?php checked( $stored_meta['_generate-disable-headline'][0], 'true' ); ?>>
|
||||
<?php esc_html_e( 'Content Title', 'generatepress' );?>
|
||||
<?php esc_html_e( 'Content Title', 'generatepress' ); ?>
|
||||
</label>
|
||||
|
||||
<?php if ( ! defined( 'GP_PREMIUM_VERSION' ) ) : ?>
|
||||
<span style="display:block;padding-top:1em;border-top:1px solid #EFEFEF;">
|
||||
<a href="<?php echo generate_get_premium_url( 'https://generatepress.com/downloads/generate-disable-elements' ); // WPCS: XSS ok, sanitization ok. ?>" target="_blank"><?php esc_html_e( 'Premium module available', 'generatepress' ); ?></a>
|
||||
<a href="<?php echo generate_get_premium_url( 'https://generatepress.com/downloads/generate-disable-elements' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in function. ?>" target="_blank"><?php esc_html_e( 'Premium module available', 'generatepress' ); ?></a>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@ -247,7 +204,7 @@ function generate_do_layout_meta_box( $post ) {
|
||||
<?php do_action( 'generate_layout_meta_box_content', $stored_meta ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
|
||||
add_action( 'save_post', 'generate_save_layout_meta_data' );
|
||||
@ -255,8 +212,7 @@ add_action( 'save_post', 'generate_save_layout_meta_data' );
|
||||
* Saves the sidebar layout meta data.
|
||||
*
|
||||
* @since 2.0
|
||||
*
|
||||
* @param int Post ID.
|
||||
* @param int $post_id Post ID.
|
||||
*/
|
||||
function generate_save_layout_meta_data( $post_id ) {
|
||||
$is_autosave = wp_is_post_autosave( $post_id );
|
||||
@ -299,7 +255,7 @@ function generate_save_layout_meta_data( $post_id ) {
|
||||
delete_post_meta( $post_id, $page_builder_container_key );
|
||||
}
|
||||
|
||||
// We only need this if the Disable Elements module doesn't exist
|
||||
// We only need this if the Disable Elements module doesn't exist.
|
||||
if ( ! defined( 'GENERATE_DE_VERSION' ) ) {
|
||||
$disable_content_title_key = '_generate-disable-headline';
|
||||
$disable_content_title_value = filter_input( INPUT_POST, $disable_content_title_key, FILTER_SANITIZE_STRING );
|
||||
|
@ -1,341 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Migrates old options on update.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
add_action( 'admin_init', 'generate_do_admin_db_updates' );
|
||||
/**
|
||||
* Process database updates if necessary.
|
||||
* There's nothing in here yet, but we're setting the version to use later.
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
function generate_do_admin_db_updates() {
|
||||
// Get the current version.
|
||||
$current_version = get_option( 'generate_db_version', false );
|
||||
|
||||
// Process future database updates here.
|
||||
|
||||
// Set the new database version.
|
||||
if ( version_compare( $current_version, GENERATE_VERSION, '<' ) ) {
|
||||
update_option( 'generate_db_version', GENERATE_VERSION, false );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'init', 'generate_do_db_updates', 5 );
|
||||
/**
|
||||
* Process important database updates when someone visits the front or backend.
|
||||
*
|
||||
* @since 2.3
|
||||
*/
|
||||
function generate_do_db_updates() {
|
||||
$flags = get_option( 'generate_migration_settings', array() );
|
||||
|
||||
if ( ! isset( $flags['combine_css'] ) || 'done' !== $flags['combine_css'] ) {
|
||||
if ( ! get_option( 'fresh_site' ) ) {
|
||||
$settings = get_option( 'generate_settings', array() );
|
||||
|
||||
$settings['combine_css'] = false;
|
||||
update_option( 'generate_settings', $settings );
|
||||
}
|
||||
|
||||
$flags['combine_css'] = 'done';
|
||||
update_option( 'generate_migration_settings', $flags );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_update_logo_setting' ) ) {
|
||||
add_action( 'admin_init', 'generate_update_logo_setting' );
|
||||
/**
|
||||
* Migrate the old logo database entry to the new custom_logo theme mod (WordPress 4.5)
|
||||
*
|
||||
* @since 1.3.29
|
||||
*/
|
||||
function generate_update_logo_setting() {
|
||||
// If we're not running WordPress 4.5, bail.
|
||||
if ( ! function_exists( 'the_custom_logo' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we already have a custom logo, bail.
|
||||
if ( get_theme_mod( 'custom_logo' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get our settings.
|
||||
$generate_settings = wp_parse_args(
|
||||
get_option( 'generate_settings', array() ),
|
||||
generate_get_defaults()
|
||||
);
|
||||
|
||||
// Get the old logo value.
|
||||
$old_value = $generate_settings['logo'];
|
||||
|
||||
// If there's no old value, bail.
|
||||
if ( empty( $old_value ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We made it this far, that means we have an old logo, and no new logo.
|
||||
|
||||
// Let's get the ID from our old value.
|
||||
$logo = attachment_url_to_postid( $old_value );
|
||||
|
||||
// Now let's update the new logo setting with our ID.
|
||||
if ( is_int( $logo ) ) {
|
||||
set_theme_mod( 'custom_logo', $logo );
|
||||
}
|
||||
|
||||
// Got our custom logo? Time to delete the old value
|
||||
if ( get_theme_mod( 'custom_logo' ) ) {
|
||||
$new_settings['logo'] = '';
|
||||
$update_settings = wp_parse_args( $new_settings, $generate_settings );
|
||||
update_option( 'generate_settings', $update_settings );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_typography_convert_values' ) ) {
|
||||
add_action( 'admin_init', 'generate_typography_convert_values' );
|
||||
/**
|
||||
* Take the old body font value and strip it of variants
|
||||
* This should only run once
|
||||
* @since 1.3.0
|
||||
*/
|
||||
function generate_typography_convert_values() {
|
||||
// Don't run this if Typography add-on is activated
|
||||
if ( function_exists( 'generate_fonts_customize_register' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we've done this before, bail
|
||||
if ( 'true' == get_option( 'generate_update_core_typography' ) || 'true' == get_option( 'generate_update_premium_typography' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get all settings
|
||||
$generate_settings = wp_parse_args(
|
||||
get_option( 'generate_settings', array() ),
|
||||
generate_get_default_fonts()
|
||||
);
|
||||
|
||||
// Get our body font family setting
|
||||
$value = $generate_settings['font_body'];
|
||||
|
||||
// Create a new, empty array
|
||||
$new_settings = array();
|
||||
|
||||
// If our value has : in it, and isn't empty
|
||||
if ( strpos( $value, ':' ) !== false && ! empty( $value ) ) {
|
||||
|
||||
// Remove the : and anything past it
|
||||
$value = current( explode( ':', $value ) );
|
||||
|
||||
// Populate our new array with our new, clean value
|
||||
$new_settings['font_body'] = $value;
|
||||
|
||||
}
|
||||
|
||||
// Update our options if our new array isn't empty
|
||||
if ( ! empty( $new_settings ) ) {
|
||||
$generate_new_typography_settings = wp_parse_args( $new_settings, $generate_settings );
|
||||
update_option( 'generate_settings', $generate_new_typography_settings );
|
||||
}
|
||||
|
||||
// All done, set an option so we don't go through this again
|
||||
update_option( 'generate_update_core_typography','true' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_typography_set_font_data' ) ) {
|
||||
add_action( 'admin_init', 'generate_typography_set_font_data' );
|
||||
/**
|
||||
* This function will check to see if your category and variants are saved
|
||||
* If not, it will set them for you
|
||||
* Generally, set_theme_mod isn't best practice, but this is here for migration purposes for a set amount of time only
|
||||
* Any time a user saves a font in the Customizer from now on, the category and variants are saved as theme_mods, so this function won't be necessary.
|
||||
*
|
||||
* @since 1.3.40
|
||||
*/
|
||||
function generate_typography_set_font_data() {
|
||||
// Get our defaults
|
||||
$defaults = generate_get_default_fonts();
|
||||
|
||||
// Get our settings
|
||||
$generate_settings = wp_parse_args(
|
||||
get_option( 'generate_settings', array() ),
|
||||
$defaults
|
||||
);
|
||||
|
||||
// We don't need to do this if we're using the default font, as these values have defaults already
|
||||
if ( $defaults['font_body'] == $generate_settings['font_body'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't need to continue if we're using a system font or our default font
|
||||
if ( in_array( $generate_settings['font_body'], generate_typography_default_fonts() ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't continue if our category and variants are already set
|
||||
if ( get_theme_mod( 'font_body_category' ) && get_theme_mod( 'font_body_variants' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get all of our fonts
|
||||
$fonts = generate_get_all_google_fonts();
|
||||
|
||||
// Get the ID from our font
|
||||
$id = strtolower( str_replace( ' ', '_', $generate_settings['font_body'] ) );
|
||||
|
||||
// If the ID doesn't exist within our fonts, we can bail
|
||||
if ( ! array_key_exists( $id, $fonts ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Let's grab our category to go with our font
|
||||
$category = ! empty( $fonts[$id]['category'] ) ? $fonts[$id]['category'] : '';
|
||||
|
||||
// Grab all of the variants associated with our font
|
||||
$variants = $fonts[$id]['variants'];
|
||||
|
||||
// Loop through our variants and put them into an array, then turn them into a comma separated list
|
||||
$output = array();
|
||||
if ( $variants ) {
|
||||
foreach ( $variants as $variant ) {
|
||||
$output[] = $variant;
|
||||
}
|
||||
$variants = implode(',', $output);
|
||||
}
|
||||
|
||||
// Set our theme mods with our new settings
|
||||
if ( '' !== $category ) {
|
||||
set_theme_mod( 'font_body_category', $category );
|
||||
}
|
||||
|
||||
if ( '' !== $variants ) {
|
||||
set_theme_mod( 'font_body_variants', $variants );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'admin_init', 'generate_migrate_existing_settings', 1 );
|
||||
/**
|
||||
* Execute functions after existing sites update.
|
||||
*
|
||||
* We check to see if options already exist. If they do, we can assume the user has
|
||||
* updated the theme, and not installed it from scratch.
|
||||
*
|
||||
* We run this right away in the Dashboard to avoid other migration functions from
|
||||
* setting options and causing these functions to run on fresh installs.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
function generate_migrate_existing_settings() {
|
||||
// Existing settings with no defaults.
|
||||
$existing_settings = get_option( 'generate_settings' );
|
||||
|
||||
if ( get_theme_mod( 'font_body_variants', '' ) ) {
|
||||
$existing_settings['font_body_variants'] = get_theme_mod( 'font_body_variants' );
|
||||
}
|
||||
|
||||
if ( get_theme_mod( 'font_body_category', '' ) ) {
|
||||
$existing_settings['font_body_category'] = get_theme_mod( 'font_body_category' );
|
||||
}
|
||||
|
||||
// Existing settings with defaults.
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_settings', array() ),
|
||||
generate_get_defaults()
|
||||
);
|
||||
|
||||
// Empty arrays to add data to.
|
||||
$migrated_flags = array();
|
||||
$new_settings = array();
|
||||
|
||||
// An option to see what we've migrated.
|
||||
$migration_settings = get_option( 'generate_migration_settings', array() );
|
||||
|
||||
// We have settings, so this isn't a fresh install.
|
||||
if ( ! empty( $existing_settings ) ) {
|
||||
|
||||
// Turn on the full Font Awesome library for existing websites.
|
||||
if ( ! isset( $migration_settings['font_awesome_essentials_updated'] ) || 'true' !== $migration_settings['font_awesome_essentials_updated'] ) {
|
||||
$new_settings['font_awesome_essentials'] = false;
|
||||
}
|
||||
|
||||
// Turn off dynamic CSS caching for existing websites.
|
||||
if ( ! isset( $migration_settings['skip_dynamic_css_cache'] ) || 'true' !== $migration_settings['skip_dynamic_css_cache'] ) {
|
||||
$new_settings['dynamic_css_cache'] = false;
|
||||
}
|
||||
|
||||
// Set our font family to Open Sans if we never saved a different font.
|
||||
if ( ! isset( $migration_settings['default_font_updated'] ) || 'true' !== $migration_settings['default_font_updated'] ) {
|
||||
$generate_settings = wp_parse_args(
|
||||
get_option( 'generate_settings', array() ),
|
||||
array(
|
||||
'font_body' => 'Open Sans',
|
||||
)
|
||||
);
|
||||
|
||||
$category = get_theme_mod( 'font_body_category', 'sans-serif' );
|
||||
$variants = get_theme_mod( 'font_body_variants', '300,300italic,regular,italic,600,600italic,700,700italic,800,800italic' );
|
||||
|
||||
if ( 'Open Sans' == $generate_settings['font_body'] ) {
|
||||
$new_settings['font_body'] = 'Open Sans';
|
||||
set_theme_mod( 'font_body_category', $category );
|
||||
set_theme_mod( 'font_body_variants', $variants );
|
||||
}
|
||||
}
|
||||
|
||||
// Set blog post content to full content if it hasn't been set otherwise.
|
||||
if ( ! isset( $migration_settings['blog_post_content_preview'] ) || 'true' !== $migration_settings['blog_post_content_preview'] ) {
|
||||
$generate_settings = wp_parse_args(
|
||||
get_option( 'generate_settings', array() ),
|
||||
array(
|
||||
'post_content' => 'full',
|
||||
)
|
||||
);
|
||||
|
||||
if ( 'full' === $generate_settings['post_content'] ) {
|
||||
$new_settings['post_content'] = 'full';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Set our flags.
|
||||
if ( ! isset( $migration_settings['font_awesome_essentials_updated'] ) || 'true' !== $migration_settings['font_awesome_essentials_updated'] ) {
|
||||
$migrated_flags['font_awesome_essentials_updated'] = 'true';
|
||||
}
|
||||
|
||||
if ( ! isset( $migration_settings['skip_dynamic_css_cache'] ) || 'true' !== $migration_settings['skip_dynamic_css_cache'] ) {
|
||||
$migrated_flags['skip_dynamic_css_cache'] = 'true';
|
||||
}
|
||||
|
||||
if ( ! isset( $migration_settings['default_font_updated'] ) || 'true' !== $migration_settings['default_font_updated'] ) {
|
||||
$migrated_flags['default_font_updated'] = 'true';
|
||||
}
|
||||
|
||||
if ( ! isset( $migration_settings['blog_post_content_preview'] ) || 'true' !== $migration_settings['blog_post_content_preview'] ) {
|
||||
$migrated_flags['blog_post_content_preview'] = 'true';
|
||||
}
|
||||
|
||||
// Merge our new settings with our existing settings.
|
||||
if ( ! empty( $new_settings ) ) {
|
||||
$update_settings = wp_parse_args( $new_settings, $settings );
|
||||
update_option( 'generate_settings', $update_settings );
|
||||
}
|
||||
|
||||
// Set our migrated setting flags.
|
||||
if ( ! empty( $migrated_flags ) ) {
|
||||
$update_migration_flags = wp_parse_args( $migrated_flags, $migration_settings );
|
||||
update_option( 'generate_migration_settings', $update_migration_flags );
|
||||
}
|
||||
}
|
@ -41,7 +41,7 @@ if ( ! function_exists( 'generate_woocommerce_start' ) ) {
|
||||
*/
|
||||
function generate_woocommerce_start() {
|
||||
?>
|
||||
<div id="primary" <?php generate_do_element_classes( 'content' );?>>
|
||||
<div id="primary" <?php generate_do_element_classes( 'content' ); ?>>
|
||||
<main id="main" <?php generate_do_element_classes( 'main' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
@ -62,9 +62,15 @@ if ( ! function_exists( 'generate_woocommerce_start' ) ) {
|
||||
* @hooked generate_featured_page_header_inside_single - 10
|
||||
*/
|
||||
do_action( 'generate_before_content' );
|
||||
|
||||
$itemprop = '';
|
||||
|
||||
if ( 'microdata' === generate_get_schema_type() ) {
|
||||
$itemprop = ' itemprop="text"';
|
||||
}
|
||||
?>
|
||||
<div class="entry-content" itemprop="text">
|
||||
<?php
|
||||
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,7 +83,7 @@ if ( ! function_exists( 'generate_woocommerce_end' ) ) {
|
||||
*/
|
||||
function generate_woocommerce_end() {
|
||||
?>
|
||||
</div><!-- .entry-content -->
|
||||
</div>
|
||||
<?php
|
||||
/**
|
||||
* generate_after_content hook.
|
||||
@ -86,8 +92,8 @@ if ( ! function_exists( 'generate_woocommerce_end' ) ) {
|
||||
*/
|
||||
do_action( 'generate_after_content' );
|
||||
?>
|
||||
</div><!-- .inside-article -->
|
||||
</article><!-- #post-## -->
|
||||
</div>
|
||||
</article>
|
||||
<?php
|
||||
/**
|
||||
* generate_after_main_content hook.
|
||||
@ -96,9 +102,9 @@ if ( ! function_exists( 'generate_woocommerce_end' ) ) {
|
||||
*/
|
||||
do_action( 'generate_after_main_content' );
|
||||
?>
|
||||
</main><!-- #main -->
|
||||
</div><!-- #primary -->
|
||||
<?php
|
||||
</main>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
@ -241,9 +247,15 @@ if ( ! function_exists( 'generate_beaver_builder_css' ) ) {
|
||||
* @since 1.3.45
|
||||
*/
|
||||
function generate_beaver_builder_css() {
|
||||
if ( generate_is_using_flexbox() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$body_classes = get_body_class();
|
||||
|
||||
// Check is Beaver Builder is active
|
||||
// If we have the full-width-content class, we don't need to do anything else
|
||||
if ( in_array( 'fl-builder', get_body_class() ) && ! in_array( 'full-width-content', get_body_class() ) && ! in_array( 'contained-content', get_body_class() ) ) {
|
||||
// If we have the full-width-content class, we don't need to do anything else.
|
||||
if ( in_array( 'fl-builder', $body_classes ) && ! in_array( 'full-width-content', $body_classes ) && ! in_array( 'contained-content', $body_classes ) ) {
|
||||
global $post;
|
||||
|
||||
if ( ! isset( $post ) ) {
|
||||
@ -266,3 +278,550 @@ if ( ! function_exists( 'generate_beaver_builder_css' ) ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'generate_do_third_party_plugin_css', 50 );
|
||||
/**
|
||||
* Add CSS for third-party plugins.
|
||||
*
|
||||
* @since 3.0.1
|
||||
*/
|
||||
function generate_do_third_party_plugin_css() {
|
||||
$css = new GeneratePress_CSS();
|
||||
|
||||
if ( generate_is_using_flexbox() && class_exists( 'Elementor\Plugin' ) ) {
|
||||
$css->set_selector( '.elementor-template-full-width .site-content' );
|
||||
$css->add_property( 'display', 'block' );
|
||||
}
|
||||
|
||||
if ( $css->css_output() ) {
|
||||
wp_add_inline_style( 'generate-style', $css->css_output() );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'generate_do_pro_compatibility', 50 );
|
||||
/**
|
||||
* Add CSS to ensure compatibility with GP Premium.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_do_pro_compatibility() {
|
||||
if ( ! defined( 'GP_PREMIUM_VERSION' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$css = new GeneratePress_CSS();
|
||||
|
||||
if ( version_compare( GP_PREMIUM_VERSION, '1.11.0-alpha.1', '<' ) ) {
|
||||
if ( generate_is_using_flexbox() && defined( 'GENERATE_SECONDARY_NAV_VERSION' ) ) {
|
||||
$css->set_selector( '.secondary-navigation .inside-navigation:before, .secondary-navigation .inside-navigation:after' );
|
||||
$css->add_property( 'content', '"."' );
|
||||
$css->add_property( 'display', 'block' );
|
||||
$css->add_property( 'overflow', 'hidden' );
|
||||
$css->add_property( 'visibility', 'hidden' );
|
||||
$css->add_property( 'font-size', '0px' );
|
||||
$css->add_property( 'line-height', '0px' );
|
||||
$css->add_property( 'width', '0px' );
|
||||
$css->add_property( 'height', '0px' );
|
||||
|
||||
$css->set_selector( '.secondary-navigation .inside-navigation:after' );
|
||||
$css->add_property( 'clear', 'both' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( version_compare( GP_PREMIUM_VERSION, '1.12.0-alpha.1', '<' ) ) {
|
||||
if ( defined( 'GENERATE_MENU_PLUS_VERSION' ) && function_exists( 'generate_menu_plus_get_defaults' ) ) {
|
||||
$menu_plus_settings = wp_parse_args(
|
||||
get_option( 'generate_menu_plus_settings', array() ),
|
||||
generate_menu_plus_get_defaults()
|
||||
);
|
||||
|
||||
if ( generate_is_using_flexbox() && ( 'true' === $menu_plus_settings['sticky_menu'] || 'desktop' === $menu_plus_settings['sticky_menu'] || 'mobile' === $menu_plus_settings['sticky_menu'] || 'enable' === $menu_plus_settings['mobile_header_sticky'] ) ) {
|
||||
if ( generate_has_inline_mobile_toggle() ) {
|
||||
$css->start_media_query( generate_get_media_query( 'mobile-menu' ) );
|
||||
|
||||
$css->set_selector( '#sticky-placeholder' );
|
||||
$css->add_property( 'height', '0' );
|
||||
$css->add_property( 'overflow', 'hidden' );
|
||||
|
||||
$css->set_selector( '.has-inline-mobile-toggle #site-navigation.toggled' );
|
||||
$css->add_property( 'margin-top', '0' );
|
||||
|
||||
$css->set_selector( '.has-inline-mobile-menu #site-navigation.toggled .main-nav > ul' );
|
||||
$css->add_property( 'top', '1.5em' );
|
||||
|
||||
$css->stop_media_query();
|
||||
}
|
||||
|
||||
if ( 'desktop' === $menu_plus_settings['sticky_menu'] ) {
|
||||
$css->set_selector( '.sticky-enabled .gen-sidebar-nav.is_stuck .main-navigation' );
|
||||
$css->add_property( 'margin-bottom', '0' );
|
||||
|
||||
$css->set_selector( '.sticky-enabled .gen-sidebar-nav.is_stuck' );
|
||||
$css->add_property( 'z-index', '500' );
|
||||
|
||||
$css->set_selector( '.sticky-enabled .main-navigation.is_stuck' );
|
||||
$css->add_property( 'box-shadow', '0 2px 2px -2px rgba(0, 0, 0, .2)' );
|
||||
|
||||
$css->set_selector( '.navigation-stick:not(.gen-sidebar-nav)' );
|
||||
$css->add_property( 'left', '0' );
|
||||
$css->add_property( 'right', '0' );
|
||||
$css->add_property( 'width', '100% !important' );
|
||||
|
||||
$css->set_selector( '.both-sticky-menu .main-navigation:not(#mobile-header).toggled .main-nav > ul,.mobile-sticky-menu .main-navigation:not(#mobile-header).toggled .main-nav > ul,.mobile-header-sticky #mobile-header.toggled .main-nav > ul' );
|
||||
$css->add_property( 'position', 'absolute' );
|
||||
$css->add_property( 'left', '0' );
|
||||
$css->add_property( 'right', '0' );
|
||||
$css->add_property( 'z-index', '999' );
|
||||
}
|
||||
|
||||
$css->set_selector( '.nav-float-right .navigation-stick' );
|
||||
$css->add_property( 'width', '100% !important' );
|
||||
$css->add_property( 'left', '0' );
|
||||
|
||||
$css->set_selector( '.nav-float-right .navigation-stick .navigation-branding' );
|
||||
$css->add_property( 'margin-right', 'auto' );
|
||||
|
||||
if ( ! $menu_plus_settings['navigation_as_header'] ) {
|
||||
$header_left = 40;
|
||||
$header_right = 40;
|
||||
$mobile_header_left = 30;
|
||||
$mobile_header_right = 30;
|
||||
|
||||
if ( function_exists( 'generate_spacing_get_defaults' ) ) {
|
||||
$spacing_settings = wp_parse_args(
|
||||
get_option( 'generate_spacing_settings', array() ),
|
||||
generate_spacing_get_defaults()
|
||||
);
|
||||
|
||||
$header_left = $spacing_settings['header_left'];
|
||||
$header_right = $spacing_settings['header_right'];
|
||||
$mobile_header_left = $spacing_settings['mobile_header_left'];
|
||||
$mobile_header_right = $spacing_settings['mobile_header_right'];
|
||||
}
|
||||
|
||||
if ( function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox() ) {
|
||||
if ( function_exists( 'generate_get_option' ) && 'text' === generate_get_option( 'container_alignment' ) ) {
|
||||
$css->set_selector( '.main-navigation.navigation-stick .inside-navigation.grid-container' );
|
||||
$css->add_property( 'padding-left', $header_left, false, 'px' );
|
||||
$css->add_property( 'padding-right', $header_right, false, 'px' );
|
||||
|
||||
$css->start_media_query( generate_get_media_query( 'mobile-menu' ) );
|
||||
$css->set_selector( '.main-navigation.navigation-stick .inside-navigation.grid-container' );
|
||||
$css->add_property( 'padding-left', $mobile_header_left, false, 'px' );
|
||||
$css->add_property( 'padding-right', $mobile_header_right, false, 'px' );
|
||||
$css->stop_media_query();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$css->set_selector( '.nav-float-right .main-navigation.has-branding:not([class*="nav-align-"]):not(.mobile-header-navigation) .menu-bar-items,.nav-float-right .main-navigation.has-sticky-branding.navigation-stick:not([class*="nav-align-"]):not(.mobile-header-navigation) .menu-bar-items' );
|
||||
$css->add_property( 'margin-left', '0' );
|
||||
}
|
||||
|
||||
if ( generate_has_inline_mobile_toggle() && 'false' !== $menu_plus_settings['slideout_menu'] ) {
|
||||
$css->set_selector( '.slideout-mobile .has-inline-mobile-toggle #site-navigation.toggled,.slideout-both .has-inline-mobile-toggle #site-navigation.toggled' );
|
||||
$css->add_property( 'margin-top', '0' );
|
||||
}
|
||||
|
||||
if ( 'font' === generate_get_option( 'icons' ) ) {
|
||||
$css->set_selector( '.main-navigation .slideout-toggle a:before,.slide-opened .slideout-overlay .slideout-exit:before' );
|
||||
$css->add_property( 'font-family', 'GeneratePress' );
|
||||
|
||||
$css->set_selector( '.slideout-navigation .dropdown-menu-toggle:before' );
|
||||
$css->add_property( 'content', '"\f107" !important' );
|
||||
|
||||
$css->set_selector( '.slideout-navigation .sfHover > a .dropdown-menu-toggle:before' );
|
||||
$css->add_property( 'content', '"\f106" !important' );
|
||||
}
|
||||
|
||||
if ( generate_is_using_flexbox() && $menu_plus_settings['navigation_as_header'] ) {
|
||||
$content_left = 40;
|
||||
$content_right = 40;
|
||||
|
||||
if ( function_exists( 'generate_spacing_get_defaults' ) ) {
|
||||
$spacing_settings = wp_parse_args(
|
||||
get_option( 'generate_spacing_settings', array() ),
|
||||
generate_spacing_get_defaults()
|
||||
);
|
||||
|
||||
$content_left = $spacing_settings['content_left'];
|
||||
$content_right = $spacing_settings['content_right'];
|
||||
}
|
||||
|
||||
if ( 'text' === generate_get_option( 'container_alignment' ) ) {
|
||||
$css->set_selector( '.main-navigation.has-branding .inside-navigation.grid-container, .main-navigation.has-branding .inside-navigation.grid-container' );
|
||||
$css->add_property( 'padding', generate_padding_css( 0, $content_right, 0, $content_left ) );
|
||||
}
|
||||
|
||||
$css->set_selector( '.navigation-branding' );
|
||||
$css->add_property( 'margin-left', '10px' );
|
||||
|
||||
$css->set_selector( '.navigation-branding .main-title, .mobile-header-navigation .site-logo' );
|
||||
$css->add_property( 'margin-left', '10px' );
|
||||
|
||||
if ( is_rtl() ) {
|
||||
$css->set_selector( '.navigation-branding' );
|
||||
$css->add_property( 'margin-left', 'auto' );
|
||||
$css->add_property( 'margin-right', '10px' );
|
||||
|
||||
$css->set_selector( '.navigation-branding .main-title, .mobile-header-navigation .site-logo' );
|
||||
$css->add_property( 'margin-right', '10px' );
|
||||
$css->add_property( 'margin-left', '0' );
|
||||
}
|
||||
|
||||
$css->set_selector( '.navigation-branding > div + .main-title' );
|
||||
$css->add_property( 'margin-left', '10px' );
|
||||
|
||||
if ( is_rtl() ) {
|
||||
$css->set_selector( '.navigation-branding > div + .main-title' );
|
||||
$css->add_property( 'margin-right', '10px' );
|
||||
}
|
||||
|
||||
$css->set_selector( '.has-branding .navigation-branding img' );
|
||||
$css->add_property( 'margin', '0' );
|
||||
|
||||
$css->start_media_query( generate_get_media_query( 'mobile-menu' ) );
|
||||
if ( 'text' === generate_get_option( 'container_alignment' ) ) {
|
||||
$css->set_selector( '.main-navigation.has-branding .inside-navigation.grid-container' );
|
||||
$css->add_property( 'padding', '0' );
|
||||
}
|
||||
$css->stop_media_query();
|
||||
}
|
||||
}
|
||||
|
||||
if ( defined( 'GENERATE_SPACING_VERSION' ) ) {
|
||||
if ( generate_is_using_flexbox() ) {
|
||||
$css->set_selector( '#footer-widgets, .site-info' );
|
||||
$css->add_property( 'padding', '0' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( defined( 'GENERATE_SECONDARY_NAV_VERSION' ) ) {
|
||||
if ( generate_is_using_flexbox() && has_nav_menu( 'secondary' ) ) {
|
||||
if ( 'text' === generate_get_option( 'container_alignment' ) && function_exists( 'generate_secondary_nav_get_defaults' ) ) {
|
||||
$secondary_nav_settings = wp_parse_args(
|
||||
get_option( 'generate_secondary_nav_settings', array() ),
|
||||
generate_secondary_nav_get_defaults()
|
||||
);
|
||||
|
||||
$spacing_settings = wp_parse_args(
|
||||
get_option( 'generate_spacing_settings', array() ),
|
||||
generate_spacing_get_defaults()
|
||||
);
|
||||
|
||||
$navigation_left_padding = absint( $spacing_settings['header_left'] ) - absint( $secondary_nav_settings['secondary_menu_item'] );
|
||||
$navigation_right_padding = absint( $spacing_settings['header_right'] ) - absint( $secondary_nav_settings['secondary_menu_item'] );
|
||||
|
||||
$css->set_selector( '.secondary-nav-below-header .secondary-navigation .inside-navigation.grid-container, .secondary-nav-above-header .secondary-navigation .inside-navigation.grid-container' );
|
||||
$css->add_property( 'padding', generate_padding_css( 0, $navigation_right_padding, 0, $navigation_left_padding ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( generate_is_using_flexbox() && defined( 'GENERATE_FONT_VERSION' ) && function_exists( 'generate_get_default_fonts' ) ) {
|
||||
$font_settings = wp_parse_args(
|
||||
get_option( 'generate_settings', array() ),
|
||||
generate_get_default_fonts()
|
||||
);
|
||||
|
||||
if ( isset( $font_settings['tablet_navigation_font_size'] ) && '' !== $font_settings['tablet_navigation_font_size'] ) {
|
||||
$css->start_media_query( generate_get_media_query( 'tablet' ) );
|
||||
$css->set_selector( '.main-navigation .menu-toggle' );
|
||||
$css->add_property( 'font-size', absint( $font_settings['tablet_navigation_font_size'] ), false, 'px' );
|
||||
$css->stop_media_query();
|
||||
}
|
||||
|
||||
if ( isset( $font_settings['mobile_navigation_font_size'] ) && '' !== $font_settings['mobile_navigation_font_size'] ) {
|
||||
$css->start_media_query( generate_get_media_query( 'mobile-menu' ) );
|
||||
$css->set_selector( '.main-navigation .menu-toggle' );
|
||||
$css->add_property( 'font-size', absint( $font_settings['mobile_navigation_font_size'] ), false, 'px' );
|
||||
$css->stop_media_query();
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! generate_show_title() ) {
|
||||
$css->set_selector( '.page .entry-content' )->add_property( 'margin-top', '0px' );
|
||||
|
||||
if ( is_single() ) {
|
||||
if ( ! apply_filters( 'generate_post_author', true ) && ! apply_filters( 'generate_post_date', true ) ) {
|
||||
$css->set_selector( '.single .entry-content' )->add_property( 'margin-top', '0' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $css->css_output() ) {
|
||||
wp_add_inline_style( 'generate-style', $css->css_output() );
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'generate_menu_item_dropdown_arrow_direction', 'generate_set_pro_menu_item_arrow_directions', 10, 3 );
|
||||
/**
|
||||
* Set the menu item arrow directions for Secondary and Slideout navs.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param string $arrow_direction The current direction.
|
||||
* @param object $args The args for the current menu.
|
||||
* @param int $depth The current depth of the menu item.
|
||||
*/
|
||||
function generate_set_pro_menu_item_arrow_directions( $arrow_direction, $args, $depth ) {
|
||||
if ( function_exists( 'generate_secondary_nav_get_defaults' ) && 'secondary' === $args->theme_location ) {
|
||||
$settings = wp_parse_args(
|
||||
get_option( 'generate_secondary_nav_settings', array() ),
|
||||
generate_secondary_nav_get_defaults()
|
||||
);
|
||||
|
||||
if ( 0 !== $depth ) {
|
||||
$arrow_direction = 'right';
|
||||
|
||||
if ( 'left' === $settings['secondary_nav_dropdown_direction'] ) {
|
||||
$arrow_direction = 'left';
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'secondary-nav-left-sidebar' === $settings['secondary_nav_position_setting'] ) {
|
||||
$arrow_direction = 'right';
|
||||
|
||||
if ( 'both-right' === generate_get_layout() ) {
|
||||
$arrow_direction = 'left';
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'secondary-nav-right-sidebar' === $settings['secondary_nav_position_setting'] ) {
|
||||
$arrow_direction = 'left';
|
||||
|
||||
if ( 'both-left' === generate_get_layout() ) {
|
||||
$arrow_direction = 'right';
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'hover' !== generate_get_option( 'nav_dropdown_type' ) ) {
|
||||
$arrow_direction = 'down';
|
||||
}
|
||||
}
|
||||
|
||||
return $arrow_direction;
|
||||
}
|
||||
|
||||
add_filter( 'generate_menu_plus_option_defaults', 'generate_set_menu_plus_compat_defaults' );
|
||||
/**
|
||||
* Set defaults in our pro Menu Plus module.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param array $defaults The existing defaults.
|
||||
*/
|
||||
function generate_set_menu_plus_compat_defaults( $defaults ) {
|
||||
if ( generate_has_inline_mobile_toggle() ) {
|
||||
$defaults['mobile_menu_label'] = '';
|
||||
}
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
|
||||
add_filter( 'generate_spacing_option_defaults', 'generate_set_spacing_compat_defaults', 20 );
|
||||
/**
|
||||
* Set defaults in our pro Spacing module.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param array $defaults The existing defaults.
|
||||
*/
|
||||
function generate_set_spacing_compat_defaults( $defaults ) {
|
||||
$defaults['mobile_header_top'] = '';
|
||||
$defaults['mobile_header_bottom'] = '';
|
||||
$defaults['mobile_header_right'] = '30';
|
||||
$defaults['mobile_header_left'] = '30';
|
||||
|
||||
$defaults['mobile_widget_top'] = '30';
|
||||
$defaults['mobile_widget_right'] = '30';
|
||||
$defaults['mobile_widget_bottom'] = '30';
|
||||
$defaults['mobile_widget_left'] = '30';
|
||||
|
||||
$defaults['mobile_footer_widget_container_top'] = '30';
|
||||
$defaults['mobile_footer_widget_container_right'] = '30';
|
||||
$defaults['mobile_footer_widget_container_bottom'] = '30';
|
||||
$defaults['mobile_footer_widget_container_left'] = '30';
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
|
||||
add_filter( 'generate_page_hero_css_output', 'generate_do_pro_page_hero_css', 10, 2 );
|
||||
/**
|
||||
* Add CSS to our premium Page Heroes.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param string $css_output Existing CSS.
|
||||
* @param array $options The Header Element options.
|
||||
*/
|
||||
function generate_do_pro_page_hero_css( $css_output, $options ) {
|
||||
if ( ! defined( 'GP_PREMIUM_VERSION' ) ) {
|
||||
return $css_output;
|
||||
}
|
||||
|
||||
$new_css = '';
|
||||
|
||||
if ( version_compare( GP_PREMIUM_VERSION, '1.12.0-alpha.1', '<' ) ) {
|
||||
$css = new GeneratePress_CSS();
|
||||
|
||||
$padding_inside = false;
|
||||
|
||||
if ( generate_is_using_flexbox() && 'text' === generate_get_option( 'container_alignment' ) ) {
|
||||
$padding_inside = true;
|
||||
}
|
||||
|
||||
if ( $padding_inside ) {
|
||||
$container_width = generate_get_option( 'container_width' );
|
||||
$padding_right = '0px';
|
||||
$padding_left = '0px';
|
||||
|
||||
if ( $options['padding_right'] ) {
|
||||
$padding_right = absint( $options['padding_right'] ) . $options['padding_right_unit'];
|
||||
}
|
||||
|
||||
if ( $options['padding_left'] ) {
|
||||
$padding_left = absint( $options['padding_left'] ) . $options['padding_left_unit'];
|
||||
}
|
||||
|
||||
$css->set_selector( '.page-hero .inside-page-hero.grid-container' );
|
||||
|
||||
$css->add_property(
|
||||
'max-width',
|
||||
sprintf(
|
||||
'calc(%1$s - %2$s - %3$s)',
|
||||
$container_width . 'px',
|
||||
$padding_right,
|
||||
$padding_left
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ( generate_is_using_flexbox() && '' !== $options['site_header_merge'] ) {
|
||||
if ( 'merge-desktop' === $options['site_header_merge'] ) {
|
||||
$css->start_media_query( apply_filters( 'generate_not_mobile_media_query', '(min-width: 769px)' ) );
|
||||
}
|
||||
|
||||
if ( $options['navigation_colors'] ) {
|
||||
$navigation_background = $options['navigation_background_color'] ? $options['navigation_background_color'] : 'transparent';
|
||||
$navigation_background_hover = $options['navigation_background_color_hover'] ? $options['navigation_background_color_hover'] : 'transparent';
|
||||
|
||||
$css->set_selector( '.header-wrap #site-navigation:not(.toggled), .header-wrap #mobile-header:not(.toggled):not(.navigation-stick), .has-inline-mobile-toggle .mobile-menu-control-wrapper' );
|
||||
$css->add_property( 'background', $navigation_background );
|
||||
|
||||
$css->set_selector( '.main-navigation:not(.toggled):not(.navigation-stick) .menu-bar-item:not(.close-search) > a' );
|
||||
$css->add_property( 'color', esc_attr( $options['navigation_text_color'] ) );
|
||||
|
||||
$css->set_selector( '.header-wrap #site-navigation:not(.toggled) .menu-bar-item:not(.close-search):hover > a, .header-wrap #mobile-header:not(.toggled) .menu-bar-item:not(.close-search):hover > a, .header-wrap #site-navigation:not(.toggled) .menu-bar-item:not(.close-search).sfHover > a, .header-wrap #mobile-header:not(.toggled) .menu-bar-item:not(.close-search).sfHover > a' );
|
||||
$css->add_property( 'background', $navigation_background_hover );
|
||||
|
||||
if ( '' !== $options['navigation_text_color_hover'] ) {
|
||||
$css->add_property( 'color', esc_attr( $options['navigation_text_color_hover'] ) );
|
||||
} else {
|
||||
$css->add_property( 'color', esc_attr( $options['navigation_text_color'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'merge-desktop' === $options['site_header_merge'] ) {
|
||||
$css->stop_media_query();
|
||||
}
|
||||
}
|
||||
|
||||
if ( $css->css_output() ) {
|
||||
$new_css = $css->css_output();
|
||||
}
|
||||
}
|
||||
|
||||
return $css_output . $new_css;
|
||||
}
|
||||
|
||||
add_action( 'customize_register', 'generate_pro_compat_customize_register', 100 );
|
||||
/**
|
||||
* Alter some Customizer options in the pro version.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param object $wp_customize The Customizer object.
|
||||
*/
|
||||
function generate_pro_compat_customize_register( $wp_customize ) {
|
||||
if ( ! defined( 'GP_PREMIUM_VERSION' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( version_compare( GP_PREMIUM_VERSION, '1.12.0-alpha.1', '<' ) ) {
|
||||
if ( $wp_customize->get_setting( 'generate_spacing_settings[separator]' ) ) {
|
||||
$wp_customize->get_setting( 'generate_spacing_settings[separator]' )->transport = 'refresh';
|
||||
}
|
||||
|
||||
if ( $wp_customize->get_setting( 'generate_spacing_settings[right_sidebar_width]' ) ) {
|
||||
$wp_customize->get_setting( 'generate_spacing_settings[right_sidebar_width]' )->transport = 'refresh';
|
||||
}
|
||||
|
||||
if ( $wp_customize->get_setting( 'generate_spacing_settings[left_sidebar_width]' ) ) {
|
||||
$wp_customize->get_setting( 'generate_spacing_settings[left_sidebar_width]' )->transport = 'refresh';
|
||||
}
|
||||
|
||||
if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_top]' ) ) {
|
||||
$wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_top]' )->transport = 'refresh';
|
||||
}
|
||||
|
||||
if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_right]' ) ) {
|
||||
$wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_right]' )->transport = 'refresh';
|
||||
}
|
||||
|
||||
if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_bottom]' ) ) {
|
||||
$wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_bottom]' )->transport = 'refresh';
|
||||
}
|
||||
|
||||
if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_left]' ) ) {
|
||||
$wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_left]' )->transport = 'refresh';
|
||||
}
|
||||
|
||||
if ( $wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_top]' ) ) {
|
||||
$wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_top]' )->transport = 'refresh';
|
||||
}
|
||||
|
||||
if ( $wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_right]' ) ) {
|
||||
$wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_right]' )->transport = 'refresh';
|
||||
}
|
||||
|
||||
if ( $wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_bottom]' ) ) {
|
||||
$wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_bottom]' )->transport = 'refresh';
|
||||
}
|
||||
|
||||
if ( $wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_left]' ) ) {
|
||||
$wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_left]' )->transport = 'refresh';
|
||||
}
|
||||
|
||||
if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_top]' ) ) {
|
||||
$wp_customize->get_setting( 'generate_spacing_settings[footer_top]' )->transport = 'refresh';
|
||||
}
|
||||
|
||||
if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_right]' ) ) {
|
||||
$wp_customize->get_setting( 'generate_spacing_settings[footer_right]' )->transport = 'refresh';
|
||||
}
|
||||
|
||||
if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_bottom]' ) ) {
|
||||
$wp_customize->get_setting( 'generate_spacing_settings[footer_bottom]' )->transport = 'refresh';
|
||||
}
|
||||
|
||||
if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_left]' ) ) {
|
||||
$wp_customize->get_setting( 'generate_spacing_settings[footer_left]' )->transport = 'refresh';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'wp', 'generate_do_pro_compatibility_setup' );
|
||||
/**
|
||||
* Do basic compatibility with GP Premium versions.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_do_pro_compatibility_setup() {
|
||||
if ( ! defined( 'GP_PREMIUM_VERSION' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( version_compare( GP_PREMIUM_VERSION, '1.12.0-alpha.1', '<' ) ) {
|
||||
// Fix Elements removing archive post titles.
|
||||
if ( function_exists( 'generate_premium_do_elements' ) && ! is_singular() ) {
|
||||
add_filter( 'generate_show_title', '__return_true', 20 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,10 +20,8 @@ if ( ! function_exists( 'generate_archive_title' ) ) {
|
||||
if ( ! function_exists( 'the_archive_title' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$clearfix = is_author() ? ' clearfix' : '';
|
||||
?>
|
||||
<header class="page-header<?php echo $clearfix; // WPCS: XSS ok, sanitization ok. ?>">
|
||||
<header class="page-header">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_archive_title hook.
|
||||
@ -47,7 +45,7 @@ if ( ! function_exists( 'generate_archive_title' ) ) {
|
||||
*/
|
||||
do_action( 'generate_after_archive_title' );
|
||||
?>
|
||||
</header><!-- .page-header -->
|
||||
</header>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@ -59,7 +57,7 @@ if ( ! function_exists( 'generate_filter_the_archive_title' ) ) {
|
||||
*
|
||||
* @since 1.3.45
|
||||
*
|
||||
* @param string $title The archive title
|
||||
* @param string $title The archive title.
|
||||
* @return string The altered archive title
|
||||
*/
|
||||
function generate_filter_the_archive_title( $title ) {
|
||||
@ -73,10 +71,13 @@ if ( ! function_exists( 'generate_filter_the_archive_title' ) ) {
|
||||
* what author we're dealing with (if that is the case).
|
||||
*/
|
||||
the_post();
|
||||
$title = sprintf( '%1$s<span class="vcard">%2$s</span>',
|
||||
get_avatar( get_the_author_meta( 'ID' ), 75 ),
|
||||
|
||||
$title = sprintf(
|
||||
'%1$s<span class="vcard">%2$s</span>',
|
||||
get_avatar( get_the_author_meta( 'ID' ), 50 ),
|
||||
get_the_author()
|
||||
);
|
||||
|
||||
/*
|
||||
* Since we called the_post() above, we need to
|
||||
* rewind the loop back to the beginning that way
|
||||
@ -100,11 +101,11 @@ function generate_do_archive_description() {
|
||||
$term_description = term_description();
|
||||
|
||||
if ( ! empty( $term_description ) ) {
|
||||
printf( '<div class="taxonomy-description">%s</div>', $term_description ); // WPCS: XSS ok, sanitization ok.
|
||||
printf( '<div class="taxonomy-description">%s</div>', $term_description ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
|
||||
if ( get_the_author_meta( 'description' ) && is_author() ) {
|
||||
echo '<div class="author-info">' . get_the_author_meta( 'description' ) . '</div>'; // WPCS: XSS ok, sanitization ok.
|
||||
echo '<div class="author-info">' . get_the_author_meta( 'description' ) . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -12,53 +12,58 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
if ( ! function_exists( 'generate_comment' ) ) {
|
||||
/**
|
||||
* Template for comments and pingbacks.
|
||||
*
|
||||
* Used as a callback by wp_list_comments() for displaying the comments.
|
||||
*
|
||||
* @param object $comment The comment object.
|
||||
* @param array $args The existing args.
|
||||
* @param int $depth The thread depth.
|
||||
*/
|
||||
function generate_comment( $comment, $args, $depth ) {
|
||||
$args['avatar_size'] = apply_filters( 'generate_comment_avatar_size', 50 );
|
||||
|
||||
if ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) : ?>
|
||||
if ( 'pingback' === $comment->comment_type || 'trackback' === $comment->comment_type ) : ?>
|
||||
|
||||
<li id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
|
||||
<div class="comment-body">
|
||||
<?php _e( 'Pingback:', 'generatepress' ); // WPCS: XSS OK. ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( 'Edit', 'generatepress' ), '<span class="edit-link">', '</span>' ); ?>
|
||||
<?php esc_html_e( 'Pingback:', 'generatepress' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( 'Edit', 'generatepress' ), '<span class="edit-link">', '</span>' ); ?>
|
||||
</div>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<li id="comment-<?php comment_ID(); ?>" <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?>>
|
||||
<article id="div-comment-<?php comment_ID(); ?>" class="comment-body" <?php generate_do_microdata( 'comment-body' ); ?>>
|
||||
<article id="div-comment-<?php comment_ID(); ?>" <?php generate_do_element_classes( 'comment-body', 'comment-body' ); ?>>
|
||||
<footer class="comment-meta">
|
||||
<?php
|
||||
if ( 0 != $args['avatar_size'] ) {
|
||||
if ( 0 != $args['avatar_size'] ) { // phpcs:ignore
|
||||
echo get_avatar( $comment, $args['avatar_size'] );
|
||||
}
|
||||
?>
|
||||
<div class="comment-author-info">
|
||||
<div class="comment-author vcard" <?php generate_do_microdata( 'comment-author' ); ?>>
|
||||
<div <?php generate_do_element_classes( 'comment-author' ); ?>>
|
||||
<?php printf( '<cite itemprop="name" class="fn">%s</cite>', get_comment_author_link() ); ?>
|
||||
</div><!-- .comment-author -->
|
||||
</div>
|
||||
|
||||
<div class="entry-meta comment-metadata">
|
||||
<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
|
||||
<time datetime="<?php comment_time( 'c' ); ?>" itemprop="datePublished">
|
||||
<?php printf( // WPCS: XSS OK.
|
||||
/* translators: 1: date, 2: time */
|
||||
_x( '%1$s at %2$s', '1: date, 2: time', 'generatepress' ),
|
||||
get_comment_date(),
|
||||
get_comment_time()
|
||||
); ?>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: 1: date, 2: time */
|
||||
_x( '%1$s at %2$s', '1: date, 2: time', 'generatepress' ), // phpcs:ignore
|
||||
get_comment_date(), // phpcs:ignore
|
||||
get_comment_time() // phpcs:ignore
|
||||
);
|
||||
?>
|
||||
</time>
|
||||
</a>
|
||||
<?php edit_comment_link( __( 'Edit', 'generatepress' ), '<span class="edit-link">| ', '</span>' ); ?>
|
||||
</div><!-- .comment-metadata -->
|
||||
</div><!-- .comment-author-info -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ( '0' == $comment->comment_approved ) : ?>
|
||||
<p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'generatepress' ); // WPCS: XSS OK. ?></p>
|
||||
<?php if ( '0' == $comment->comment_approved ) : // phpcs:ignore ?>
|
||||
<p class="comment-awaiting-moderation"><?php esc_html_e( 'Your comment is awaiting moderation.', 'generatepress' ); ?></p>
|
||||
<?php endif; ?>
|
||||
</footer><!-- .comment-meta -->
|
||||
</footer>
|
||||
|
||||
<div class="comment-content" itemprop="text">
|
||||
<?php
|
||||
@ -66,7 +71,6 @@ if ( ! function_exists( 'generate_comment' ) ) {
|
||||
* generate_before_comment_content hook.
|
||||
*
|
||||
* @since 2.4
|
||||
*
|
||||
*/
|
||||
do_action( 'generate_before_comment_text', $comment, $args, $depth );
|
||||
|
||||
@ -76,13 +80,12 @@ if ( ! function_exists( 'generate_comment' ) ) {
|
||||
* generate_after_comment_content hook.
|
||||
*
|
||||
* @since 2.4
|
||||
*
|
||||
*/
|
||||
do_action( 'generate_after_comment_text', $comment, $args, $depth );
|
||||
?>
|
||||
</div><!-- .comment-content -->
|
||||
</article><!-- .comment-body -->
|
||||
<?php
|
||||
</div>
|
||||
</article>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
}
|
||||
@ -92,15 +95,23 @@ add_action( 'generate_after_comment_text', 'generate_do_comment_reply_link', 10,
|
||||
* Add our comment reply link after the comment text.
|
||||
*
|
||||
* @since 2.4
|
||||
* @param object $comment The comment object.
|
||||
* @param array $args The existing args.
|
||||
* @param int $depth The thread depth.
|
||||
*/
|
||||
function generate_do_comment_reply_link( $comment, $args, $depth ) {
|
||||
comment_reply_link( array_merge( $args, array(
|
||||
'add_below' => 'div-comment',
|
||||
'depth' => $depth,
|
||||
'max_depth' => $args['max_depth'],
|
||||
'before' => '<span class="reply">',
|
||||
'after' => '</span>',
|
||||
) ) );
|
||||
comment_reply_link(
|
||||
array_merge(
|
||||
$args,
|
||||
array(
|
||||
'add_below' => 'div-comment',
|
||||
'depth' => $depth,
|
||||
'max_depth' => $args['max_depth'],
|
||||
'before' => '<span class="reply">',
|
||||
'after' => '</span>',
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
add_filter( 'comment_form_defaults', 'generate_set_comment_form_defaults' );
|
||||
@ -109,21 +120,21 @@ add_filter( 'comment_form_defaults', 'generate_set_comment_form_defaults' );
|
||||
*
|
||||
* @since 2.3
|
||||
*
|
||||
* @param array $defaults
|
||||
* @param array $defaults The existing defaults.
|
||||
* @return array
|
||||
*/
|
||||
function generate_set_comment_form_defaults( $defaults ) {
|
||||
$defaults['comment_field'] = sprintf(
|
||||
'<p class="comment-form-comment"><label for="comment" class="screen-reader-text">%1$s</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
|
||||
'<p class="comment-form-comment"><label for="comment" class="screen-reader-text">%1$s</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true" required></textarea></p>',
|
||||
esc_html__( 'Comment', 'generatepress' )
|
||||
);
|
||||
|
||||
$defaults['comment_notes_before'] = null;
|
||||
$defaults['comment_notes_after'] = null;
|
||||
$defaults['id_form'] = 'commentform';
|
||||
$defaults['id_submit'] = 'submit';
|
||||
$defaults['title_reply'] = apply_filters( 'generate_leave_comment', __( 'Leave a Comment', 'generatepress' ) );
|
||||
$defaults['label_submit'] = apply_filters( 'generate_post_comment', __( 'Post Comment', 'generatepress' ) );
|
||||
$defaults['comment_notes_before'] = null;
|
||||
$defaults['comment_notes_after'] = null;
|
||||
$defaults['id_form'] = 'commentform';
|
||||
$defaults['id_submit'] = 'submit';
|
||||
$defaults['title_reply'] = apply_filters( 'generate_leave_comment', __( 'Leave a Comment', 'generatepress' ) );
|
||||
$defaults['label_submit'] = apply_filters( 'generate_post_comment', __( 'Post Comment', 'generatepress' ) );
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
@ -133,22 +144,25 @@ add_filter( 'comment_form_default_fields', 'generate_filter_comment_fields' );
|
||||
* Customizes the existing comment fields.
|
||||
*
|
||||
* @since 2.1.2
|
||||
* @param array $fields
|
||||
* @param array $fields The existing fields.
|
||||
* @return array
|
||||
*/
|
||||
function generate_filter_comment_fields( $fields ) {
|
||||
$commenter = wp_get_current_commenter();
|
||||
$required = get_option( 'require_name_email' );
|
||||
|
||||
$fields['author'] = sprintf(
|
||||
'<label for="author" class="screen-reader-text">%1$s</label><input placeholder="%1$s *" id="author" name="author" type="text" value="%2$s" size="30" />',
|
||||
'<label for="author" class="screen-reader-text">%1$s</label><input placeholder="%1$s%3$s" id="author" name="author" type="text" value="%2$s" size="30" />',
|
||||
esc_html__( 'Name', 'generatepress' ),
|
||||
esc_attr( $commenter['comment_author'] )
|
||||
esc_attr( $commenter['comment_author'] ),
|
||||
$required ? ' *' : ''
|
||||
);
|
||||
|
||||
$fields['email'] = sprintf(
|
||||
'<label for="email" class="screen-reader-text">%1$s</label><input placeholder="%1$s *" id="email" name="email" type="email" value="%2$s" size="30" />',
|
||||
'<label for="email" class="screen-reader-text">%1$s</label><input placeholder="%1$s%3$s" id="email" name="email" type="email" value="%2$s" size="30" />',
|
||||
esc_html__( 'Email', 'generatepress' ),
|
||||
esc_attr( $commenter['comment_author_email'] )
|
||||
esc_attr( $commenter['comment_author_email'] ),
|
||||
$required ? ' *' : ''
|
||||
);
|
||||
|
||||
$fields['url'] = sprintf(
|
||||
@ -159,3 +173,32 @@ function generate_filter_comment_fields( $fields ) {
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
add_action( 'generate_after_do_template_part', 'generate_do_comments_template', 15 );
|
||||
/**
|
||||
* Add the comments template to pages and single posts.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param string $template The template we're targeting.
|
||||
*/
|
||||
function generate_do_comments_template( $template ) {
|
||||
if ( 'single' === $template || 'page' === $template ) {
|
||||
// If comments are open or we have at least one comment, load up the comment template.
|
||||
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentionally loose.
|
||||
if ( comments_open() || '0' != get_comments_number() ) :
|
||||
/**
|
||||
* generate_before_comments_container hook.
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
do_action( 'generate_before_comments_container' );
|
||||
?>
|
||||
|
||||
<div class="comments-area">
|
||||
<?php comments_template(); ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
}
|
||||
|
@ -22,23 +22,33 @@ if ( ! function_exists( 'generate_post_image' ) ) {
|
||||
|
||||
// If we're not on any single post/page or the 404 template, we must be showing excerpts.
|
||||
if ( ! is_singular() && ! is_404() ) {
|
||||
echo apply_filters( 'generate_featured_image_output', sprintf( // WPCS: XSS ok.
|
||||
'<div class="post-image">
|
||||
%3$s
|
||||
<a href="%1$s">
|
||||
%2$s
|
||||
</a>
|
||||
</div>',
|
||||
esc_url( get_permalink() ),
|
||||
get_the_post_thumbnail(
|
||||
get_the_ID(),
|
||||
apply_filters( 'generate_page_header_default_size', 'full' ),
|
||||
array(
|
||||
'itemprop' => 'image',
|
||||
)
|
||||
),
|
||||
apply_filters( 'generate_inside_featured_image_output', '' )
|
||||
) );
|
||||
|
||||
$attrs = array();
|
||||
|
||||
if ( 'microdata' === generate_get_schema_type() ) {
|
||||
$attrs = array(
|
||||
'itemprop' => 'image',
|
||||
);
|
||||
}
|
||||
|
||||
echo apply_filters( // phpcs:ignore
|
||||
'generate_featured_image_output',
|
||||
sprintf(
|
||||
'<div class="post-image">
|
||||
%3$s
|
||||
<a href="%1$s">
|
||||
%2$s
|
||||
</a>
|
||||
</div>',
|
||||
esc_url( get_permalink() ),
|
||||
get_the_post_thumbnail(
|
||||
get_the_ID(),
|
||||
apply_filters( 'generate_page_header_default_size', 'full' ),
|
||||
$attrs
|
||||
),
|
||||
apply_filters( 'generate_inside_featured_image_output', '' )
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -49,7 +59,7 @@ if ( ! function_exists( 'generate_featured_page_header_area' ) ) {
|
||||
*
|
||||
* @since 1.0.7
|
||||
*
|
||||
* @param string The featured image container class
|
||||
* @param string $class The featured image container class.
|
||||
*/
|
||||
function generate_featured_page_header_area( $class ) {
|
||||
// Don't run the function unless we're on a page it applies to.
|
||||
@ -61,14 +71,22 @@ if ( ! function_exists( 'generate_featured_page_header_area' ) ) {
|
||||
if ( ! has_post_thumbnail() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$attrs = array();
|
||||
|
||||
if ( 'microdata' === generate_get_schema_type() ) {
|
||||
$attrs = array(
|
||||
'itemprop' => 'image',
|
||||
);
|
||||
}
|
||||
?>
|
||||
<div class="<?php echo esc_attr( $class ); ?> grid-container grid-parent">
|
||||
<?php the_post_thumbnail(
|
||||
apply_filters( 'generate_page_header_default_size', 'full' ),
|
||||
array(
|
||||
'itemprop' => 'image',
|
||||
)
|
||||
); ?>
|
||||
<div class="featured-image <?php echo esc_attr( $class ); ?> grid-container grid-parent">
|
||||
<?php
|
||||
the_post_thumbnail(
|
||||
apply_filters( 'generate_page_header_default_size', 'full' ),
|
||||
$attrs
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
@ -17,9 +17,18 @@ if ( ! function_exists( 'generate_construct_footer' ) ) {
|
||||
* @since 1.3.42
|
||||
*/
|
||||
function generate_construct_footer() {
|
||||
$inside_site_info_class = '';
|
||||
|
||||
if ( 'full-width' !== generate_get_option( 'footer_inner_width' ) ) {
|
||||
$inside_site_info_class = ' grid-container grid-parent';
|
||||
|
||||
if ( generate_is_using_flexbox() ) {
|
||||
$inside_site_info_class = ' grid-container';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<footer class="site-info" <?php generate_do_microdata( 'footer' ); ?>>
|
||||
<div class="inside-site-info <?php if ( 'full-width' !== generate_get_option( 'footer_inner_width' ) ) : ?>grid-container grid-parent<?php endif; ?>">
|
||||
<footer <?php generate_do_element_classes( 'site-info', 'site-info' ); ?>>
|
||||
<div class="inside-site-info<?php echo $inside_site_info_class; // phpcs:ignore ?>">
|
||||
<?php
|
||||
/**
|
||||
* generate_before_copyright hook.
|
||||
@ -43,7 +52,7 @@ if ( ! function_exists( 'generate_construct_footer' ) ) {
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</footer><!-- .site-info -->
|
||||
</footer>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@ -75,15 +84,17 @@ if ( ! function_exists( 'generate_add_footer_info' ) ) {
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_add_footer_info() {
|
||||
$copyright = sprintf( '<span class="copyright">© %1$s %2$s</span> • %4$s <a href="%3$s" itemprop="url">%5$s</a>',
|
||||
date( 'Y' ),
|
||||
$copyright = sprintf(
|
||||
'<span class="copyright">© %1$s %2$s</span> • %4$s <a href="%3$s"%6$s>%5$s</a>',
|
||||
date( 'Y' ), // phpcs:ignore
|
||||
get_bloginfo( 'name' ),
|
||||
esc_url( 'https://generatepress.com' ),
|
||||
_x( 'Powered by', 'GeneratePress', 'generatepress' ),
|
||||
__( 'GeneratePress', 'generatepress' )
|
||||
_x( 'Built with', 'GeneratePress', 'generatepress' ),
|
||||
__( 'GeneratePress', 'generatepress' ),
|
||||
'microdata' === generate_get_schema_type() ? ' itemprop="url"' : ''
|
||||
);
|
||||
|
||||
echo apply_filters( 'generate_copyright', $copyright ); // WPCS: XSS ok.
|
||||
echo apply_filters( 'generate_copyright', $copyright ); // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,10 +108,24 @@ if ( ! function_exists( 'generate_add_footer_info' ) ) {
|
||||
* @param int $widget The ID of our widget.
|
||||
*/
|
||||
function generate_do_footer_widget( $widget_width, $widget ) {
|
||||
$widget_width = apply_filters( "generate_footer_widget_{$widget}_width", $widget_width );
|
||||
$tablet_widget_width = apply_filters( "generate_footer_widget_{$widget}_tablet_width", '50' );
|
||||
$widget_classes = sprintf(
|
||||
'footer-widget-%s',
|
||||
absint( $widget )
|
||||
);
|
||||
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
$widget_width = apply_filters( "generate_footer_widget_{$widget}_width", $widget_width );
|
||||
$tablet_widget_width = apply_filters( "generate_footer_widget_{$widget}_tablet_width", '50' );
|
||||
|
||||
$widget_classes = sprintf(
|
||||
'footer-widget-%1$s grid-parent grid-%2$s tablet-grid-%3$s mobile-grid-100',
|
||||
absint( $widget ),
|
||||
absint( $widget_width ),
|
||||
absint( $tablet_widget_width )
|
||||
);
|
||||
}
|
||||
?>
|
||||
<div class="footer-widget-<?php echo absint( $widget ); ?> grid-parent grid-<?php echo absint( $widget_width ); ?> tablet-grid-<?php echo absint( $tablet_widget_width ); ?> mobile-grid-100">
|
||||
<div class="<?php echo $widget_classes; // phpcs:ignore ?>">
|
||||
<?php dynamic_sidebar( 'footer-' . absint( $widget ) ); ?>
|
||||
</div>
|
||||
<?php
|
||||
@ -120,35 +145,30 @@ if ( ! function_exists( 'generate_construct_footer_widgets' ) ) {
|
||||
if ( ! empty( $widgets ) && 0 !== $widgets ) :
|
||||
|
||||
// If no footer widgets exist, we don't need to continue.
|
||||
if (
|
||||
! is_active_sidebar( 'footer-1' ) &&
|
||||
! is_active_sidebar( 'footer-2' ) &&
|
||||
! is_active_sidebar( 'footer-3' ) &&
|
||||
! is_active_sidebar( 'footer-4' ) &&
|
||||
! is_active_sidebar( 'footer-5' ) )
|
||||
{
|
||||
if ( ! is_active_sidebar( 'footer-1' ) && ! is_active_sidebar( 'footer-2' ) && ! is_active_sidebar( 'footer-3' ) && ! is_active_sidebar( 'footer-4' ) && ! is_active_sidebar( 'footer-5' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set up the widget width.
|
||||
$widget_width = '';
|
||||
if ( $widgets == 1 ) {
|
||||
|
||||
if ( 1 === (int) $widgets ) {
|
||||
$widget_width = '100';
|
||||
}
|
||||
|
||||
if ( $widgets == 2 ) {
|
||||
if ( 2 === (int) $widgets ) {
|
||||
$widget_width = '50';
|
||||
}
|
||||
|
||||
if ( $widgets == 3 ) {
|
||||
if ( 3 === (int) $widgets ) {
|
||||
$widget_width = '33';
|
||||
}
|
||||
|
||||
if ( $widgets == 4 ) {
|
||||
if ( 4 === (int) $widgets ) {
|
||||
$widget_width = '25';
|
||||
}
|
||||
|
||||
if ( $widgets == 5 ) {
|
||||
if ( 5 === (int) $widgets ) {
|
||||
$widget_width = '20';
|
||||
}
|
||||
?>
|
||||
@ -179,7 +199,7 @@ if ( ! function_exists( 'generate_construct_footer_widgets' ) ) {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
<?php
|
||||
endif;
|
||||
|
||||
/**
|
||||
@ -208,17 +228,18 @@ if ( ! function_exists( 'generate_back_to_top' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
echo apply_filters( 'generate_back_to_top_output', sprintf( // WPCS: XSS ok.
|
||||
'<a title="%1$s" rel="nofollow" href="#" class="generate-back-to-top" style="opacity:0;visibility:hidden;" data-scroll-speed="%2$s" data-start-scroll="%3$s">
|
||||
<span class="screen-reader-text">%5$s</span>
|
||||
%6$s
|
||||
</a>',
|
||||
esc_attr__( 'Scroll back to top', 'generatepress' ),
|
||||
absint( apply_filters( 'generate_back_to_top_scroll_speed', 400 ) ),
|
||||
absint( apply_filters( 'generate_back_to_top_start_scroll', 300 ) ),
|
||||
esc_attr( apply_filters( 'generate_back_to_top_icon', 'fa-angle-up' ) ),
|
||||
esc_html__( 'Scroll back to top', 'generatepress' ),
|
||||
generate_get_svg_icon( 'arrow' )
|
||||
) );
|
||||
echo apply_filters( // phpcs:ignore
|
||||
'generate_back_to_top_output',
|
||||
sprintf(
|
||||
'<a title="%1$s" aria-label="%1$s" rel="nofollow" href="#" class="generate-back-to-top" style="opacity:0;visibility:hidden;" data-scroll-speed="%2$s" data-start-scroll="%3$s">
|
||||
%5$s
|
||||
</a>',
|
||||
esc_attr__( 'Scroll back to top', 'generatepress' ),
|
||||
absint( apply_filters( 'generate_back_to_top_scroll_speed', 400 ) ),
|
||||
absint( apply_filters( 'generate_back_to_top_start_scroll', 300 ) ),
|
||||
esc_attr( apply_filters( 'generate_back_to_top_icon', 'fa-angle-up' ) ),
|
||||
generate_get_svg_icon( 'arrow-up' )
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ if ( ! function_exists( 'generate_construct_header' ) ) {
|
||||
*/
|
||||
function generate_construct_header() {
|
||||
?>
|
||||
<header id="masthead" <?php generate_do_element_classes( 'header' ); ?> <?php generate_do_microdata( 'header' ); ?>>
|
||||
<header id="masthead" <?php generate_do_element_classes( 'header' ); ?>>
|
||||
<div <?php generate_do_element_classes( 'inside_header' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
@ -28,8 +28,10 @@ if ( ! function_exists( 'generate_construct_header' ) ) {
|
||||
*/
|
||||
do_action( 'generate_before_header_content' );
|
||||
|
||||
// Add our main header items.
|
||||
generate_header_items();
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
// Add our main header items.
|
||||
generate_header_items();
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_header_content hook.
|
||||
@ -40,8 +42,8 @@ if ( ! function_exists( 'generate_construct_header' ) ) {
|
||||
*/
|
||||
do_action( 'generate_after_header_content' );
|
||||
?>
|
||||
</div><!-- .inside-header -->
|
||||
</header><!-- #masthead -->
|
||||
</div>
|
||||
</header>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@ -54,7 +56,8 @@ if ( ! function_exists( 'generate_header_items' ) ) {
|
||||
* @since 1.2.9.7
|
||||
*/
|
||||
function generate_header_items() {
|
||||
$order = apply_filters( 'generate_header_items_order',
|
||||
$order = apply_filters(
|
||||
'generate_header_items_order',
|
||||
array(
|
||||
'header-widget',
|
||||
'site-branding',
|
||||
@ -103,12 +106,15 @@ if ( ! function_exists( 'generate_construct_logo' ) ) {
|
||||
*/
|
||||
do_action( 'generate_before_logo' );
|
||||
|
||||
$attr = apply_filters( 'generate_logo_attributes', array(
|
||||
'class' => 'header-image',
|
||||
'alt' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
|
||||
'src' => $logo_url,
|
||||
'title' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
|
||||
) );
|
||||
$attr = apply_filters(
|
||||
'generate_logo_attributes',
|
||||
array(
|
||||
'class' => 'header-image is-logo-image',
|
||||
'alt' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
|
||||
'src' => $logo_url,
|
||||
'title' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
|
||||
)
|
||||
);
|
||||
|
||||
if ( '' !== $retina_logo_url ) {
|
||||
$attr['srcset'] = $logo_url . ' 1x, ' . $retina_logo_url . ' 2x';
|
||||
@ -117,6 +123,16 @@ if ( ! function_exists( 'generate_construct_logo' ) ) {
|
||||
if ( function_exists( 'the_custom_logo' ) && get_theme_mod( 'custom_logo' ) ) {
|
||||
$data = wp_get_attachment_metadata( get_theme_mod( 'custom_logo' ) );
|
||||
|
||||
if ( ! empty( $data ) ) {
|
||||
$attr['width'] = $data['width'];
|
||||
$attr['height'] = $data['height'];
|
||||
}
|
||||
}
|
||||
} elseif ( generate_is_using_flexbox() ) {
|
||||
// Add this to flexbox version only until we can verify it won't conflict with existing installs.
|
||||
if ( function_exists( 'the_custom_logo' ) && get_theme_mod( 'custom_logo' ) ) {
|
||||
$data = wp_get_attachment_metadata( get_theme_mod( 'custom_logo' ) );
|
||||
|
||||
if ( ! empty( $data ) ) {
|
||||
$attr['width'] = $data['width'];
|
||||
$attr['height'] = $data['height'];
|
||||
@ -132,16 +148,21 @@ if ( ! function_exists( 'generate_construct_logo' ) ) {
|
||||
}
|
||||
|
||||
// Print our HTML.
|
||||
echo apply_filters( 'generate_logo_output', sprintf( // WPCS: XSS ok, sanitization ok.
|
||||
'<div class="site-logo">
|
||||
<a href="%1$s" title="%2$s" rel="home">
|
||||
<img %3$s />
|
||||
</a>
|
||||
</div>',
|
||||
esc_url( apply_filters( 'generate_logo_href' , home_url( '/' ) ) ),
|
||||
esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
|
||||
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'generate_logo_output',
|
||||
sprintf(
|
||||
'<div class="site-logo">
|
||||
<a href="%1$s" title="%2$s" rel="home">
|
||||
<img %3$s />
|
||||
</a>
|
||||
</div>',
|
||||
esc_url( apply_filters( 'generate_logo_href', home_url( '/' ) ) ),
|
||||
esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
|
||||
$html_attr
|
||||
),
|
||||
$logo_url,
|
||||
$html_attr
|
||||
), $logo_url, $html_attr );
|
||||
);
|
||||
|
||||
/**
|
||||
* generate_after_logo hook.
|
||||
@ -169,49 +190,63 @@ if ( ! function_exists( 'generate_construct_site_title' ) ) {
|
||||
$tagline = get_bloginfo( 'description' );
|
||||
|
||||
// If the disable title checkbox is checked, or the title field is empty, return true.
|
||||
$disable_title = ( '1' == $generate_settings['hide_title'] || '' == $title ) ? true : false;
|
||||
$disable_title = ( '1' == $generate_settings['hide_title'] || '' == $title ) ? true : false; // phpcs:ignore
|
||||
|
||||
// If the disable tagline checkbox is checked, or the tagline field is empty, return true.
|
||||
$disable_tagline = ( '1' == $generate_settings['hide_tagline'] || '' == $tagline ) ? true : false;
|
||||
$disable_tagline = ( '1' == $generate_settings['hide_tagline'] || '' == $tagline ) ? true : false; // phpcs:ignore
|
||||
|
||||
$schema_type = generate_get_schema_type();
|
||||
|
||||
// Build our site title.
|
||||
$site_title = apply_filters( 'generate_site_title_output', sprintf(
|
||||
'<%1$s class="main-title" itemprop="headline">
|
||||
<a href="%2$s" rel="home">
|
||||
%3$s
|
||||
</a>
|
||||
</%1$s>',
|
||||
( is_front_page() && is_home() ) ? 'h1' : 'p',
|
||||
esc_url( apply_filters( 'generate_site_title_href', home_url( '/' ) ) ),
|
||||
get_bloginfo( 'name' )
|
||||
) );
|
||||
$site_title = apply_filters(
|
||||
'generate_site_title_output',
|
||||
sprintf(
|
||||
'<%1$s class="main-title"%4$s>
|
||||
<a href="%2$s" rel="home">
|
||||
%3$s
|
||||
</a>
|
||||
</%1$s>',
|
||||
( is_front_page() && is_home() ) ? 'h1' : 'p',
|
||||
esc_url( apply_filters( 'generate_site_title_href', home_url( '/' ) ) ),
|
||||
get_bloginfo( 'name' ),
|
||||
'microdata' === generate_get_schema_type() ? ' itemprop="headline"' : ''
|
||||
)
|
||||
);
|
||||
|
||||
// Build our tagline.
|
||||
$site_tagline = apply_filters( 'generate_site_description_output', sprintf(
|
||||
'<p class="site-description" itemprop="description">
|
||||
%1$s
|
||||
</p>',
|
||||
html_entity_decode( get_bloginfo( 'description', 'display' ) )
|
||||
) );
|
||||
$site_tagline = apply_filters(
|
||||
'generate_site_description_output',
|
||||
sprintf(
|
||||
'<p class="site-description"%2$s>
|
||||
%1$s
|
||||
</p>',
|
||||
html_entity_decode( get_bloginfo( 'description', 'display' ) ), // phpcs:ignore
|
||||
'microdata' === generate_get_schema_type() ? ' itemprop="description"' : ''
|
||||
)
|
||||
);
|
||||
|
||||
// Site title and tagline.
|
||||
if ( false == $disable_title || false == $disable_tagline ) {
|
||||
if ( generate_get_option( 'inline_logo_site_branding' ) && generate_has_logo_site_branding() ) {
|
||||
if ( false === $disable_title || false === $disable_tagline ) {
|
||||
if ( generate_needs_site_branding_container() ) {
|
||||
echo '<div class="site-branding-container">';
|
||||
generate_construct_logo();
|
||||
}
|
||||
|
||||
echo apply_filters( 'generate_site_branding_output', sprintf( // WPCS: XSS ok, sanitization ok.
|
||||
'<div class="site-branding">
|
||||
%1$s
|
||||
%2$s
|
||||
</div>',
|
||||
( ! $disable_title ) ? $site_title : '',
|
||||
( ! $disable_tagline ) ? $site_tagline : ''
|
||||
) );
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- outputting site title and tagline. False positive.
|
||||
echo apply_filters(
|
||||
'generate_site_branding_output',
|
||||
sprintf(
|
||||
'<div class="site-branding">
|
||||
%1$s
|
||||
%2$s
|
||||
</div>',
|
||||
( ! $disable_title ) ? $site_title : '',
|
||||
( ! $disable_tagline ) ? $site_tagline : ''
|
||||
)
|
||||
);
|
||||
|
||||
if ( generate_get_option( 'inline_logo_site_branding' ) && generate_has_logo_site_branding() ) {
|
||||
echo '</div><!-- .site-branding-container -->';
|
||||
if ( generate_needs_site_branding_container() ) {
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -222,6 +257,7 @@ add_filter( 'generate_header_items_order', 'generate_reorder_inline_site_brandin
|
||||
* Remove the logo from it's usual position.
|
||||
*
|
||||
* @since 2.3
|
||||
* @param array $order Order of the header items.
|
||||
*/
|
||||
function generate_reorder_inline_site_branding( $order ) {
|
||||
if ( ! generate_get_option( 'inline_logo_site_branding' ) || ! generate_has_logo_site_branding() ) {
|
||||
@ -241,14 +277,61 @@ if ( ! function_exists( 'generate_construct_header_widget' ) ) {
|
||||
* @since 1.3.28
|
||||
*/
|
||||
function generate_construct_header_widget() {
|
||||
if ( is_active_sidebar( 'header' ) ) : ?>
|
||||
if ( is_active_sidebar( 'header' ) ) :
|
||||
?>
|
||||
<div class="header-widget">
|
||||
<?php dynamic_sidebar( 'header' ); ?>
|
||||
</div>
|
||||
<?php endif;
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'generate_before_header_content', 'generate_do_site_logo', 5 );
|
||||
/**
|
||||
* Add the site logo to our header.
|
||||
* Only added if we aren't using floats to preserve backwards compatibility.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_do_site_logo() {
|
||||
if ( ! generate_is_using_flexbox() || generate_needs_site_branding_container() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
generate_construct_logo();
|
||||
}
|
||||
|
||||
add_action( 'generate_before_header_content', 'generate_do_site_branding' );
|
||||
/**
|
||||
* Add the site branding to our header.
|
||||
* Only added if we aren't using floats to preserve backwards compatibility.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_do_site_branding() {
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
generate_construct_site_title();
|
||||
}
|
||||
|
||||
add_action( 'generate_after_header_content', 'generate_do_header_widget' );
|
||||
/**
|
||||
* Add the header widget to our header.
|
||||
* Only used when grid isn't using floats to preserve backwards compatibility.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_do_header_widget() {
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
generate_construct_header_widget();
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_top_bar' ) ) {
|
||||
add_action( 'generate_before_header', 'generate_top_bar', 5 );
|
||||
/**
|
||||
@ -260,9 +343,19 @@ if ( ! function_exists( 'generate_top_bar' ) ) {
|
||||
if ( ! is_active_sidebar( 'top-bar' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$inside_top_bar_class = '';
|
||||
|
||||
if ( 'contained' === generate_get_option( 'top_bar_inner_width' ) ) {
|
||||
$inside_top_bar_class = ' grid-container grid-parent';
|
||||
|
||||
if ( generate_is_using_flexbox() ) {
|
||||
$inside_top_bar_class = ' grid-container';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div <?php generate_do_element_classes( 'top_bar' ); ?>>
|
||||
<div class="inside-top-bar<?php if ( 'contained' == generate_get_option( 'top_bar_inner_width' ) ) echo ' grid-container grid-parent'; ?>">
|
||||
<div class="inside-top-bar<?php echo $inside_top_bar_class; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- False positive. ?>">
|
||||
<?php dynamic_sidebar( 'top-bar' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -292,7 +385,7 @@ if ( ! function_exists( 'generate_add_viewport' ) ) {
|
||||
* @since 1.1.0
|
||||
*/
|
||||
function generate_add_viewport() {
|
||||
echo apply_filters( 'generate_meta_viewport', '<meta name="viewport" content="width=device-width, initial-scale=1">' ); // WPCS: XSS ok.
|
||||
echo apply_filters( 'generate_meta_viewport', '<meta name="viewport" content="width=device-width, initial-scale=1">' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
}
|
||||
|
||||
@ -303,7 +396,8 @@ add_action( 'generate_before_header', 'generate_do_skip_to_content_link', 2 );
|
||||
* @since 2.0
|
||||
*/
|
||||
function generate_do_skip_to_content_link() {
|
||||
printf( '<a class="screen-reader-text skip-link" href="#content" title="%1$s">%2$s</a>',
|
||||
printf(
|
||||
'<a class="screen-reader-text skip-link" href="#content" title="%1$s">%2$s</a>',
|
||||
esc_attr__( 'Skip to content', 'generatepress' ),
|
||||
esc_html__( 'Skip to content', 'generatepress' )
|
||||
);
|
||||
|
@ -16,8 +16,14 @@ if ( ! function_exists( 'generate_navigation_position' ) ) {
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_navigation_position() {
|
||||
/**
|
||||
* generate_before_navigation hook.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
do_action( 'generate_before_navigation' );
|
||||
?>
|
||||
<nav id="site-navigation" <?php generate_do_element_classes( 'navigation' ); ?> <?php generate_do_microdata( 'navigation' ); ?>>
|
||||
<nav id="site-navigation" <?php generate_do_element_classes( 'navigation' ); ?>>
|
||||
<div <?php generate_do_element_classes( 'inside_navigation' ); ?>>
|
||||
<?php
|
||||
/**
|
||||
@ -46,17 +52,24 @@ if ( ! function_exists( 'generate_navigation_position' ) ) {
|
||||
if ( $mobile_menu_label ) {
|
||||
printf(
|
||||
'<span class="mobile-menu">%s</span>',
|
||||
$mobile_menu_label
|
||||
$mobile_menu_label // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML allowed in filter.
|
||||
);
|
||||
} else {
|
||||
printf(
|
||||
'<span class="screen-reader-text">%s</span>',
|
||||
__( 'Menu', 'generatepress' )
|
||||
esc_html__( 'Menu', 'generatepress' )
|
||||
);
|
||||
}
|
||||
?>
|
||||
</button>
|
||||
<?php
|
||||
/**
|
||||
* generate_after_mobile_menu_button hook
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
do_action( 'generate_after_mobile_menu_button' );
|
||||
|
||||
wp_nav_menu(
|
||||
array(
|
||||
'theme_location' => 'primary',
|
||||
@ -76,20 +89,85 @@ if ( ! function_exists( 'generate_navigation_position' ) ) {
|
||||
*/
|
||||
do_action( 'generate_after_primary_menu' );
|
||||
?>
|
||||
</div><!-- .inside-navigation -->
|
||||
</nav><!-- #site-navigation -->
|
||||
</div>
|
||||
</nav>
|
||||
<?php
|
||||
/**
|
||||
* generate_after_navigation hook.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
do_action( 'generate_after_navigation' );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'generate_before_navigation', 'generate_do_header_mobile_menu_toggle' );
|
||||
/**
|
||||
* Build the mobile menu toggle in the header.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_do_header_mobile_menu_toggle() {
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! generate_has_inline_mobile_toggle() ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<nav id="mobile-menu-control-wrapper" <?php generate_do_element_classes( 'mobile-navigation-toggle', array( 'main-navigation', 'mobile-menu-control-wrapper' ) ); ?>>
|
||||
<?php
|
||||
/**
|
||||
* generate_inside_mobile_menu_control_wrapper hook.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
do_action( 'generate_inside_mobile_menu_control_wrapper' );
|
||||
?>
|
||||
<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false" data-nav="site-navigation">
|
||||
<?php
|
||||
/**
|
||||
* generate_inside_mobile_menu hook.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
do_action( 'generate_inside_mobile_menu' );
|
||||
|
||||
generate_do_svg_icon( 'menu-bars', true );
|
||||
|
||||
$mobile_menu_label = __( 'Menu', 'generatepress' );
|
||||
|
||||
if ( 'nav-float-right' === generate_get_navigation_location() || 'nav-float-left' === generate_get_navigation_location() ) {
|
||||
$mobile_menu_label = '';
|
||||
}
|
||||
|
||||
$mobile_menu_label = apply_filters( 'generate_mobile_menu_label', $mobile_menu_label );
|
||||
|
||||
if ( $mobile_menu_label ) {
|
||||
printf(
|
||||
'<span class="mobile-menu">%s</span>',
|
||||
$mobile_menu_label // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML allowed in filter.
|
||||
);
|
||||
} else {
|
||||
printf(
|
||||
'<span class="screen-reader-text">%s</span>',
|
||||
esc_html__( 'Menu', 'generatepress' )
|
||||
);
|
||||
}
|
||||
?>
|
||||
</button>
|
||||
</nav>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_menu_fallback' ) ) {
|
||||
/**
|
||||
* Menu fallback.
|
||||
*
|
||||
* @since 1.1.4
|
||||
*
|
||||
* @param array $args
|
||||
* @return string
|
||||
* @param array $args Existing menu args.
|
||||
*/
|
||||
function generate_menu_fallback( $args ) {
|
||||
$generate_settings = wp_parse_args(
|
||||
@ -108,34 +186,38 @@ if ( ! function_exists( 'generate_menu_fallback' ) ) {
|
||||
|
||||
wp_list_pages( $args );
|
||||
|
||||
if ( 'enable' === $generate_settings['nav_search'] ) {
|
||||
printf(
|
||||
'<li class="search-item"><a aria-label="%1$s" href="#">%2$s</a></li>',
|
||||
esc_attr__( 'Open Search Bar', 'generatepress' ),
|
||||
generate_get_svg_icon( 'search', true )
|
||||
if ( ! generate_is_using_flexbox() && 'enable' === $generate_settings['nav_search'] ) {
|
||||
$search_item = apply_filters(
|
||||
'generate_navigation_search_menu_item_output',
|
||||
sprintf(
|
||||
'<li class="search-item menu-item-align-right"><a aria-label="%1$s" href="#">%2$s</a></li>',
|
||||
esc_attr__( 'Open Search Bar', 'generatepress' ),
|
||||
generate_get_svg_icon( 'search', true ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in function.
|
||||
)
|
||||
);
|
||||
|
||||
echo $search_item; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Safe output.
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div><!-- .main-nav -->
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the navigation based on settings
|
||||
*
|
||||
* It would be better to have all of these inside one action, but these
|
||||
* are kept this way to maintain backward compatibility for people
|
||||
* un-hooking and moving the navigation/changing the priority.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'generate_add_navigation_after_header' ) ) {
|
||||
add_action( 'generate_after_header', 'generate_add_navigation_after_header', 5 );
|
||||
/**
|
||||
* Generate the navigation based on settings
|
||||
*
|
||||
* It would be better to have all of these inside one action, but these
|
||||
* are kept this way to maintain backward compatibility for people
|
||||
* un-hooking and moving the navigation/changing the priority.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_add_navigation_after_header() {
|
||||
if ( 'nav-below-header' == generate_get_navigation_location() ) {
|
||||
if ( 'nav-below-header' === generate_get_navigation_location() ) {
|
||||
generate_navigation_position();
|
||||
}
|
||||
}
|
||||
@ -143,8 +225,17 @@ if ( ! function_exists( 'generate_add_navigation_after_header' ) ) {
|
||||
|
||||
if ( ! function_exists( 'generate_add_navigation_before_header' ) ) {
|
||||
add_action( 'generate_before_header', 'generate_add_navigation_before_header', 5 );
|
||||
/**
|
||||
* Generate the navigation based on settings
|
||||
*
|
||||
* It would be better to have all of these inside one action, but these
|
||||
* are kept this way to maintain backward compatibility for people
|
||||
* un-hooking and moving the navigation/changing the priority.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_add_navigation_before_header() {
|
||||
if ( 'nav-above-header' == generate_get_navigation_location() ) {
|
||||
if ( 'nav-above-header' === generate_get_navigation_location() ) {
|
||||
generate_navigation_position();
|
||||
}
|
||||
}
|
||||
@ -152,8 +243,17 @@ if ( ! function_exists( 'generate_add_navigation_before_header' ) ) {
|
||||
|
||||
if ( ! function_exists( 'generate_add_navigation_float_right' ) ) {
|
||||
add_action( 'generate_after_header_content', 'generate_add_navigation_float_right', 5 );
|
||||
/**
|
||||
* Generate the navigation based on settings
|
||||
*
|
||||
* It would be better to have all of these inside one action, but these
|
||||
* are kept this way to maintain backward compatibility for people
|
||||
* un-hooking and moving the navigation/changing the priority.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_add_navigation_float_right() {
|
||||
if ( 'nav-float-right' == generate_get_navigation_location() || 'nav-float-left' == generate_get_navigation_location() ) {
|
||||
if ( 'nav-float-right' === generate_get_navigation_location() || 'nav-float-left' === generate_get_navigation_location() ) {
|
||||
generate_navigation_position();
|
||||
}
|
||||
}
|
||||
@ -161,8 +261,17 @@ if ( ! function_exists( 'generate_add_navigation_float_right' ) ) {
|
||||
|
||||
if ( ! function_exists( 'generate_add_navigation_before_right_sidebar' ) ) {
|
||||
add_action( 'generate_before_right_sidebar_content', 'generate_add_navigation_before_right_sidebar', 5 );
|
||||
/**
|
||||
* Generate the navigation based on settings
|
||||
*
|
||||
* It would be better to have all of these inside one action, but these
|
||||
* are kept this way to maintain backward compatibility for people
|
||||
* un-hooking and moving the navigation/changing the priority.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_add_navigation_before_right_sidebar() {
|
||||
if ( 'nav-right-sidebar' == generate_get_navigation_location() ) {
|
||||
if ( 'nav-right-sidebar' === generate_get_navigation_location() ) {
|
||||
echo '<div class="gen-sidebar-nav">';
|
||||
generate_navigation_position();
|
||||
echo '</div>';
|
||||
@ -172,8 +281,17 @@ if ( ! function_exists( 'generate_add_navigation_before_right_sidebar' ) ) {
|
||||
|
||||
if ( ! function_exists( 'generate_add_navigation_before_left_sidebar' ) ) {
|
||||
add_action( 'generate_before_left_sidebar_content', 'generate_add_navigation_before_left_sidebar', 5 );
|
||||
/**
|
||||
* Generate the navigation based on settings
|
||||
*
|
||||
* It would be better to have all of these inside one action, but these
|
||||
* are kept this way to maintain backward compatibility for people
|
||||
* un-hooking and moving the navigation/changing the priority.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_add_navigation_before_left_sidebar() {
|
||||
if ( 'nav-left-sidebar' == generate_get_navigation_location() ) {
|
||||
if ( 'nav-left-sidebar' === generate_get_navigation_location() ) {
|
||||
echo '<div class="gen-sidebar-nav">';
|
||||
generate_navigation_position();
|
||||
echo '</div>';
|
||||
@ -189,7 +307,7 @@ if ( ! class_exists( 'Generate_Page_Walker' ) && class_exists( 'Walker_Page' ) )
|
||||
* @since 1.3.21
|
||||
*/
|
||||
class Generate_Page_Walker extends Walker_Page {
|
||||
function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) {
|
||||
function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) { // phpcs:ignore
|
||||
$css_class = array( 'page_item', 'page-item-' . $page->ID );
|
||||
$button = '';
|
||||
|
||||
@ -204,15 +322,17 @@ if ( ! class_exists( 'Generate_Page_Walker' ) && class_exists( 'Walker_Page' ) )
|
||||
if ( $_current_page && in_array( $page->ID, $_current_page->ancestors ) ) {
|
||||
$css_class[] = 'current-menu-ancestor';
|
||||
}
|
||||
if ( $page->ID == $current_page ) {
|
||||
|
||||
if ( $page->ID == $current_page ) { // phpcs:ignore
|
||||
$css_class[] = 'current-menu-item';
|
||||
} elseif ( $_current_page && $page->ID == $_current_page->post_parent ) {
|
||||
} elseif ( $_current_page && $page->ID == $_current_page->post_parent ) { // phpcs:ignore
|
||||
$css_class[] = 'current-menu-parent';
|
||||
}
|
||||
} elseif ( $page->ID == get_option( 'page_for_posts' ) ) {
|
||||
} elseif ( $page->ID == get_option( 'page_for_posts' ) ) { // phpcs:ignore
|
||||
$css_class[] = 'current-menu-parent';
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Core filter name.
|
||||
$css_classes = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) );
|
||||
|
||||
$args['link_before'] = empty( $args['link_before'] ) ? '' : $args['link_before'];
|
||||
@ -223,7 +343,7 @@ if ( ! class_exists( 'Generate_Page_Walker' ) && class_exists( 'Walker_Page' ) )
|
||||
$css_classes,
|
||||
get_permalink( $page->ID ),
|
||||
$args['link_before'],
|
||||
apply_filters( 'the_title', $page->post_title, $page->ID ),
|
||||
apply_filters( 'the_title', $page->post_title, $page->ID ), // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Core filter name.
|
||||
$args['link_after'],
|
||||
$button
|
||||
);
|
||||
@ -238,10 +358,10 @@ if ( ! function_exists( 'generate_dropdown_icon_to_menu_link' ) ) {
|
||||
*
|
||||
* @since 1.3.42
|
||||
*
|
||||
* @param string $title The menu item title.
|
||||
* @param WP_Post $item All of our menu item data.
|
||||
* @param string $title The menu item title.
|
||||
* @param WP_Post $item All of our menu item data.
|
||||
* @param stdClass $args All of our menu item args.
|
||||
* @param int $dept Depth of menu item.
|
||||
* @param int $depth Depth of menu item.
|
||||
* @return string The menu item.
|
||||
*/
|
||||
function generate_dropdown_icon_to_menu_link( $title, $item, $args, $depth ) {
|
||||
@ -256,7 +376,47 @@ if ( ! function_exists( 'generate_dropdown_icon_to_menu_link' ) ) {
|
||||
if ( isset( $args->container_class ) && 'main-nav' === $args->container_class ) {
|
||||
foreach ( $item->classes as $value ) {
|
||||
if ( 'menu-item-has-children' === $value ) {
|
||||
$icon = generate_get_svg_icon( 'arrow' );
|
||||
$arrow_direction = 'down';
|
||||
|
||||
if ( 'primary' === $args->theme_location ) {
|
||||
if ( 0 !== $depth ) {
|
||||
$arrow_direction = 'right';
|
||||
|
||||
if ( 'left' === generate_get_option( 'nav_dropdown_direction' ) ) {
|
||||
$arrow_direction = 'left';
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'nav-left-sidebar' === generate_get_navigation_location() ) {
|
||||
$arrow_direction = 'right';
|
||||
|
||||
if ( 'both-right' === generate_get_layout() ) {
|
||||
$arrow_direction = 'left';
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'nav-right-sidebar' === generate_get_navigation_location() ) {
|
||||
$arrow_direction = 'left';
|
||||
|
||||
if ( 'both-left' === generate_get_layout() ) {
|
||||
$arrow_direction = 'right';
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'hover' !== generate_get_option( 'nav_dropdown_type' ) ) {
|
||||
$arrow_direction = 'down';
|
||||
}
|
||||
}
|
||||
|
||||
$arrow_direction = apply_filters( 'generate_menu_item_dropdown_arrow_direction', $arrow_direction, $args, $depth );
|
||||
|
||||
if ( 'down' === $arrow_direction ) {
|
||||
$arrow_direction = '';
|
||||
} else {
|
||||
$arrow_direction = '-' . $arrow_direction;
|
||||
}
|
||||
|
||||
$icon = generate_get_svg_icon( 'arrow' . $arrow_direction );
|
||||
$title = $title . '<span role="' . $role . '" class="dropdown-menu-toggle"' . $tabindex . '>' . $icon . '</span>';
|
||||
}
|
||||
}
|
||||
@ -283,25 +443,90 @@ if ( ! function_exists( 'generate_navigation_search' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
echo apply_filters( 'generate_navigation_search_output', sprintf( // WPCS: XSS ok, sanitization ok.
|
||||
'<form method="get" class="search-form navigation-search" action="%1$s">
|
||||
<input type="search" class="search-field" value="%2$s" name="s" title="%3$s" />
|
||||
</form>',
|
||||
esc_url( home_url( '/' ) ),
|
||||
esc_attr( get_search_query() ),
|
||||
esc_attr_x( 'Search', 'label', 'generatepress' )
|
||||
));
|
||||
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'generate_navigation_search_output',
|
||||
sprintf(
|
||||
'<form method="get" class="search-form navigation-search" action="%1$s">
|
||||
<input type="search" class="search-field" value="%2$s" name="s" title="%3$s" />
|
||||
</form>',
|
||||
esc_url( home_url( '/' ) ),
|
||||
esc_attr( get_search_query() ),
|
||||
esc_attr_x( 'Search', 'label', 'generatepress' )
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'generate_after_primary_menu', 'generate_do_menu_bar_item_container' );
|
||||
add_action( 'generate_inside_mobile_menu_control_wrapper', 'generate_do_menu_bar_item_container' );
|
||||
/**
|
||||
* Add a container for menu bar items.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_do_menu_bar_item_container() {
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( generate_has_menu_bar_items() ) {
|
||||
echo '<div class="menu-bar-items">';
|
||||
do_action( 'generate_menu_bar_items' );
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'wp', 'generate_add_menu_bar_items' );
|
||||
/**
|
||||
* Add menu bar items to the primary navigation.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_add_menu_bar_items() {
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'enable' === generate_get_option( 'nav_search' ) ) {
|
||||
add_action( 'generate_menu_bar_items', 'generate_do_navigation_search_button' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the navigation search button.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_do_navigation_search_button() {
|
||||
if ( ! generate_is_using_flexbox() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'enable' !== generate_get_option( 'nav_search' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$search_item = apply_filters(
|
||||
'generate_navigation_search_menu_item_output',
|
||||
sprintf(
|
||||
'<span class="menu-bar-item search-item"><a aria-label="%1$s" href="#">%2$s</a></span>',
|
||||
esc_attr__( 'Open Search Bar', 'generatepress' ),
|
||||
generate_get_svg_icon( 'search', true ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in function.
|
||||
)
|
||||
);
|
||||
|
||||
echo $search_item; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- No escaping needed.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_menu_search_icon' ) ) {
|
||||
add_filter( 'wp_nav_menu_items', 'generate_menu_search_icon', 10, 2 );
|
||||
/**
|
||||
* Add search icon to primary menu if set
|
||||
* Add search icon to primary menu if set.
|
||||
* Only used if using old float system.
|
||||
*
|
||||
* @since 1.2.9.7
|
||||
*
|
||||
* @param string $nav The HTML list content for the menu items.
|
||||
* @param string $nav The HTML list content for the menu items.
|
||||
* @param stdClass $args An object containing wp_nav_menu() arguments.
|
||||
* @return string The search icon menu item.
|
||||
*/
|
||||
@ -311,6 +536,10 @@ if ( ! function_exists( 'generate_menu_search_icon' ) ) {
|
||||
generate_get_defaults()
|
||||
);
|
||||
|
||||
if ( generate_is_using_flexbox() ) {
|
||||
return $nav;
|
||||
}
|
||||
|
||||
// If the search icon isn't enabled, return the regular nav.
|
||||
if ( 'enable' !== $generate_settings['nav_search'] ) {
|
||||
return $nav;
|
||||
@ -318,12 +547,16 @@ if ( ! function_exists( 'generate_menu_search_icon' ) ) {
|
||||
|
||||
// If our primary menu is set, add the search icon.
|
||||
if ( isset( $args->theme_location ) && 'primary' === $args->theme_location ) {
|
||||
return sprintf(
|
||||
'%1$s<li class="search-item"><a aria-label="%2$s" href="#">%3$s</a></li>',
|
||||
$nav,
|
||||
esc_attr__( 'Open Search Bar', 'generatepress' ),
|
||||
generate_get_svg_icon( 'search', true )
|
||||
$search_item = apply_filters(
|
||||
'generate_navigation_search_menu_item_output',
|
||||
sprintf(
|
||||
'<li class="search-item menu-item-align-right"><a aria-label="%1$s" href="#">%2$s</a></li>',
|
||||
esc_attr__( 'Open Search Bar', 'generatepress' ),
|
||||
generate_get_svg_icon( 'search', true ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in function.
|
||||
)
|
||||
);
|
||||
|
||||
return $nav . $search_item;
|
||||
}
|
||||
|
||||
// Our primary menu isn't set, return the regular nav.
|
||||
@ -335,7 +568,8 @@ if ( ! function_exists( 'generate_menu_search_icon' ) ) {
|
||||
if ( ! function_exists( 'generate_mobile_menu_search_icon' ) ) {
|
||||
add_action( 'generate_inside_navigation', 'generate_mobile_menu_search_icon' );
|
||||
/**
|
||||
* Add search icon to mobile menu bar
|
||||
* Add search icon to mobile menu bar.
|
||||
* Only used if using old float system.
|
||||
*
|
||||
* @since 1.3.12
|
||||
*/
|
||||
@ -350,15 +584,19 @@ if ( ! function_exists( 'generate_mobile_menu_search_icon' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( generate_is_using_flexbox() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="mobile-bar-items">
|
||||
<?php do_action( 'generate_inside_mobile_menu_bar' ); ?>
|
||||
<span class="search-item">
|
||||
<a aria-label="<?php _e( 'Open Search Bar', 'generatepress' ); ?>" href="#">
|
||||
<a aria-label="<?php esc_attr_e( 'Open Search Bar', 'generatepress' ); ?>" href="#">
|
||||
<?php generate_do_svg_icon( 'search', true ); ?>
|
||||
</a>
|
||||
</span>
|
||||
</div><!-- .mobile-bar-items -->
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
@ -18,10 +18,6 @@ if ( ! function_exists( 'generate_content_nav' ) ) {
|
||||
* @param string $nav_id The id of our navigation.
|
||||
*/
|
||||
function generate_content_nav( $nav_id ) {
|
||||
if ( ! apply_filters( 'generate_show_post_navigation', true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $wp_query, $post;
|
||||
|
||||
// Don't print empty markup on single pages if there's nowhere to navigate.
|
||||
@ -44,16 +40,20 @@ if ( ! function_exists( 'generate_content_nav' ) ) {
|
||||
<nav id="<?php echo esc_attr( $nav_id ); ?>" class="<?php echo esc_attr( $nav_class ); ?>">
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Post navigation', 'generatepress' ); ?></span>
|
||||
|
||||
<?php if ( is_single() ) : // navigation links for single posts.
|
||||
<?php
|
||||
if ( is_single() ) : // navigation links for single posts.
|
||||
|
||||
$post_navigation_args = apply_filters( 'generate_post_navigation_args', array(
|
||||
'previous_format' => '<div class="nav-previous">' . generate_get_svg_icon( 'arrow' ) . '<span class="prev" title="' . esc_attr__( 'Previous', 'generatepress' ) . '">%link</span></div>',
|
||||
'next_format' => '<div class="nav-next">' . generate_get_svg_icon( 'arrow' ) . '<span class="next" title="' . esc_attr__( 'Next', 'generatepress' ) . '">%link</span></div>',
|
||||
'link' => '%title',
|
||||
'in_same_term' => apply_filters( 'generate_category_post_navigation', false ),
|
||||
'excluded_terms' => '',
|
||||
'taxonomy' => 'category',
|
||||
) );
|
||||
$post_navigation_args = apply_filters(
|
||||
'generate_post_navigation_args',
|
||||
array(
|
||||
'previous_format' => '<div class="nav-previous">' . generate_get_svg_icon( 'arrow-left' ) . '<span class="prev" title="' . esc_attr__( 'Previous', 'generatepress' ) . '">%link</span></div>',
|
||||
'next_format' => '<div class="nav-next">' . generate_get_svg_icon( 'arrow-right' ) . '<span class="next" title="' . esc_attr__( 'Next', 'generatepress' ) . '">%link</span></div>',
|
||||
'link' => '%title',
|
||||
'in_same_term' => apply_filters( 'generate_category_post_navigation', false ),
|
||||
'excluded_terms' => '',
|
||||
'taxonomy' => 'category',
|
||||
)
|
||||
);
|
||||
|
||||
previous_post_link(
|
||||
$post_navigation_args['previous_format'],
|
||||
@ -73,26 +73,50 @@ if ( ! function_exists( 'generate_content_nav' ) ) {
|
||||
|
||||
elseif ( is_home() || is_archive() || is_search() ) : // navigation links for home, archive, and search pages.
|
||||
|
||||
if ( get_next_posts_link() ) : ?>
|
||||
if ( get_next_posts_link() ) :
|
||||
?>
|
||||
<div class="nav-previous">
|
||||
<?php generate_do_svg_icon( 'arrow' ); ?>
|
||||
<span class="prev" title="<?php esc_attr_e( 'Previous', 'generatepress' );?>"><?php next_posts_link( __( 'Older posts', 'generatepress' ) ); ?></span>
|
||||
<span class="prev" title="<?php esc_attr_e( 'Previous', 'generatepress' ); ?>"><?php next_posts_link( __( 'Older posts', 'generatepress' ) ); ?></span>
|
||||
</div>
|
||||
<?php endif;
|
||||
<?php
|
||||
endif;
|
||||
|
||||
if ( get_previous_posts_link() ) : ?>
|
||||
if ( get_previous_posts_link() ) :
|
||||
?>
|
||||
<div class="nav-next">
|
||||
<?php generate_do_svg_icon( 'arrow' ); ?>
|
||||
<span class="next" title="<?php esc_attr_e( 'Next', 'generatepress' );?>"><?php previous_posts_link( __( 'Newer posts', 'generatepress' ) ); ?></span>
|
||||
<span class="next" title="<?php esc_attr_e( 'Next', 'generatepress' ); ?>"><?php previous_posts_link( __( 'Newer posts', 'generatepress' ) ); ?></span>
|
||||
</div>
|
||||
<?php endif;
|
||||
<?php
|
||||
endif;
|
||||
|
||||
if ( function_exists( 'the_posts_pagination' ) ) {
|
||||
the_posts_pagination( array(
|
||||
'mid_size' => apply_filters( 'generate_pagination_mid_size', 1 ),
|
||||
'prev_text' => apply_filters( 'generate_previous_link_text', __( '← Previous', 'generatepress' ) ),
|
||||
'next_text' => apply_filters( 'generate_next_link_text', __( 'Next →', 'generatepress' ) ),
|
||||
) );
|
||||
the_posts_pagination(
|
||||
array(
|
||||
'mid_size' => apply_filters( 'generate_pagination_mid_size', 1 ),
|
||||
'prev_text' => apply_filters(
|
||||
'generate_previous_link_text',
|
||||
sprintf(
|
||||
/* translators: left arrow */
|
||||
__( '%s Previous', 'generatepress' ),
|
||||
'<span aria-hidden="true">←</span>'
|
||||
)
|
||||
),
|
||||
'next_text' => apply_filters(
|
||||
'generate_next_link_text',
|
||||
sprintf(
|
||||
/* translators: right arrow */
|
||||
__( 'Next %s', 'generatepress' ),
|
||||
'<span aria-hidden="true">→</span>'
|
||||
)
|
||||
),
|
||||
'before_page_number' => sprintf(
|
||||
'<span class="screen-reader-text">%s</span>',
|
||||
_x( 'Page', 'prepends the pagination page number for screen readers', 'generatepress' )
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -102,8 +126,9 @@ if ( ! function_exists( 'generate_content_nav' ) ) {
|
||||
*/
|
||||
do_action( 'generate_paging_navigation' );
|
||||
|
||||
endif; ?>
|
||||
</nav><!-- #<?php echo esc_html( $nav_id ); ?> -->
|
||||
endif;
|
||||
?>
|
||||
</nav>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@ -134,66 +159,89 @@ if ( ! function_exists( 'generate_modify_posts_pagination_template' ) ) {
|
||||
*
|
||||
* @since 2.3
|
||||
*
|
||||
* @param string $item The post meta item we're requesting
|
||||
* @return The requested HTML.
|
||||
* @param string $item The post meta item we're requesting.
|
||||
*/
|
||||
function generate_do_post_meta_item( $item ) {
|
||||
if ( 'date' === $item ) {
|
||||
$date = apply_filters( 'generate_post_date', true );
|
||||
$time_string = '<time class="entry-date published" datetime="%1$s"%5$s>%2$s</time>';
|
||||
|
||||
$time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>';
|
||||
$updated_time = get_the_modified_time( 'U' );
|
||||
$published_time = get_the_time( 'U' ) + 1800;
|
||||
$schema_type = generate_get_schema_type();
|
||||
|
||||
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
|
||||
$time_string = '<time class="updated" datetime="%3$s" itemprop="dateModified">%4$s</time>' . $time_string;
|
||||
if ( $updated_time > $published_time ) {
|
||||
if ( apply_filters( 'generate_post_date_show_updated_only', false ) ) {
|
||||
$time_string = '<time class="entry-date updated-date" datetime="%3$s"%6$s>%4$s</time>';
|
||||
} else {
|
||||
$time_string = '<time class="updated" datetime="%3$s"%6$s>%4$s</time>' . $time_string;
|
||||
}
|
||||
}
|
||||
|
||||
$time_string = sprintf( $time_string,
|
||||
$time_string = sprintf(
|
||||
$time_string,
|
||||
esc_attr( get_the_date( 'c' ) ),
|
||||
esc_html( get_the_date() ),
|
||||
esc_attr( get_the_modified_date( 'c' ) ),
|
||||
esc_html( get_the_modified_date() )
|
||||
esc_html( get_the_modified_date() ),
|
||||
'microdata' === $schema_type ? ' itemprop="datePublished"' : '',
|
||||
'microdata' === $schema_type ? ' itemprop="dateModified"' : ''
|
||||
);
|
||||
|
||||
// If our date is enabled, show it.
|
||||
if ( $date ) {
|
||||
echo apply_filters( 'generate_post_date_output',
|
||||
sprintf( // WPCS: XSS ok, sanitization ok.
|
||||
'<span class="posted-on">%1$s<a href="%2$s" title="%3$s" rel="bookmark">%4$s</a></span> ',
|
||||
apply_filters( 'generate_inside_post_meta_item_output', '', 'date' ),
|
||||
esc_url( get_permalink() ),
|
||||
esc_attr( get_the_time() ),
|
||||
$time_string
|
||||
),
|
||||
$time_string );
|
||||
$posted_on = '<span class="posted-on">%1$s%4$s</span> ';
|
||||
|
||||
if ( apply_filters( 'generate_post_date_link', false ) ) {
|
||||
$posted_on = '<span class="posted-on">%1$s<a href="%2$s" title="%3$s" rel="bookmark">%4$s</a></span> ';
|
||||
}
|
||||
|
||||
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'generate_post_date_output',
|
||||
sprintf(
|
||||
$posted_on,
|
||||
apply_filters( 'generate_inside_post_meta_item_output', '', 'date' ),
|
||||
esc_url( get_permalink() ),
|
||||
esc_attr( get_the_time() ),
|
||||
$time_string
|
||||
),
|
||||
$time_string,
|
||||
$posted_on
|
||||
);
|
||||
}
|
||||
|
||||
if ( 'author' === $item ) {
|
||||
$author = apply_filters( 'generate_post_author', true );
|
||||
$schema_type = generate_get_schema_type();
|
||||
|
||||
if ( $author ) {
|
||||
echo apply_filters( 'generate_post_author_output',
|
||||
sprintf( '<span class="byline">%1$s<span class="author vcard" %5$s><a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span></span> ',
|
||||
apply_filters( 'generate_inside_post_meta_item_output', '', 'author' ),
|
||||
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
|
||||
/* translators: 1: Author name */
|
||||
esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ),
|
||||
esc_html( get_the_author() ),
|
||||
generate_get_microdata( 'post-author' )
|
||||
)
|
||||
);
|
||||
$byline = '<span class="byline">%1$s<span class="author%8$s" %5$s><a class="url fn n" href="%2$s" title="%3$s" rel="author"%6$s><span class="author-name"%7$s>%4$s</span></a></span></span> ';
|
||||
|
||||
if ( ! apply_filters( 'generate_post_author_link', true ) ) {
|
||||
$byline = '<span class="byline">%1$s<span class="author%8$s" %5$s><span class="author-name"%7$s>%4$s</span></span></span> ';
|
||||
}
|
||||
|
||||
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'generate_post_author_output',
|
||||
sprintf(
|
||||
$byline,
|
||||
apply_filters( 'generate_inside_post_meta_item_output', '', 'author' ),
|
||||
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
|
||||
/* translators: 1: Author name */
|
||||
esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ),
|
||||
esc_html( get_the_author() ),
|
||||
generate_get_microdata( 'post-author' ),
|
||||
'microdata' === $schema_type ? ' itemprop="url"' : '',
|
||||
'microdata' === $schema_type ? ' itemprop="name"' : '',
|
||||
generate_is_using_hatom() ? ' vcard' : ''
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ( 'categories' === $item ) {
|
||||
$categories = apply_filters( 'generate_show_categories', true );
|
||||
|
||||
$term_separator = apply_filters( 'generate_term_separator', _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ), 'categories' );
|
||||
$categories_list = get_the_category_list( $term_separator );
|
||||
|
||||
if ( $categories_list && $categories ) {
|
||||
echo apply_filters( 'generate_category_list_output',
|
||||
sprintf( '<span class="cat-links">%3$s<span class="screen-reader-text">%1$s </span>%2$s</span> ', // WPCS: XSS ok, sanitization ok.
|
||||
if ( $categories_list ) {
|
||||
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'generate_category_list_output',
|
||||
sprintf(
|
||||
'<span class="cat-links">%3$s<span class="screen-reader-text">%1$s </span>%2$s</span> ',
|
||||
esc_html_x( 'Categories', 'Used before category names.', 'generatepress' ),
|
||||
$categories_list,
|
||||
apply_filters( 'generate_inside_post_meta_item_output', '', 'categories' )
|
||||
@ -203,14 +251,14 @@ function generate_do_post_meta_item( $item ) {
|
||||
}
|
||||
|
||||
if ( 'tags' === $item ) {
|
||||
$tags = apply_filters( 'generate_show_tags', true );
|
||||
|
||||
$term_separator = apply_filters( 'generate_term_separator', _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ), 'tags' );
|
||||
$tags_list = get_the_tag_list( '', $term_separator );
|
||||
|
||||
if ( $tags_list && $tags ) {
|
||||
echo apply_filters( 'generate_tag_list_output',
|
||||
sprintf( '<span class="tags-links">%3$s<span class="screen-reader-text">%1$s </span>%2$s</span> ', // WPCS: XSS ok, sanitization ok.
|
||||
if ( $tags_list ) {
|
||||
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'generate_tag_list_output',
|
||||
sprintf(
|
||||
'<span class="tags-links">%3$s<span class="screen-reader-text">%1$s </span>%2$s</span> ',
|
||||
esc_html_x( 'Tags', 'Used before tag names.', 'generatepress' ),
|
||||
$tags_list,
|
||||
apply_filters( 'generate_inside_post_meta_item_output', '', 'tags' )
|
||||
@ -220,16 +268,22 @@ function generate_do_post_meta_item( $item ) {
|
||||
}
|
||||
|
||||
if ( 'comments-link' === $item ) {
|
||||
$comments = apply_filters( 'generate_show_comments', true );
|
||||
|
||||
if ( $comments && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
|
||||
if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
|
||||
echo '<span class="comments-link">';
|
||||
echo apply_filters( 'generate_inside_post_meta_item_output', '', 'comments-link' );
|
||||
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'generate_inside_post_meta_item_output',
|
||||
'',
|
||||
'comments-link'
|
||||
);
|
||||
comments_popup_link( __( 'Leave a comment', 'generatepress' ), __( '1 Comment', 'generatepress' ), __( '% Comments', 'generatepress' ) );
|
||||
echo '</span> ';
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'post-navigation' === $item && is_single() ) {
|
||||
generate_content_nav( 'nav-below' );
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_post_meta_items hook.
|
||||
*
|
||||
@ -243,6 +297,8 @@ add_filter( 'generate_inside_post_meta_item_output', 'generate_do_post_meta_pref
|
||||
* Add svg icons or text to our post meta output.
|
||||
*
|
||||
* @since 2.4
|
||||
* @param string $output The existing output.
|
||||
* @param string $item The item to target.
|
||||
*/
|
||||
function generate_do_post_meta_prefix( $output, $item ) {
|
||||
if ( 'author' === $item ) {
|
||||
@ -264,6 +320,92 @@ function generate_do_post_meta_prefix( $output, $item ) {
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove post meta items from display if their individual filters are set.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param array $items The post meta items.
|
||||
*/
|
||||
function generate_disable_post_meta_items( $items ) {
|
||||
$disable_filter_names = apply_filters(
|
||||
'generate_disable_post_meta_filter_names',
|
||||
array(
|
||||
'date' => 'generate_post_date',
|
||||
'author' => 'generate_post_author',
|
||||
'categories' => 'generate_show_categories',
|
||||
'tags' => 'generate_show_tags',
|
||||
'comments-link' => 'generate_show_comments',
|
||||
'post-navigation' => 'generate_show_post_navigation',
|
||||
)
|
||||
);
|
||||
|
||||
foreach ( $items as $item ) {
|
||||
$default_display = true;
|
||||
|
||||
if ( 'comments-link' === $item && is_singular() ) {
|
||||
$default_display = false;
|
||||
}
|
||||
|
||||
// phpcs:ignore -- Hook name is coming from a variable.
|
||||
if ( isset( $disable_filter_names[ $item ] ) && ! apply_filters( $disable_filter_names[ $item ], $default_display ) ) {
|
||||
$items = array_diff( $items, array( $item ) );
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the post meta items in the header entry meta.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_get_header_entry_meta_items() {
|
||||
$items = apply_filters(
|
||||
'generate_header_entry_meta_items',
|
||||
array(
|
||||
'date',
|
||||
'author',
|
||||
)
|
||||
);
|
||||
|
||||
// Disable post meta items based on their individual filters.
|
||||
$items = generate_disable_post_meta_items( $items );
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the post meta items in the footer entry meta.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_get_footer_entry_meta_items() {
|
||||
$items = apply_filters(
|
||||
'generate_footer_entry_meta_items',
|
||||
array(
|
||||
'categories',
|
||||
'tags',
|
||||
'comments-link',
|
||||
'post-navigation',
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* This wasn't a "meta item" prior to 3.0.0 and some users may be using the filter above
|
||||
* without specifying that they want to include post-navigation. The below forces it to display
|
||||
* for users using the old float system to prevent it from disappearing on update.
|
||||
*/
|
||||
if ( ! generate_is_using_flexbox() && ! in_array( 'post-navigation', (array) $items ) ) {
|
||||
$items[] = 'post-navigation';
|
||||
}
|
||||
|
||||
// Disable post meta items based on their individual filters.
|
||||
$items = generate_disable_post_meta_items( $items );
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_posted_on' ) ) {
|
||||
/**
|
||||
* Prints HTML with meta information for the current post-date/time and author.
|
||||
@ -271,10 +413,7 @@ if ( ! function_exists( 'generate_posted_on' ) ) {
|
||||
* @since 0.1
|
||||
*/
|
||||
function generate_posted_on() {
|
||||
$items = apply_filters( 'generate_header_entry_meta_items', array(
|
||||
'date',
|
||||
'author',
|
||||
) );
|
||||
$items = generate_get_header_entry_meta_items();
|
||||
|
||||
foreach ( $items as $item ) {
|
||||
generate_do_post_meta_item( $item );
|
||||
@ -289,11 +428,7 @@ if ( ! function_exists( 'generate_entry_meta' ) ) {
|
||||
* @since 1.2.5
|
||||
*/
|
||||
function generate_entry_meta() {
|
||||
$items = apply_filters( 'generate_footer_entry_meta_items', array(
|
||||
'categories',
|
||||
'tags',
|
||||
'comments-link',
|
||||
) );
|
||||
$items = generate_get_footer_entry_meta_items();
|
||||
|
||||
foreach ( $items as $item ) {
|
||||
generate_do_post_meta_item( $item );
|
||||
@ -312,12 +447,20 @@ if ( ! function_exists( 'generate_excerpt_more' ) ) {
|
||||
* @return string The HTML for the more link.
|
||||
*/
|
||||
function generate_excerpt_more( $more ) {
|
||||
return apply_filters( 'generate_excerpt_more_output', sprintf( ' ... <a title="%1$s" class="read-more" href="%2$s">%3$s %4$s</a>',
|
||||
the_title_attribute( 'echo=0' ),
|
||||
esc_url( get_permalink( get_the_ID() ) ),
|
||||
__( 'Read more', 'generatepress' ),
|
||||
'<span class="screen-reader-text">' . get_the_title() . '</span>'
|
||||
) );
|
||||
return apply_filters(
|
||||
'generate_excerpt_more_output',
|
||||
sprintf(
|
||||
' ... <a title="%1$s" class="read-more" href="%2$s" aria-label="%4$s">%3$s</a>',
|
||||
the_title_attribute( 'echo=0' ),
|
||||
esc_url( get_permalink( get_the_ID() ) ),
|
||||
__( 'Read more', 'generatepress' ),
|
||||
sprintf(
|
||||
/* translators: Aria-label describing the read more button */
|
||||
_x( 'More on %s', 'more on post title', 'generatepress' ),
|
||||
the_title_attribute( 'echo=0' )
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -332,57 +475,105 @@ if ( ! function_exists( 'generate_content_more' ) ) {
|
||||
* @return string The HTML for the more link
|
||||
*/
|
||||
function generate_content_more( $more ) {
|
||||
return apply_filters( 'generate_content_more_link_output', sprintf( '<p class="read-more-container"><a title="%1$s" class="read-more content-read-more" href="%2$s">%3$s%4$s</a></p>',
|
||||
the_title_attribute( 'echo=0' ),
|
||||
esc_url( get_permalink( get_the_ID() ) . apply_filters( 'generate_more_jump','#more-' . get_the_ID() ) ),
|
||||
__( 'Read more', 'generatepress' ),
|
||||
'<span class="screen-reader-text">' . get_the_title() . '</span>'
|
||||
) );
|
||||
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" aria-label="%4$s">%3$s</a></p>',
|
||||
the_title_attribute( 'echo=0' ),
|
||||
esc_url( get_permalink( get_the_ID() ) . apply_filters( 'generate_more_jump', '#more-' . get_the_ID() ) ),
|
||||
__( 'Read more', 'generatepress' ),
|
||||
sprintf(
|
||||
/* translators: Aria-label describing the read more button */
|
||||
_x( 'More on %s', 'more on post title', 'generatepress' ),
|
||||
the_title_attribute( 'echo=0' )
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'wp', 'generate_add_post_meta', 5 );
|
||||
/**
|
||||
* Add our post meta items to the page.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_add_post_meta() {
|
||||
$header_items = generate_get_header_entry_meta_items();
|
||||
|
||||
$header_post_types = apply_filters(
|
||||
'generate_entry_meta_post_types',
|
||||
array(
|
||||
'post',
|
||||
)
|
||||
);
|
||||
|
||||
if ( in_array( get_post_type(), $header_post_types ) && ! empty( $header_items ) ) {
|
||||
add_action( 'generate_after_entry_title', 'generate_post_meta' );
|
||||
}
|
||||
|
||||
$footer_items = generate_get_footer_entry_meta_items();
|
||||
|
||||
$footer_post_types = apply_filters(
|
||||
'generate_footer_meta_post_types',
|
||||
array(
|
||||
'post',
|
||||
)
|
||||
);
|
||||
|
||||
if ( in_array( get_post_type(), $footer_post_types ) && ! empty( $footer_items ) ) {
|
||||
add_action( 'generate_after_entry_content', 'generate_footer_meta' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_post_meta' ) ) {
|
||||
add_action( 'generate_after_entry_title', 'generate_post_meta' );
|
||||
/**
|
||||
* Build the post meta.
|
||||
*
|
||||
* @since 1.3.29
|
||||
*/
|
||||
function generate_post_meta() {
|
||||
$post_types = apply_filters( 'generate_entry_meta_post_types', array(
|
||||
'post',
|
||||
) );
|
||||
|
||||
if ( in_array( get_post_type(), $post_types ) ) : ?>
|
||||
<div class="entry-meta">
|
||||
<?php generate_posted_on(); ?>
|
||||
</div><!-- .entry-meta -->
|
||||
<?php endif;
|
||||
?>
|
||||
<div class="entry-meta">
|
||||
<?php generate_posted_on(); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_footer_meta' ) ) {
|
||||
add_action( 'generate_after_entry_content', 'generate_footer_meta' );
|
||||
/**
|
||||
* Build the footer post meta.
|
||||
*
|
||||
* @since 1.3.30
|
||||
*/
|
||||
function generate_footer_meta() {
|
||||
$post_types = apply_filters( 'generate_footer_meta_post_types', array(
|
||||
'post',
|
||||
) );
|
||||
|
||||
if ( in_array( get_post_type(), $post_types ) ) : ?>
|
||||
<footer class="entry-meta">
|
||||
<?php
|
||||
generate_entry_meta();
|
||||
|
||||
if ( is_single() ) {
|
||||
generate_content_nav( 'nav-below' );
|
||||
}
|
||||
?>
|
||||
</footer><!-- .entry-meta -->
|
||||
<?php endif;
|
||||
?>
|
||||
<footer class="entry-meta">
|
||||
<?php generate_entry_meta(); ?>
|
||||
</footer>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'generate_after_loop', 'generate_do_post_navigation' );
|
||||
/**
|
||||
* Add our post navigation after post loops.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param string $template The template of the current action.
|
||||
*/
|
||||
function generate_do_post_navigation( $template ) {
|
||||
$templates = apply_filters(
|
||||
'generate_post_navigation_templates',
|
||||
array(
|
||||
'index',
|
||||
'archive',
|
||||
'search',
|
||||
)
|
||||
);
|
||||
|
||||
if ( in_array( $template, $templates ) && apply_filters( 'generate_show_post_navigation', true ) ) {
|
||||
generate_content_nav( 'nav-below' );
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ if ( ! function_exists( 'generate_construct_sidebars' ) ) {
|
||||
* The below hook was removed in 2.0, but we'll keep the call here so child themes
|
||||
* don't lose their sidebar when they update the theme.
|
||||
*/
|
||||
add_action( 'generate_sidebars', 'generate_construct_sidebars' );
|
||||
add_action( 'generate_sidebars', 'generate_construct_sidebars' );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -50,7 +50,7 @@ if ( ! function_exists( 'generate_construct_sidebars' ) ) {
|
||||
* @param string $area Left or right sidebar.
|
||||
*/
|
||||
function generate_do_default_sidebar_widgets( $area ) {
|
||||
if ( 'nav-' . $area === generate_get_navigation_location() ) {
|
||||
if ( 'nav-' . $area === generate_get_navigation_location() ) { // phpcs:ignore -- False positive.
|
||||
return;
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ function generate_do_default_sidebar_widgets( $area ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! apply_filters( 'generate_show_default_sidebar_widgets', true ) ) {
|
||||
if ( ! apply_filters( 'generate_show_default_sidebar_widgets', true ) || generate_is_using_flexbox() ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
@ -89,6 +89,7 @@ if ( ! function_exists( 'generate_get_footer_widgets' ) ) {
|
||||
if ( ! function_exists( 'generate_show_excerpt' ) ) {
|
||||
/**
|
||||
* Figure out if we should show the blog excerpts or full posts
|
||||
*
|
||||
* @since 1.3.15
|
||||
*/
|
||||
function generate_show_excerpt() {
|
||||
@ -124,6 +125,29 @@ if ( ! function_exists( 'generate_show_title' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether we should display the entry header or not.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_show_entry_header() {
|
||||
$show_entry_header = true;
|
||||
$show_title = generate_show_title();
|
||||
$has_before_entry_title = has_action( 'generate_before_entry_title' );
|
||||
$has_after_entry_title = has_action( 'generate_after_entry_title' );
|
||||
|
||||
if ( is_page() ) {
|
||||
$has_before_entry_title = has_action( 'generate_before_page_title' );
|
||||
$has_after_entry_title = has_action( 'generate_after_page_title' );
|
||||
}
|
||||
|
||||
if ( ! $show_title && ! $has_before_entry_title && ! $has_after_entry_title ) {
|
||||
$show_entry_header = false;
|
||||
}
|
||||
|
||||
return apply_filters( 'generate_show_entry_header', $show_entry_header );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_get_premium_url' ) ) {
|
||||
/**
|
||||
* Generate a URL to our premium add-ons.
|
||||
@ -132,7 +156,7 @@ if ( ! function_exists( 'generate_get_premium_url' ) ) {
|
||||
* @since 1.3.42
|
||||
*
|
||||
* @param string $url URL to premium page.
|
||||
* @param bool $trailing_slash Whether we want to include a trailing slash.
|
||||
* @param bool $trailing_slash Whether we want to include a trailing slash.
|
||||
* @return string The URL to generatepress.com.
|
||||
*/
|
||||
function generate_get_premium_url( $url = 'https://generatepress.com/premium', $trailing_slash = true ) {
|
||||
@ -140,10 +164,13 @@ if ( ! function_exists( 'generate_get_premium_url' ) ) {
|
||||
$url = trailingslashit( $url );
|
||||
}
|
||||
|
||||
$args = apply_filters( 'generate_premium_url_args', array(
|
||||
'ref' => null,
|
||||
'campaign' => null,
|
||||
) );
|
||||
$args = apply_filters(
|
||||
'generate_premium_url_args',
|
||||
array(
|
||||
'ref' => null,
|
||||
'campaign' => null,
|
||||
)
|
||||
);
|
||||
|
||||
if ( isset( $args['ref'] ) ) {
|
||||
$url = add_query_arg( 'ref', absint( $args['ref'] ), $url );
|
||||
@ -197,6 +224,7 @@ if ( ! function_exists( 'generate_get_link_url' ) ) {
|
||||
function generate_get_link_url() {
|
||||
$has_url = get_url_in_content( get_the_content() );
|
||||
|
||||
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Core filter name.
|
||||
return $has_url ? $has_url : apply_filters( 'the_permalink', get_permalink() );
|
||||
}
|
||||
}
|
||||
@ -220,7 +248,10 @@ if ( ! function_exists( 'generate_get_navigation_location' ) ) {
|
||||
* @since 2.3
|
||||
*/
|
||||
function generate_has_logo_site_branding() {
|
||||
if ( get_theme_mod( 'custom_logo' ) && ( ! generate_get_option( 'hide_title' ) || ! generate_get_option( 'hide_tagline' ) ) ) {
|
||||
$has_site_title = ! generate_get_option( 'hide_title' ) && get_bloginfo( 'title' );
|
||||
$has_site_tagline = ! generate_get_option( 'hide_tagline' ) && get_bloginfo( 'description' );
|
||||
|
||||
if ( get_theme_mod( 'custom_logo' ) && ( $has_site_title || $has_site_tagline ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -231,6 +262,9 @@ function generate_has_logo_site_branding() {
|
||||
* Create SVG icons.
|
||||
*
|
||||
* @since 2.3
|
||||
*
|
||||
* @param string $icon The icon to get.
|
||||
* @param bool $replace Whether we're replacing an icon on action (click).
|
||||
*/
|
||||
function generate_get_svg_icon( $icon, $replace = false ) {
|
||||
if ( 'svg' !== generate_get_option( 'icons' ) ) {
|
||||
@ -283,6 +317,24 @@ function generate_get_svg_icon( $icon, $replace = false ) {
|
||||
</svg>';
|
||||
}
|
||||
|
||||
if ( 'arrow-right' === $icon ) {
|
||||
$output = '<svg viewBox="0 0 192 512" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414">
|
||||
<path d="M178.425 256.001c0 2.266-1.133 4.815-2.832 6.515L43.599 394.509c-1.7 1.7-4.248 2.833-6.514 2.833s-4.816-1.133-6.515-2.833l-14.163-14.162c-1.699-1.7-2.832-3.966-2.832-6.515 0-2.266 1.133-4.815 2.832-6.515l111.317-111.316L16.407 144.685c-1.699-1.7-2.832-4.249-2.832-6.515s1.133-4.815 2.832-6.515l14.163-14.162c1.7-1.7 4.249-2.833 6.515-2.833s4.815 1.133 6.514 2.833l131.994 131.993c1.7 1.7 2.832 4.249 2.832 6.515z" fill-rule="nonzero"/>
|
||||
</svg>';
|
||||
}
|
||||
|
||||
if ( 'arrow-left' === $icon ) {
|
||||
$output = '<svg viewBox="0 0 192 512" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414">
|
||||
<path d="M178.425 138.212c0 2.265-1.133 4.813-2.832 6.512L64.276 256.001l111.317 111.277c1.7 1.7 2.832 4.247 2.832 6.513 0 2.265-1.133 4.813-2.832 6.512L161.43 394.46c-1.7 1.7-4.249 2.832-6.514 2.832-2.266 0-4.816-1.133-6.515-2.832L16.407 262.514c-1.699-1.7-2.832-4.248-2.832-6.513 0-2.265 1.133-4.813 2.832-6.512l131.994-131.947c1.7-1.699 4.249-2.831 6.515-2.831 2.265 0 4.815 1.132 6.514 2.831l14.163 14.157c1.7 1.7 2.832 3.965 2.832 6.513z" fill-rule="nonzero"/>
|
||||
</svg>';
|
||||
}
|
||||
|
||||
if ( 'arrow-up' === $icon ) {
|
||||
$output = '<svg viewBox="0 0 330 512" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414">
|
||||
<path d="M305.863 314.916c0 2.266-1.133 4.815-2.832 6.514l-14.157 14.163c-1.699 1.7-3.964 2.832-6.513 2.832-2.265 0-4.813-1.133-6.512-2.832L164.572 224.276 53.295 335.593c-1.699 1.7-4.247 2.832-6.512 2.832-2.265 0-4.814-1.133-6.513-2.832L26.113 321.43c-1.699-1.7-2.831-4.248-2.831-6.514s1.132-4.816 2.831-6.515L158.06 176.408c1.699-1.7 4.247-2.833 6.512-2.833 2.265 0 4.814 1.133 6.513 2.833L303.03 308.4c1.7 1.7 2.832 4.249 2.832 6.515z" fill-rule="nonzero"/>
|
||||
</svg>';
|
||||
}
|
||||
|
||||
if ( $replace ) {
|
||||
$output .= '<svg viewBox="0 0 512 512" aria-hidden="true" role="img" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1em" height="1em">
|
||||
<path d="M71.029 71.029c9.373-9.372 24.569-9.372 33.942 0L256 222.059l151.029-151.03c9.373-9.372 24.569-9.372 33.942 0 9.372 9.373 9.372 24.569 0 33.942L289.941 256l151.03 151.029c9.372 9.373 9.372 24.569 0 33.942-9.373 9.372-24.569 9.372-33.942 0L256 289.941l-151.029 151.03c-9.373 9.372-24.569 9.372-33.942 0-9.372-9.373-9.372-24.569 0-33.942L222.059 256 71.029 104.971c-9.372-9.373-9.372-24.569 0-33.942z" />
|
||||
@ -310,12 +362,11 @@ function generate_get_svg_icon( $icon, $replace = false ) {
|
||||
*
|
||||
* @since 2.3
|
||||
*
|
||||
* @param string $icon
|
||||
* @param bool $replace Whether to include the close icon to be shown using JS.
|
||||
* @return string
|
||||
* @param string $icon The icon to print.
|
||||
* @param bool $replace Whether to include the close icon to be shown using JS.
|
||||
*/
|
||||
function generate_do_svg_icon( $icon, $replace = false ) {
|
||||
echo generate_get_svg_icon( $icon, $replace );
|
||||
echo generate_get_svg_icon( $icon, $replace ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in function.
|
||||
}
|
||||
|
||||
/**
|
||||
@ -323,7 +374,7 @@ function generate_do_svg_icon( $icon, $replace = false ) {
|
||||
*
|
||||
* @since 2.4
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $name Name of the media query.
|
||||
* @return string The full media query.
|
||||
*/
|
||||
function generate_get_media_query( $name ) {
|
||||
@ -332,12 +383,312 @@ function generate_get_media_query( $name ) {
|
||||
$mobile = apply_filters( 'generate_mobile_media_query', '(max-width:768px)' );
|
||||
$mobile_menu = apply_filters( 'generate_mobile_menu_media_query', $mobile );
|
||||
|
||||
$queries = apply_filters( 'generate_media_queries', array(
|
||||
'desktop' => $desktop,
|
||||
'tablet' => $tablet,
|
||||
'mobile' => $mobile,
|
||||
'mobile-menu' => $mobile_menu,
|
||||
) );
|
||||
$queries = apply_filters(
|
||||
'generate_media_queries',
|
||||
array(
|
||||
'desktop' => $desktop,
|
||||
'tablet' => $tablet,
|
||||
'mobile' => $mobile,
|
||||
'mobile-menu' => $mobile_menu,
|
||||
)
|
||||
);
|
||||
|
||||
return $queries[ $name ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Display HTML classes for an element.
|
||||
*
|
||||
* @since 2.2
|
||||
*
|
||||
* @param string $context The element we're targeting.
|
||||
* @param string|array $class One or more classes to add to the class list.
|
||||
*/
|
||||
function generate_do_element_classes( $context, $class = '' ) {
|
||||
$after = apply_filters( 'generate_after_element_class_attribute', '', $context );
|
||||
|
||||
if ( $after ) {
|
||||
$after = ' ' . $after;
|
||||
}
|
||||
|
||||
echo 'class="' . join( ' ', generate_get_element_classes( $context, $class ) ) . '"' . $after; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in function.
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve HTML classes for an element.
|
||||
*
|
||||
* @since 2.2
|
||||
*
|
||||
* @param string $context The element we're targeting.
|
||||
* @param string|array $class One or more classes to add to the class list.
|
||||
* @return array Array of classes.
|
||||
*/
|
||||
function generate_get_element_classes( $context, $class = '' ) {
|
||||
$classes = array();
|
||||
|
||||
if ( ! empty( $class ) ) {
|
||||
if ( ! is_array( $class ) ) {
|
||||
$class = preg_split( '#\s+#', $class );
|
||||
}
|
||||
|
||||
$classes = array_merge( $classes, $class );
|
||||
}
|
||||
|
||||
$classes = array_map( 'esc_attr', $classes );
|
||||
|
||||
return apply_filters( "generate_{$context}_class", $classes, $class );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the kind of schema we're using.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_get_schema_type() {
|
||||
return apply_filters( 'generate_schema_type', 'microdata' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get any necessary microdata.
|
||||
*
|
||||
* @since 2.2
|
||||
*
|
||||
* @param string $context The element to target.
|
||||
* @return string Our final attribute to add to the element.
|
||||
*/
|
||||
function generate_get_microdata( $context ) {
|
||||
$data = false;
|
||||
|
||||
if ( 'microdata' !== generate_get_schema_type() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( 'body' === $context ) {
|
||||
$type = 'WebPage';
|
||||
|
||||
if ( is_home() || is_archive() || is_attachment() || is_tax() || is_single() ) {
|
||||
$type = 'Blog';
|
||||
}
|
||||
|
||||
if ( is_search() ) {
|
||||
$type = 'SearchResultsPage';
|
||||
}
|
||||
|
||||
$type = apply_filters( 'generate_body_itemtype', $type );
|
||||
|
||||
$data = sprintf(
|
||||
'itemtype="https://schema.org/%s" itemscope',
|
||||
esc_html( $type )
|
||||
);
|
||||
}
|
||||
|
||||
if ( 'header' === $context ) {
|
||||
$data = 'itemtype="https://schema.org/WPHeader" itemscope';
|
||||
}
|
||||
|
||||
if ( 'navigation' === $context ) {
|
||||
$data = 'itemtype="https://schema.org/SiteNavigationElement" itemscope';
|
||||
}
|
||||
|
||||
if ( 'article' === $context ) {
|
||||
$type = apply_filters( 'generate_article_itemtype', 'CreativeWork' );
|
||||
|
||||
$data = sprintf(
|
||||
'itemtype="https://schema.org/%s" itemscope',
|
||||
esc_html( $type )
|
||||
);
|
||||
}
|
||||
|
||||
if ( 'post-author' === $context ) {
|
||||
$data = 'itemprop="author" itemtype="https://schema.org/Person" itemscope';
|
||||
}
|
||||
|
||||
if ( 'comment-body' === $context ) {
|
||||
$data = 'itemtype="https://schema.org/Comment" itemscope';
|
||||
}
|
||||
|
||||
if ( 'comment-author' === $context ) {
|
||||
$data = 'itemprop="author" itemtype="https://schema.org/Person" itemscope';
|
||||
}
|
||||
|
||||
if ( 'sidebar' === $context ) {
|
||||
$data = 'itemtype="https://schema.org/WPSideBar" itemscope';
|
||||
}
|
||||
|
||||
if ( 'footer' === $context ) {
|
||||
$data = 'itemtype="https://schema.org/WPFooter" itemscope';
|
||||
}
|
||||
|
||||
if ( $data ) {
|
||||
return apply_filters( "generate_{$context}_microdata", $data );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output our microdata for an element.
|
||||
*
|
||||
* @since 2.2
|
||||
*
|
||||
* @param string $context The element to target.
|
||||
*/
|
||||
function generate_do_microdata( $context ) {
|
||||
echo generate_get_microdata( $context ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in function.
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to print hAtom output or not.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_is_using_hatom() {
|
||||
return apply_filters( 'generate_is_using_hatom', true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether we're using the Flexbox structure.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_is_using_flexbox() {
|
||||
// No flexbox for old versions of GPP.
|
||||
if ( defined( 'GP_PREMIUM_VERSION' ) && version_compare( GP_PREMIUM_VERSION, '1.11.0-alpha.1', '<' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return 'flexbox' === generate_get_option( 'structure' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we have any menu bar items.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_has_menu_bar_items() {
|
||||
return has_action( 'generate_menu_bar_items' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we should include the default template part.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param string $template The template to get.
|
||||
*/
|
||||
function generate_do_template_part( $template ) {
|
||||
/**
|
||||
* generate_before_do_template_part hook.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param string $template The template.
|
||||
*/
|
||||
do_action( 'generate_before_do_template_part', $template );
|
||||
|
||||
if ( apply_filters( 'generate_do_template_part', true, $template ) ) {
|
||||
if ( 'archive' === $template || 'index' === $template ) {
|
||||
get_template_part( 'content', get_post_format() );
|
||||
}
|
||||
|
||||
if ( 'page' === $template ) {
|
||||
get_template_part( 'content', 'page' );
|
||||
}
|
||||
|
||||
if ( 'single' === $template ) {
|
||||
get_template_part( 'content', 'single' );
|
||||
}
|
||||
|
||||
if ( 'search' === $template ) {
|
||||
get_template_part( 'content', 'search' );
|
||||
}
|
||||
|
||||
if ( '404' === $template ) {
|
||||
get_template_part( 'content', '404' );
|
||||
}
|
||||
|
||||
if ( 'none' === $template ) {
|
||||
get_template_part( 'no-results' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_after_do_template_parts hook.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param string $template The template.
|
||||
*/
|
||||
do_action( 'generate_after_do_template_part', $template );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we should use inline mobile navigation.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_has_inline_mobile_toggle() {
|
||||
$has_inline_mobile_toggle = generate_is_using_flexbox() && ( 'nav-float-right' === generate_get_navigation_location() || 'nav-float-left' === generate_get_navigation_location() );
|
||||
|
||||
return apply_filters( 'generate_has_inline_mobile_toggle', $has_inline_mobile_toggle );
|
||||
}
|
||||
|
||||
/**
|
||||
* Build our the_title() parameters.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_get_the_title_parameters() {
|
||||
$params = array(
|
||||
'before' => sprintf(
|
||||
'<h1 class="entry-title"%s>',
|
||||
'microdata' === generate_get_schema_type() ? ' itemprop="headline"' : ''
|
||||
),
|
||||
'after' => '</h1>',
|
||||
);
|
||||
|
||||
if ( ! is_singular() ) {
|
||||
$params = array(
|
||||
'before' => sprintf(
|
||||
'<h2 class="entry-title"%2$s><a href="%1$s" rel="bookmark">',
|
||||
esc_url( get_permalink() ),
|
||||
'microdata' === generate_get_schema_type() ? ' itemprop="headline"' : ''
|
||||
),
|
||||
'after' => '</a></h2>',
|
||||
);
|
||||
}
|
||||
|
||||
if ( 'link' === get_post_format() ) {
|
||||
$params = array(
|
||||
'before' => sprintf(
|
||||
'<h2 class="entry-title"%2$s><a href="%1$s" rel="bookmark">',
|
||||
esc_url( generate_get_link_url() ),
|
||||
'microdata' === generate_get_schema_type() ? ' itemprop="headline"' : ''
|
||||
),
|
||||
'after' => '</a></h2>',
|
||||
);
|
||||
}
|
||||
|
||||
return apply_filters( 'generate_get_the_title_parameters', $params );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether we should display the default loop or not.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_has_default_loop() {
|
||||
return apply_filters( 'generate_has_default_loop', true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Detemine whether to output site branding container.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function generate_needs_site_branding_container() {
|
||||
$container = false;
|
||||
|
||||
if ( generate_has_logo_site_branding() ) {
|
||||
if ( generate_is_using_flexbox() || generate_get_option( 'inline_logo_site_branding' ) ) {
|
||||
$container = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $container;
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user