WordPress.org

Ready to get started?Download WordPress

Forums

HTML Editor Reloaded
gives javascript errors on other pages (1 post)

  1. Biranit
    Member
    Posted 2 years ago #

    Hi,

    Because the Javascript is enqueued to ALL admin pages, this gives an error on pages that do not have an HTML Editor.

    To fix this, please change the code as follows:

    // add code to the footer section of admin pages
    	function admin_footer() {
    		?>
    		<script>
    		if (jQuery("#wp-content-editor-container").length > 0) {
    			<?php
    
    			// update HTML Editor with custom buttons
    			$options = get_option('html_editor_reloaded');
    
    			for ( $i = 0; $i < count($options['label']); $i++ ) {
    
    				?>
    				QTags.addButton('hed_<?php echo $i; ?>',
    					'<?php echo str_replace('"','&quot;',$options['label'][$i]); ?>',
    					'<?php echo str_replace('"','\"',$options['before'][$i]); ?>',
    					'<?php echo str_replace('"','\"',$options['after'][$i]); ?>',
    					'<?php echo str_replace('"','&quot;',$options['shortcut'][$i]); ?>');
    				<?php
    
    			}
    
    			?>
    
    			QTags.addButton('hed_tabs', 'disable tabs', '', '');
    		}
    		</script>
    		<?php
    	}

    Best wishes,

    Bira

    http://wordpress.org/extend/plugins/html-editor-reloaded/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.