Skip to content

Instantly share code, notes, and snippets.

@ronalfy
Created October 24, 2020 22:59
Show Gist options
  • Save ronalfy/2dbb84ceee04328d6bca98b21df7fb1c to your computer and use it in GitHub Desktop.
Save ronalfy/2dbb84ceee04328d6bca98b21df7fb1c to your computer and use it in GitHub Desktop.
Syntax Highlighting Block - Adding Rel Attribute
<?php
/* Plugin code above */
if ( 0 === $count ) {
$code_start_tag = preg_replace(
'/(?<=<code\b)/',
sprintf( ' rel="%s" class="%s"', esc_attr( $attributes['language'] ), esc_attr( $added_classes ) ),
$code_start_tag,
1
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment