Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with WordPress page builder plugins #36

Open
rieckpil opened this issue Feb 28, 2022 · 15 comments
Open

Integration with WordPress page builder plugins #36

rieckpil opened this issue Feb 28, 2022 · 15 comments

Comments

@rieckpil
Copy link

rieckpil commented Feb 28, 2022

Thanks a lot for all your efforts in making the Crayon plugin work seamlessly with recent WordPress and PHP versions 💯

I don't have much experience with WordPress plugin development but wanted to ask what it would take to make the plugin work with other WordPress page builder plugins (Thrive Architect to be specific). Which scripts/resources would I have to include/enqueue for pages that are generated with a page builder? I don't need the widget for creating a new code snippet, adding the raw HTML via <pre>...</pre> would work for me if it then highlights the syntax correctly 👍

If you could lay out a possible integration on a high level, that'd be great 🙌🏻

@rieckpil rieckpil changed the title Integration with WordPress page builder Integration with WordPress page builder plugins Feb 28, 2022
@urvanov-ru
Copy link
Owner

Hi, @rieckpil
I think, this files should be enough:
wp-content/plugins/urvanov-syntax-highlighter/js/min/urvanov_syntax_highlighter.min.js
wp-content/plugins/urvanov-syntax-highlighter/css/min/urvanov_syntax_highlighter.min.css
wp-content/plugins/urvanov-syntax-highlighter/themes/classic/classic.css
wp-content/plugins/urvanov-syntax-highlighter/fonts/monospace.css

@rieckpil
Copy link
Author

rieckpil commented Mar 2, 2022

Thanks for the quick response! Is there any queuing mechanism for WordPress to include the resource for the plugin that I should use or should I just manually ensure that those static files are part of each <head> section?

@urvanov-ru
Copy link
Owner

urvanov-ru commented Mar 2, 2022

@rieckpil
I recommend you use
wp_enqueue_script
and
wp_enqueue_style

@rieckpil
Copy link
Author

I've added those three stylesheets and one JavaScript to my custom page that is built with a page builder plugin (Thrive Apprentice):

grafik

and added the code snippet by hand with a <pre> element and a WordPress content widget to the page but still don't see the Highlighter plugin convert it to the correct format:

grafik

@urvanov-ru
Copy link
Owner

This is strange. Maybe there are some errors in Browser console? You can try to debug the script in urvanov_syntax_highlighter.min.js especially:

 $(document).ready(function () {
        UrvanovSyntaxHighlighterSyntax.init();
    });

@urvanov-ru
Copy link
Owner

Oh. I understand. There should be some code in PHP side.

@urvanov-ru
Copy link
Owner

urvanov-ru commented Mar 18, 2022

It is not just Javascript highlighting. I was mistaken

@rieckpil
Copy link
Author

What PHP code would I need to add to those pages?

@urvanov-ru
Copy link
Owner

urvanov-ru commented Mar 21, 2022

In old Crayon there were possible to use it without any wordpress:
https://github.com/aramk/crayon-syntax-highlighter/blob/master/util/external_use.php

In this forked version the code should be the same but with prefix UrvanovSyntaxHighlighter instead Crayon. You can try to adapt it. Unfortunately, I don't know how Thrive Architect works.

You can try to check "Capture pre tags as Crayons" settings. Maybe it works already? Maybe it just turned off? I don't sure about Thrive Architect or any other page builders. I don't know how it works.. But the highlighting works for comments and standard posts of any type with just pre tag.

Or it can be harder then we thought at the beginning

@rieckpil
Copy link
Author

rieckpil commented Mar 21, 2022

Thanks for laying out potential next steps. I'll give it a try.

btw. do you have a donation link for accepting USD or a PayPal account? The link on the WordPress plugin page is only for ₽/RUB.

@urvanov-ru
Copy link
Owner

urvanov-ru commented Mar 28, 2022

You can try here: https://paypal.me/urvanov

@rieckpil
Copy link
Author

I just tried to donate money but PayPal canceled the request with "The recipient can currently not receive money" 😓

@urvanov-ru
Copy link
Owner

lol

@urvanov-ru
Copy link
Owner

Maybe it is just some restrictions 'cause I am in Russia.

@rieckpil
Copy link
Author

Okay, damn :/ Then I'll try it again in some weeks 👍

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

No branches or pull requests

2 participants