Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Hi I have this code to give me an HTML version of the excerpt box on the edit post screen, however when I'm in the HTML tab of the editor and switch to Visual I only see a blank page. Reloading the page fixes it. The issue is definitely caused by this code as without it everything works fine. Any idea what needs to be fixed here?

function tinymce_excerpt_js(){ ?>
    <script type="text/javascript">
            jQuery(document).ready( tinymce_excerpt );
                function tinymce_excerpt() {
                    jQuery("#excerpt").addClass("mceEditor");
                    try {
                    tinyMCE.execCommand("mceAddControl", false, "excerpt");
                    tinyMCE.onAddEditor.add(function(mgr,ed) {
                        if(ed.id=="excerpt"){
                            ed.settings.theme_advanced_buttons2 ="";
                            ed.settings.theme_advanced_buttons1 = "bold,italic,underline,seperator,justifyleft,justifycenter,justifyright,separator,link,unlink,seperator,pastetext,pasteword,removeformat,seperator,undo,redo,seperator,spellchecker,";
                        }
                    });
                    } 
                    catch(e) {
                    // ignore
                    }                        
                }
    </script>
<?php }
add_action( 'admin_head-post.php', 'tinymce_excerpt_js');
add_action( 'admin_head-post-new.php', 'tinymce_excerpt_js');

function tinymce_css(){ ?>
    <style type='text/css'>
        #postexcerpt .inside{margin:0;padding:0;background:#fff;}
        #postexcerpt .inside p{padding:0px 0px 5px 10px;}
        #postexcerpt #excerpteditorcontainer { border-style: solid; padding: 0; }
    </style>
<?php }
add_action( 'admin_head-post.php', 'tinymce_css');
add_action( 'admin_head-post-new.php', 'tinymce_css');

function prepareExcerptForEdit($e){
    return nl2br($e);
}
add_action( 'excerpt_edit_pre','prepareExcerptForEdit');
share|improve this question

closed as too localized by kaiser, Bainternet Oct 10 '12 at 12:43

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
@kaiser In defense of drtanz, I don't see any errors in the syntax, and in fact when I tested it I didn't get any errors/notices/warnings even when WP_DEBUG is on. I don't see this as being off-topic or too localized, as it really does seem to be an issue (it works fine when the Visual mode is default selected on page load, but doesn't when the HTML mode is default on load and then you switch to visual). –  William Oct 10 '12 at 12:28
1  
I would also appreciate to know why this is not applicable to a wider audience. –  drtanz Oct 13 '12 at 20:50

Browse other questions tagged or ask your own question.