Skip to content

Conversation

@rami-elementor
Copy link
Contributor

Elementor released a new design in WordPress admin, with updated slugs. Promotions for CS should be displayed in the new Custom Code screens.

Promotion in empty archive:
image

Promotion in archive with custom code:
image

Promotion in new custom code:
image

@VerdiH
Copy link
Collaborator

VerdiH commented Jan 20, 2026

Amazing work @rami-elementor !

@imantsk imantsk changed the title Update promotions for Elementor One feat: Update promotions for Elementor One Jan 20, 2026
<div class="notice notice-info is-dismissible code-snippets-promotion">
<div class="code-snippets-promotion-icon">
<img
src="<?php echo esc_url( plugins_url( 'assets/icon.svg', CODE_SNIPPETS_FILE ) ); ?>"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use PLUGIN_FILE.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing to PLUGIN_FILE causes a critical error:

There has been a critical error on this website. Please check your site admin email inbox for instructions. If you continue to have problems, please try the [support forums](https://wordpress.org/support/forums/).

@rami-elementor
Copy link
Contributor Author

rami-elementor commented Jan 23, 2026

Additional plugins:

image image image image

@rami-elementor rami-elementor changed the title feat: Update promotions for Elementor One feat: Update promotions for Elementor One & add promotions to additional plugins Jan 23, 2026
@imantsk imantsk changed the title feat: Update promotions for Elementor One & add promotions to additional plugins [CWA-744] feat: Update promotions for Elementor One & add promotions to additional plugins Jan 29, 2026
@notion-workspace
Copy link

Copy link
Member

@imantsk imantsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall very nice and scalable structure 👍
spotted a few improvement opportunities.
also if you have a chance please run phpcbf over the the files in this PR to consolidate all indentation and formatting

Comment on lines +96 to +99
<strong><?php echo $this->get_promotion_heading(); ?></strong>
</p>
<p>
<?php echo $this->get_promotion_message(); ?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

echo on get_promotion_heading() and get_promotion_message() could use wp_kses_post()

$url,
$class,
$target ? ' target="' . $target . '"' : '',
$text
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe esc_html( $text ) here?

Comment on lines +69 to +77
if ( $this->is_code_snippets_pro() ) {
$link_text = esc_html__( 'Manage CSS snippets', 'code-snippets' );
$url = add_query_arg( 'type', 'css', code_snippets()->get_menu_url() );
} else {
$link_text = esc_html__( 'Learn More', 'code-snippets' );
$url = 'https://codesnippets.pro/pricing/?utm_source=elementor&utm_medium=banner&utm_campaign=elementor-addon-custom-code';
}

return sprintf( '%s <br><br><a href="%s" target="_blank" class="e-btn e-info" style="color:#fff;">%s</a>', $message, $url, $link_text );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you say about this:

$link_text = esc_html__( 'Learn More', 'code-snippets' );
$url       = 'https://codesnippets.pro/pricing/?utm_source=elementor&utm_medium=banner&utm_campaign=elementor-addon-custom-code';

if ( $this->is_code_snippets_pro() ) {
	$link_text = esc_html__( 'Manage CSS snippets', 'code-snippets' );
	$url       = add_query_arg( 'type', 'css', code_snippets()->get_menu_url() );
}

return sprintf(
	'%s <br><br><a href="%s" target="_blank" rel="noopener noreferrer" class="e-btn e-info" style="color:#fff;">%s</a>',
	esc_html( $message ),
	esc_url( $url ),
	esc_html( $link_text )
);

Comment on lines +40 to +54
public function get_promotion_buttons(): array {
return [
[
'url' => code_snippets()->get_menu_url(),
'text' => esc_html__( 'Manage your snippets', 'code-snippets' ),
'class' => 'button button-primary',
],
[
'url' => 'https://codesnippets.pro/pricing/?utm_source=' . $this->get_plugin_slug() . '&utm_medium=promotion&utm_campaign=custom-code',
'text' => esc_html__( 'Learn More', 'code-snippets' ),
'class' => 'button button-secondary',
'target' => '_blank',
],
];
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see this button building repeats on each promotion class.
this makes me think that it could be standardised and go directly in the base class

);
}

public function get_promotion_buttons(): array {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


wp_send_json_success();
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could add this here:

protected function build_default_buttons( bool $show_migrate = false ): array {
	$primary = [
		'url'   => code_snippets()->get_menu_url(),
		'text'  => esc_html__( 'Manage your snippets', 'code-snippets' ),
		'class' => 'button button-primary',
	];

	if ( $show_migrate ) {
		$primary['url']  = add_query_arg( 'tab', 'plugins', code_snippets()->get_menu_url( 'import' ) );
		$primary['text'] = esc_html__( 'Migrate to Code Snippets', 'code-snippets' );
	}

	return [
		$primary,
		[
			'url'    => 'https://codesnippets.pro/pricing/?utm_source=' . $this->get_plugin_slug() . '&utm_medium=promotion&utm_campaign=custom-code',
			'text'   => esc_html__( 'Learn More', 'code-snippets' ),
			'class'  => 'button button-secondary',
			'target' => '_blank',
			'rel'    => 'noopener noreferrer',
		],
	];
}

Comment on lines +34 to +46
return [
[
'url' => code_snippets()->get_menu_url(),
'text' => esc_html__( 'Manage your snippets', 'code-snippets' ),
'class' => 'button button-primary',
],
[
'url' => 'https://codesnippets.pro/pricing/?utm_source=' . $this->get_plugin_slug() . '&utm_medium=promotion&utm_campaign=custom-code',
'text' => esc_html__( 'Learn More', 'code-snippets' ),
'class' => 'button button-secondary',
'target' => '_blank',
],
];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can easily become:

return $this->build_default_buttons();

ref: https://github.com/codesnippetspro/code-snippets/pull/329/changes#r2743330836

Comment on lines +39 to +53
public function get_promotion_buttons(): array {
return [
[
'url' => code_snippets()->get_menu_url(),
'text' => esc_html__( 'Manage your snippets', 'code-snippets' ),
'class' => 'button button-primary',
],
[
'url' => 'https://codesnippets.pro/pricing/?utm_source=' . $this->get_plugin_slug() . '&utm_medium=promotion&utm_campaign=custom-code',
'text' => esc_html__( 'Learn More', 'code-snippets' ),
'class' => 'button button-secondary',
'target' => '_blank',
],
];
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +38 to +61
$buttons = [];

if ( $this->has_snippets() ) {
$buttons[] = [
'url' => add_query_arg( 'tab', 'plugins', code_snippets()->get_menu_url( 'import' ) ),
'text' => esc_html__( 'Migrate to Code Snippets', 'code-snippets' ),
'class' => 'button button-primary',
];
} else {
$buttons[] = [
'url' => code_snippets()->get_menu_url(),
'text' => esc_html__( 'Manage your snippets', 'code-snippets' ),
'class' => 'button button-primary',
];
}

$buttons[] = [
'url' => 'https://codesnippets.pro/pricing/?utm_source=' . $this->get_plugin_slug() . '&utm_medium=promotion&utm_campaign=custom-code',
'text' => esc_html__( 'Learn More', 'code-snippets' ),
'class' => 'button button-secondary',
'target' => '_blank',
];

return $buttons;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can become:

return $this->build_default_buttons( $this->has_snippets() );

ref: https://github.com/codesnippetspro/code-snippets/pull/329/changes#r2743330836

Comment on lines +37 to +49
return [
[
'url' => code_snippets()->get_menu_url(),
'text' => esc_html__( 'Manage your snippets', 'code-snippets' ),
'class' => 'button button-primary',
],
[
'url' => 'https://codesnippets.pro/pricing/?utm_source=' . $this->get_plugin_slug() . '&utm_medium=promotion&utm_campaign=custom-code',
'text' => esc_html__( 'Learn More', 'code-snippets' ),
'class' => 'button button-secondary',
'target' => '_blank',
],
];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as others

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants