• goddball

    (@goddball)


    Hi all:

    I’m new to wordpress and I’ve run into a strange ?bug? using wordpress 2.7.1 that is so easy to duplicate that I’m surprised that I could not find any mention of it in these forums (or more likely I’m doing something wrong). Briefly the admin theme preview halts the browser with an Object not found message when you try to use wp_enqueue_script() to include some custom javascript in the document head. The displayed URL is shown in IE7 as

    {bloginfo(‘url’)}/wp-admin/undefined

    but I also encounter the problem using Firefox 3. The problem isn’t with wp_enqueue_script() function since it produces the correct output. In fact I can directly enter the script into the <head>as

    <script type="text/javascript" src="<?php echo bloginfo('url'); ?>/wp-content/themes/default/js/general.js" ></script>

    and still get the same error. Note: once the theme is activated the correct output is sent to the user. It is only the theme preview in the admin panel that doesn’t work.

    To duplicate the problem just install the basic wordpress 2.7.1 code. Create a folder js in the default theme folder and in the js folder put some dummy javascript in a file I named general.js. Then, in the default theme’s header.php file, add the above script tag just before the wp_head function call. That’s all it takes to duplicate the problem.

    Now if you try to preview the default theme it’ll halt the browser. The only way to activate a theme with this problem is to turn off javascript. With javascript turned off the theme can be activated. Once activated then javascript can be enabled again and everything else seems to work as long as you don’t try to preview a theme with the above type of script tag or use wp_enqueue_script() to include the javascript code.

    I’m stumpted! Anyone have any ideas what’s going on?

    Goddball

  • The topic ‘Bug??? in admin theme preview’ is closed to new replies.