Hello,
I would like to insert highlight code, Javascript, CSS, PHP etc in wordpress posts but there are issues.
Writing the code and saving the content using the standard text editor works fine with prettify or crayon plugin as long as i do not switch in-between to the visual editor or to the ALB. Doing that changes or completely deletes the code even when saving is done in standard text editor modus.
My questions:
1. Deactivating the visual editor was a wordpress feature for each user and it worked. Is there the same possibility to deactivate ALB for blog posts but not pages?
2. Or is there a ALB content element (i am using text block in the moment) or a recommended work flow to get programming code (which shouldn’t be performed) nicely formatted and highlighted into a blog post without deactivating everything except the standard text editor?
Regards
Hey mjasinski!
Thank you for using Enfold.
1.) You can add this to the functions.php file if you want to disable the ALB for posts:
add_action('admin_enqueue_scripts', 'avia_deactivate_builder', 10);
function avia_deactivate_builder()
{
$currentScreen = get_current_screen();
if( $currentScreen->id == 'post' && current_user_can('manage_options') ) {
echo "<style>#avia-builder-button{display: none !important;}</style>";
}
}
2.) Unfortunately, most of the code highlighter plugin that we tested isn’t fully compatible with the ALB. You need to use the default editor.
Regards,
Ismael