Skip to content

New: migrate from Elementor Pro custom code to Code Snippets#346

Draft
rami-elementor wants to merge 1 commit intocore-betafrom
elementor-migration
Draft

New: migrate from Elementor Pro custom code to Code Snippets#346
rami-elementor wants to merge 1 commit intocore-betafrom
elementor-migration

Conversation

@rami-elementor
Copy link
Copy Markdown
Contributor

Elementor custom code:

image

Code Snippets Importer:

image image

Code Snippets:

image

@rami-elementor
Copy link
Copy Markdown
Contributor Author

The imported generated with AI, but it's not yet ready for merge. The locations should be tweaked, they are not imported as intended.

@louiswol94
Copy link
Copy Markdown
Contributor

@rami-elementor The scope gap might not be something we can fix within his PR alone - it requires a change to Code Snippets core - adding a body-open-content scope. Let's discuss it internally.

@louiswol94
Copy link
Copy Markdown
Contributor

@rami-elementor Coming to think of it, I also had some other locations in the other plugins that were not supported, so I skipped them. But we can definitely add a backlog task to support more locations in Code Snippets.

public function create_snippet( array $snippet_data, bool $multisite ): ?Snippet {
$kind = $snippet_data['code_kind'] ?? '';

if ( ! in_array( $kind, [ 'html', 'css', 'js' ], true ) ) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
if ( ! in_array( $kind, [ 'html', 'css', 'js' ], true ) ) {
if ( ! in_array( $kind, [ 'html' ], true ) ) {

CSS and JS should be in Pro only.

Comment on lines +177 to +185
if ( 'html' === $kind ) {
return 'head-content';
}
if ( 'css' === $kind ) {
return 'site-css';
}
if ( 'js' === $kind ) {
return 'site-head-js';
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
if ( 'html' === $kind ) {
return 'head-content';
}
if ( 'css' === $kind ) {
return 'site-css';
}
if ( 'js' === $kind ) {
return 'site-head-js';
}
if ( 'html' === $kind ) {
return 'head-content';
}

Same here

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.

2 participants