Skip to content

Commit a80694b

Browse files
refactor: clean up upsell control logic and enhance feature comparison links
1 parent 80702da commit a80694b

File tree

2 files changed

+49
-93
lines changed

2 files changed

+49
-93
lines changed

inc/customizer/options/upsells.php

Lines changed: 41 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,7 @@ private function control_upsells() {
479479
'Neve\Customizer\Controls\Upsells\Scroll_To_Top_Control'
480480
)
481481
);
482-
483-
$upsells = [];
482+
484483
$upsells_banners = [];
485484

486485
$hfg_header = 'hfg_header';
@@ -514,26 +513,6 @@ private function control_upsells() {
514513
$is_dismissed = get_transient( 'upsell_dismiss_banner_customizer' );
515514
if ( $is_dismissed === false ) {
516515
foreach ( $upsells_banners as $id => $args ) {
517-
if ( isset( $args['type'] ) && $args['type'] === 'section' ) {
518-
$section_id = 'neve_' . $id . '_upsell_section';
519-
$this->add_section(
520-
new Section(
521-
$section_id,
522-
array_merge(
523-
$args,
524-
[
525-
'type' => 'neve_upsell_banner_section',
526-
'priority' => 10000,
527-
'nonce' => wp_create_nonce( 'neve-upsell-banner-nonce' ),
528-
'url' => tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'panel-' . $args['panel'] ), 'query' ),
529-
]
530-
),
531-
'\Neve\Customizer\Controls\React\Upsell_Banner_Section'
532-
)
533-
);
534-
535-
continue;
536-
}
537516
$control_id = 'neve_' . $id . '_upsell_banner_control';
538517
$this->add_control(
539518
new Control(
@@ -554,58 +533,24 @@ private function control_upsells() {
554533
}
555534
}
556535

557-
foreach ( $upsells as $id => $args ) {
558-
if ( isset( $args['type'] ) && $args['type'] === 'section' ) {
559-
$this->add_section(
560-
new Section(
561-
'neve_' . $id . '_upsell_section',
562-
array_merge(
563-
$args,
564-
[
565-
'type' => 'nv_simple_upsell_section',
566-
'priority' => 10000,
567-
'link' => tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'panel-' . $args['panel'] ), 'query' ),
568-
]
569-
),
570-
'\Neve\Customizer\Controls\Simple_Upsell_Section'
571-
)
572-
);
573-
574-
return false;
575-
}
576-
$this->add_control(
577-
new Control(
578-
'neve_' . $id . '_upsell',
579-
[ 'sanitize_callback' => 'sanitize_text_field' ],
580-
array_merge(
581-
$args,
582-
[
583-
'priority' => 10000,
584-
'link' => tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'section-' . $args['section'] ), 'query' ),
585-
]
586-
),
587-
'Neve\Customizer\Controls\Simple_Upsell'
588-
)
589-
);
590-
}
591-
592536
$this->add_control(
593537
new Control(
594538
'neve_blog_archive_upsell_control_features',
595539
[ 'sanitize_callback' => 'sanitize_text_field' ],
596540
[
597-
'text' => __( 'Extend your blog/archive capabilities with more powerful customization options.', 'neve' ),
598-
'button_text' => __( 'Upgrade to unlock', 'neve' ),
599-
'section' => 'neve_blog_archive_layout',
600-
'priority' => 10000,
601-
'link' => tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'section-neve_blog_archive_layout' ), 'query' ),
602-
'features_list' => array(
541+
'text' => __( 'Extend your blog/archive capabilities with more powerful customization options.', 'neve' ),
542+
'button_text' => __( 'Upgrade to unlock', 'neve' ),
543+
'section' => 'neve_blog_archive_layout',
544+
'priority' => 10000,
545+
'link' => tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'section-neve_blog_archive_layout' ), 'query' ),
546+
'features_list' => array(
603547
__( 'Image style', 'neve' ),
604548
__( 'Content padding', 'neve' ),
605549
__( 'Overlay color', 'neve' ),
606550
__( 'Grid spacing', 'neve' ),
607551
),
608-
'title' => __( 'Unlock Full Potential', 'neve' ),
552+
'title' => __( 'Unlock Full Potential', 'neve' ),
553+
'url_page_section' => 'blog',
609554
],
610555
'Neve\Customizer\Controls\Simple_Upsell'
611556
)
@@ -616,18 +561,19 @@ private function control_upsells() {
616561
'neve_single_post_upsell_control_features',
617562
[ 'sanitize_callback' => 'sanitize_text_field' ],
618563
[
619-
'text' => __( 'Extend your single post capabilities with more powerful customization options.', 'neve' ),
620-
'button_text' => __( 'Upgrade to unlock', 'neve' ),
621-
'section' => 'neve_single_post_layout',
622-
'priority' => 10000,
623-
'link' => tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'section-neve_single_post_layout' ), 'query' ),
624-
'features_list' => array(
564+
'text' => __( 'Extend your single post capabilities with more powerful customization options.', 'neve' ),
565+
'button_text' => __( 'Upgrade to unlock', 'neve' ),
566+
'section' => 'neve_single_post_layout',
567+
'priority' => 10000,
568+
'link' => tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'section-neve_single_post_layout' ), 'query' ),
569+
'features_list' => array(
625570
__( 'Related post', 'neve' ),
626571
__( 'Sharing icons', 'neve' ),
627572
__( 'Author biography', 'neve' ),
628573
__( 'Estimated reading time', 'neve' ),
629574
),
630-
'title' => __( 'Unlock Full Potential', 'neve' ),
575+
'title' => __( 'Unlock Full Potential', 'neve' ),
576+
'url_page_section' => 'single',
631577
],
632578
'Neve\Customizer\Controls\Simple_Upsell'
633579
)
@@ -642,18 +588,19 @@ private function control_upsells() {
642588
'neve_' . $woo_section . '_features_upsell',
643589
[ 'sanitize_callback' => 'sanitize_text_field' ],
644590
[
645-
'text' => __( 'Extend your single post capabilities with more powerful customization options.', 'neve' ),
646-
'button_text' => __( 'Upgrade to unlock', 'neve' ),
647-
'section' => $woo_section,
648-
'priority' => 10000,
649-
'link' => tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'section-' . $woo_section ), 'query' ),
650-
'features_list' => array(
591+
'text' => __( 'Extend your single post capabilities with more powerful customization options.', 'neve' ),
592+
'button_text' => __( 'Upgrade to unlock', 'neve' ),
593+
'section' => $woo_section,
594+
'priority' => 10000,
595+
'link' => tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'section-' . $woo_section ), 'query' ),
596+
'features_list' => array(
651597
__( 'Quick view', 'neve' ),
652598
__( 'Wishlist', 'neve' ),
653599
__( 'Variations swatches', 'neve' ),
654600
__( 'Comparison table', 'neve' ),
655601
),
656-
'title' => __( 'Neve Pro Features', 'neve' ),
602+
'title' => __( 'Neve Pro Features', 'neve' ),
603+
'url_page_section' => 'woocommerce',
657604
],
658605
'Neve\Customizer\Controls\Simple_Upsell'
659606
)
@@ -665,18 +612,19 @@ private function control_upsells() {
665612
new Section(
666613
$hfg_footer,
667614
[
668-
'text' => __( 'Extend your footer capabilities with more powerful customization options.', 'neve' ),
669-
'button_text' => __( 'Upgrade to unlock', 'neve' ),
670-
'panel' => $hfg_footer,
671-
'priority' => 10000,
672-
'link' => tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'panel-' . $hfg_footer ), 'query' ),
673-
'features_list' => array(
615+
'text' => __( 'Extend your footer capabilities with more powerful customization options.', 'neve' ),
616+
'button_text' => __( 'Upgrade to unlock', 'neve' ),
617+
'panel' => $hfg_footer,
618+
'priority' => 10000,
619+
'link' => tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'panel-' . $hfg_footer ), 'query' ),
620+
'features_list' => array(
674621
__( 'Copyright edits', 'neve' ),
675622
__( 'Divider element', 'neve' ),
676623
__( 'Payments & social icons', 'neve' ),
677624
__( 'Custom layouts', 'neve' ),
678625
),
679-
'title' => __( 'Unlock Full Potential', 'neve' ),
626+
'title' => __( 'Unlock Full Potential', 'neve' ),
627+
'url_page_section' => 'pagefooter',
680628
],
681629
'\Neve\Customizer\Controls\Simple_Upsell_Section'
682630
)
@@ -686,18 +634,19 @@ private function control_upsells() {
686634
new Section(
687635
'nv_header_section_upsell_features',
688636
[
689-
'text' => __( 'Extend your header capabilities with more powerful customization options.', 'neve' ),
690-
'button_text' => __( 'Upgrade to unlock', 'neve' ),
691-
'panel' => $hfg_header,
692-
'priority' => 10000,
693-
'link' => tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'panel-' . $hfg_header ), 'query' ),
694-
'features_list' => array(
637+
'text' => __( 'Extend your header capabilities with more powerful customization options.', 'neve' ),
638+
'button_text' => __( 'Upgrade to unlock', 'neve' ),
639+
'panel' => $hfg_header,
640+
'priority' => 10000,
641+
'link' => tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'panel-' . $hfg_header ), 'query' ),
642+
'features_list' => array(
695643
__( 'Sticky header', 'neve' ),
696644
__( 'Transparent header', 'neve' ),
697645
__( 'Display rules', 'neve' ),
698646
__( 'More components', 'neve' ),
699647
),
700-
'title' => __( 'Unlock Full Potential', 'neve' ),
648+
'title' => __( 'Unlock Full Potential', 'neve' ),
649+
'url_page_section' => 'pageheader',
701650
],
702651
'\Neve\Customizer\Controls\Simple_Upsell_Section'
703652
)

inc/customizer/traits/features_upsell.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ trait Features_Upsell {
2626
*/
2727
public $title = '';
2828

29+
/**
30+
* Page section in comparison table.
31+
*
32+
* @var string $url_page_section The page section.
33+
*/
34+
public $url_page_section = '';
35+
2936
/**
3037
* Gather the parameters passed to client JavaScript via JSON for features list rendering.
3138
*
@@ -68,7 +75,7 @@ private function render_features_body() {
6875
<?php echo esc_html( $this->button_text ); ?>
6976
</a>
7077

71-
<a href="https://docs.themeisle.com/article/1176-what-is-the-difference-between-neve-and-neve-pro#pagefooter" class="button button-link" target="_blank" rel="noopener noreferrer">
78+
<a href="<?php echo esc_url_raw( 'https://docs.themeisle.com/article/1176-what-is-the-difference-between-neve-and-neve-pro#' . $this->url_page_section ); ?>" class="button button-link" target="_blank" rel="noopener noreferrer">
7279
<?php echo esc_html__( 'View features comparison', 'neve' ); ?> &rarr;
7380
</a>
7481
</div>

0 commit comments

Comments
 (0)