Created
December 3, 2024 15:45
Revisions
-
MjHead created this gist
Dec 3, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ <?php add_action( 'admin_footer', function() { ?> <script> class JetEngineCheckboxSEO { constructor() { if ( ! window.rankMathEditor ) { return; } let self = this; jQuery( document ).on( 'input change', '.cx-checkbox-input', () => { window.rankMathEditor.refresh( 'content' ); } ); wp.hooks.addFilter( 'rank_math_content', 'jet-engine-checkbox-seo', ( content ) => { jQuery( '.cx-control-checkbox' ).each( ( groupIndex, groupEl ) => { let $grEl = jQuery( groupEl ); let selectedItems = []; $grEl.find( 'input[checked]' ).each( ( itemIndex, itemEl ) => { selectedItems.push( jQuery( itemEl ).siblings( '.cx-checkbox-label' ).text() ); } ); if ( selectedItems.length ) { content += '\n' + $grEl.find( '.cx-control__title' ).text() + ': ' + selectedItems.join( ", " ); } } ); return content; } ); } getContent( content ) { return content; } } window.addEventListener( "load", ( event ) => { new JetEngineCheckboxSEO(); } ); </script> <?php }, 999 );