• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 7c8c27568bfca150f6eb966269e1eb1811e975c1

04 Dec 2025 09:02AM UTC coverage: 53.038% (-0.02%) from 53.053%
7c8c27568bfca150f6eb966269e1eb1811e975c1

push

github

web-flow
Merge pull request #22783 from Yoast/enrico/wooseo-copy

Improve copy in the sidebar ad - WooCommerce SEO case

8706 of 16076 branches covered (54.16%)

Branch coverage included in aggregate %.

1 of 41 new or added lines in 3 files covered. (2.44%)

2 existing lines in 2 files now uncovered.

32426 of 61476 relevant lines covered (52.75%)

46903.43 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/presenters/admin/sidebar-presenter.php
1
<?php
2

3
namespace Yoast\WP\SEO\Presenters\Admin;
4

5
use WPSEO_Shortlinker;
6
use Yoast\WP\SEO\Conditionals\WooCommerce_Conditional;
7
use Yoast\WP\SEO\Presenters\Abstract_Presenter;
8
use Yoast\WP\SEO\Promotions\Application\Promotion_Manager;
9

10
/**
11
 * Presenter class for the Yoast SEO sidebar.
12
 */
13
class Sidebar_Presenter extends Abstract_Presenter {
14

15
        /**
16
         * Presents the sidebar.
17
         *
18
         * @return string The sidebar HTML.
19
         */
20
        public function present() {
×
21
                $title = \__( 'BLACK FRIDAY | 30% OFF', 'wordpress-seo' );
×
22

23
                $assets_uri            = \trailingslashit( \plugin_dir_url( \WPSEO_FILE ) );
×
24
                $is_woocommerce_active = ( new WooCommerce_Conditional() )->is_met();
×
25
                $shortlink             = ( $is_woocommerce_active ) ? WPSEO_Shortlinker::get( 'https://yoa.st/admin-sidebar-upsell-woocommerce' ) : WPSEO_Shortlinker::get( 'https://yoa.st/jj' );
×
26

27
                \ob_start();
×
28
                ?>
29
                <div class="wpseo_content_cell" id="sidebar-container">
×
30
                        <div id="sidebar" class="yoast-sidebar">
×
31
                                <div class="wpseo_content_cell_title yoast-sidebar__title">
×
32
                                        <?php
×
33
                                        /* translators: %1$s expands to Yoast */
34
                                        \printf( \esc_html__( '%1$s recommendations for you', 'wordpress-seo' ), 'Yoast' );
×
35
                                        ?>
36
                                </div>
×
37

38
                                <div class="yoast-sidebar__product<?php echo ( $is_woocommerce_active ) ? ' woocommerce' : ''; ?>">
×
39
                                        <figure class="product-image">
40
                                                <figure class="product-image">
41
                                                        <img
42
                                                                width="64" height="64"
43
                                                                src="<?php echo ( $is_woocommerce_active ) ? \esc_url( $assets_uri . 'packages/js/images/woo-seo-logo-new.svg' ) : \esc_url( $assets_uri . 'packages/js/images/yoast-premium-logo-new.svg' ); ?>"
×
44
                                                                class="attachment-full size-full content-visible"
45
                                                                alt="Yoast SEO logo"
46
                                                                loading="lazy"
47
                                                                decoding="async"
48
                                                                fetchpriority="low"
49
                                                                sizes="(min-width: 1321px) 64">
50
                                                </figure>
51
                                        </figure>
52
                                        <?php
53
                                        if (
54
                                                \YoastSEO()->classes->get( Promotion_Manager::class )
×
55
                                                        ->is( 'black-friday-promotion' ) ) :
×
56
                                                ?>
57
                                                <div class="sidebar__sale_banner_container">
×
58
                                                        <div class="sidebar__sale_banner">
×
59
                                                                <span class="banner_text"><?php echo \esc_html( $title ); ?></span>
×
60
                                                        </div>
61
                                                </div>
62
                                        <?php endif; ?>
63
                                        <h2 class="yoast-get-premium-title">
×
64
                                                <?php
×
65
                                                        /* translators: %1$s and %2$s expand to a span wrap to avoid linebreaks. %3$s expands to "Yoast SEO Premium". */
66
                                                        echo ( $is_woocommerce_active ) ? \sprintf( \esc_html__( '%1$s%2$s %3$s', 'wordpress-seo' ), '<span>', '</span>', 'Yoast WooCommerce SEO' ) : \sprintf( \esc_html__( '%1$s%2$s %3$s', 'wordpress-seo' ), '<span>', '</span>', 'Yoast SEO Premium' );
×
67
                                                ?>
68
                                        </h2>
×
69
                                        <div>
×
70
                                                <p class="info-header">
×
71
                                                <?php
×
NEW
72
                                                        echo ( $is_woocommerce_active ) ? \esc_html__( "Grow your store's visibility!", 'wordpress-seo' ) : \esc_html__( 'Spend less time on SEO tasks!', 'wordpress-seo' );
×
73
                                                ?>
74
                                                </p>
×
75
                                                <p class="info">
×
76
                                                <?php
×
NEW
77
                                                echo ( $is_woocommerce_active ) ? \esc_html__( 'Help ready-to-buy shoppers and search engines find your product.', 'wordpress-seo' ) : \esc_html__( 'Optimize your site faster, smarter, and with more confidence', 'wordpress-seo' );
×
78
                                                ?>
79
                                                </p>
×
80
                                                <ul class="yoast-features-list">
×
81
                                                <?php
×
NEW
82
                                                if ( $is_woocommerce_active ) {
×
NEW
83
                                                        echo '<li>' . \esc_html__( 'Add product details to help your listings stand out', 'wordpress-seo' ) . '</li>';
×
NEW
84
                                                        echo '<li>' . \esc_html__( 'Make sure search engines show the right version of your product page', 'wordpress-seo' ) . '</li>';
×
NEW
85
                                                        echo '<li>' . \esc_html__( 'Create optimized SEO titles & meta descriptions with AI', 'wordpress-seo' ) . '</li>';
×
NEW
86
                                                        echo '<li>' . \esc_html__( 'Receive clear SEO and readability guidance to optimize your products', 'wordpress-seo' ) . '</li>';
×
87
                                                }
88
                                                else {
NEW
89
                                                        echo '<li>' . \esc_html__( 'Create optimized SEO titles & meta descriptions in seconds', 'wordpress-seo' ) . '</li>';
×
NEW
90
                                                        echo '<li>' . \esc_html__( 'Apply AI suggestions to improve content in 1 click', 'wordpress-seo' ) . '</li>';
×
NEW
91
                                                        echo '<li>' . \esc_html__( 'Manage redirects with ease and without extra plugins', 'wordpress-seo' ) . '</li>';
×
NEW
92
                                                        echo '<li>' . \esc_html__( 'Optimize pages for multiple keywords with guidance', 'wordpress-seo' ) . '</li>';
×
93
                                                }
94
                                                ?>
95
                                                </ul>
×
96
                                                <p class="plugin-buy-button">
×
97
                                                        <a class="yoast-button-upsell" data-action="load-nfd-ctb"
×
98
                                                        data-ctb-id="f6a84663-465f-4cb5-8ba5-f7a6d72224b2" target="_blank"
×
99
                                                        href="<?php echo \esc_url( $shortlink ); ?>">
×
100
                                                <?php
101
                                                if (
NEW
102
                                                        \YoastSEO()->classes->get( Promotion_Manager::class )
×
NEW
103
                                                                ->is( 'black-friday-promotion' ) ) {
×
NEW
104
                                                        echo \esc_html__( 'Buy now for 30% off', 'wordpress-seo' );
×
105
                                                }
NEW
106
                                                elseif ( $is_woocommerce_active ) {
×
UNCOV
107
                                                                \printf(
×
108
                                                                /* translators: %s expands to "Yoast SEO Premium". */
109
                                                                        \esc_html__( 'Get %s', 'wordpress-seo' ),
×
NEW
110
                                                                        'WooCommerce SEO'
×
111
                                                                );
×
112
                                                }
113
                                                else {
NEW
114
                                                        \printf(
×
115
                                                        /* translators: %s expands to "Yoast SEO Premium". */
NEW
116
                                                                \esc_html__( 'Get %s', 'wordpress-seo' ),
×
NEW
117
                                                                'Yoast SEO Premium'
×
NEW
118
                                                        );
×
119
                                                }
120
                                                ?>
121
                                                        <span aria-hidden="true" class="yoast-button-upsell__caret"></span>
×
122
                                                        </a>
×
123
                                                </p>
×
124
                                                <p class="yoast-price-micro-copy">
×
125
                                                        <?php
×
NEW
126
                                                        echo ( $is_woocommerce_active ) ? \esc_html__( 'Less friction. Smarter optimization.', 'wordpress-seo' ) : \esc_html__( 'Less friction. Faster publishing.', 'wordpress-seo' );
×
127
                                                        ?>
128
                                                </p>
×
129
                                                <hr class="yoast-upsell-hr" aria-hidden="true">
×
130
                                                <ul class="yoast-guarantees-list">
×
131
                                                        <li>
×
132
                                                                <?php
×
133
                                                                echo \esc_html__( '30-day money back guarantee', 'wordpress-seo' );
×
134
                                                                ?>
135
                                                        </li>
×
136
                                                        <li>
×
137
                                                                <?php
×
138
                                                                echo \esc_html__( '24/7 support', 'wordpress-seo' );
×
139
                                                                ?>
140
                                                        </li>
×
141
                                                </ul>
×
142
                                        </div>
×
143
                                </div>
×
144
                        </div>
×
145
                        <div class="yoast-sidebar__section">
×
146
                                <h2>
×
NEW
147
                                <?php
×
NEW
148
                                \esc_html_e( 'Learn SEO', 'wordpress-seo' );
×
149
                                ?>
150
                                </h2>
×
151
                                <p>
×
NEW
152
                                <?php
×
NEW
153
                                $academy_shortlink = WPSEO_Shortlinker::get( 'https://yoa.st/3t6' );
×
154

155
                                /* translators: %1$s expands to Yoast SEO academy, which is a clickable link. */
NEW
156
                                \printf( \esc_html__( 'Want to learn SEO from Team Yoast? Check out our %1$s!', 'wordpress-seo' ), '<a href="' . \esc_url( $academy_shortlink ) . '" target="_blank"><strong>Yoast SEO academy</strong></a>' );
×
NEW
157
                                echo '<br/>';
×
NEW
158
                                \esc_html_e( 'We have both free and premium online courses to learn everything you need to know about SEO.', 'wordpress-seo' );
×
159
                                ?>
160
                                </p>
×
161
                                <p>
×
162
                                        <a href="<?php echo \esc_url( $academy_shortlink ); ?>" style="font-weight: 500" target="_blank">
×
163
                                                                <?php
164
                                                                /* translators: %1$s expands to Yoast SEO academy */
NEW
165
                                                                \printf( \esc_html__( 'Check out %1$s', 'wordpress-seo' ), 'Yoast SEO academy' );
×
166
                                                                ?>
167
                                                <span class="screen-reader-text">
×
168
                                                        <?php
×
169
                                                        /* translators: Hidden accessibility text. */
170
                                                        \printf( \esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' ) );
×
171
                                                        ?>
172
                                                </span>
×
173
                                                <img
×
174
                                                        src='data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="9" viewBox="0 0 10 9" fill="none"><path d="M3.99951 1.49988H1.99951C1.44723 1.49988 0.999512 1.94759 0.999512 2.49988V7.49988C0.999512 8.05216 1.44723 8.49988 1.99951 8.49988H6.99951C7.5518 8.49988 7.99951 8.05216 7.99951 7.49988V5.49988M5.99951 0.499878H8.99951M8.99951 0.499878V3.49988M8.99951 0.499878L3.99951 5.49988" stroke="%230085ba" stroke-linecap="round" stroke-linejoin="round"/></svg>'
×
175
                                                        alt="" aria-hidden="true" width="10" height="9"
×
176
                                                />
×
177
                                        </a>
×
178
                                </p>
×
179
                        </div>
×
180
                </div>
×
181
                <?php
×
182
                return \ob_get_clean();
×
183
        }
184
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc