Highlighting Code Blockの行番号のところが崩れる問題を解消

まじのアバター

超備忘録。サムネのやつを修正します。
Cocoonのテーマによってデフォルトで追加される行番号と競合しているのが原因。

/wp-content/themes/cocoon-master/functions.phpに以下を追記。

// Cocoonのコードハイライト機能を無効化
add_filter('wp_code_highlight_enable', '__return_false');

// Cocoonのコードハイライトスタイルを無効化
function disable_cocoon_code_highlight_style() {
    wp_dequeue_style('code-highlight-style');
    wp_deregister_style('code-highlight-style');
}
add_action('wp_enqueue_scripts', 'disable_cocoon_code_highlight_style', 100);

// Cocoonのコードハイライトスクリプトを無効化
function disable_cocoon_code_highlight_script() {
    wp_dequeue_script('code-highlight-js');
    wp_deregister_script('code-highlight-js');
}
add_action('wp_enqueue_scripts', 'disable_cocoon_code_highlight_script', 100);

これだけで万事解決。Claude 3.5 Sonnetさん優秀すぎ。ありがとう。



コメント

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA