Support » Plugin: podPress » [Plugin: podPress] Duplice javascript in head

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author ntm


    That report sound familiar. I know two other reports [1], [2] like that and have seen a few blogs with such a duplicate code section.

    The reason could be a different plugin or your theme. podPress uses the Actions Hook ‘wp_enqeue_scripts’ (and ‘wp_enqeue_styles’) to add the code. But sometimes a different plugin or the theme uses this hook in a unexpected way and then something like this happens.
    Please read the two other threads. Maybe you can find something helpful for you.
    But in every case I probably need more information about the circumstances in your blog e.g Which theme do you use? A list of your plugins could help me too. But if a different plugin is responsible then is actually easy for you to find out which one is responsible. Deactivate one plugin, reload the page and look into the source code. Afterwards you may activate the plugin again and take the next one.
    It would be very helpful if you could do this because sometimes such things happen only with certain plugin settings.

    Also a lot of libraries that get used are also included in WordPress by default if I am right. Not sure if stuff get added by you guys.

    podPress uses a certain version of jQuery and jQueryUI. One very important reason to include jQuery and jQueryUI also into podPress is that it still supports older WP versions and these older WP include older jQuery versions which don’t offer all the functions and features of the modern versions. Furthermore some feature of jQueryUI which podPress uses on the admin pages are probably still not among the library parts of WP.

    The theme is custom. I will look into it.
    I do think this is weird because I only have it with your javascript and not with other plugins that also use wp_enqeue_scripts.

    Plugin Author ntm


    podPress prints also some scripts via the wp_print_scripts. That could lead to the doubled JS script section if a plugin or theme uses e.g. wp_print_scripts(‘jquery’) instead of wp_enqueue_scripts(‘jquery’).
    Or maybe a theme uses get_header() and wp_head().
    Maybe switch for a moment to the default theme (Twenty or Twenty Eleven) and look whether the code section twice in the head section (while all plugins are active). Then we will know whether it is an interference with the theme or a plugin.

    Same issue here — Suffusion theme.
    Sometimes player image disappears too.
    Really want to utilize the XSPF Player option, but last time I tried, it seems that is when problems started. Even though I did not use on same page as other audio as instructed.

    Plugins – Shoutcast/Icecast/Shoutstream to stream four different stations. I assumed each station was creating the duplicate codes in header.

    Plugins updated or added recently
    WP-Polls used with Podpress (listen and rate new music). Polls suddenly quit working (all you see is the shortcode).

    Next Gen Gallery – another one with shortcode issues suddenly.


    JWPLayer (had it all together, then deleted wrong files, now it won’t work either)

    Wordtube (goes with next gen or JW Player?)

    Slideck Lite

    In attempting to clean up files, I may have deleted the wrong things (for example, JWPlayer was copied several times in many directories). Oops.

    Today, edited older page to make it visibly pleasing with a table. Unfortunately, the little players disappeared when I put [display_podcast] inside table. Don’t know if it’s related.

    website is

    Podpress used mostly here –>

    and I just learned sysadmin guy created another htaccess file for a redirect, put it root folder. I have one in wordpress root. Maybe that’s it?? Seems like thats when all the issues started.

    Just trying to help and learn

    Tragically, the more I learn, the more I screw it up ;-/


    Plugin Author ntm


    @femmefm: Thank you for your help! I will look into this matter at a day in the upcoming week. I have downloaded your theme and will run some tests and look through the files. But if you like, you test whether a different plugin is involved on your own (as described above). That would be a big help for me too.

    okey dokey.

    Plugin Author ntm


    @femmefm: in your case the Shout Stream plugin is responsible for the duplicate script section.
    This plugin adds its scripts in not correct way.
    In the shout-stream.php (v3.3) line 30 you can find function addHeaderSSPOPUPJS().
    In this function you can find lines like:

    wp_enqueue_script('shout-stream', WP_CONTENT_URL . '/plugins/shout-stream/ss_popup.js', false, '1.0');

    which are adding necessary Javascript files to the <head> section. But if one uses wp_enqueue_script it is not necessary to use wp_print_scripts to print the script at least since WP 2.6. wp_enqueue does that on its own.

    If I would support support old WP versions I would make a solution for newer WP versions and one for older WP version.

    A more correct approach for WP 2.6+ is using wp_register_script followed by wp_enqueue_script:

    wp_register_script('shout-stream', WP_CONTENT_URL . '/plugins/shout-stream/ss_popup.js', false, '1.0');

    the same for the swfobject:

    wp_register_script('swfobject', '', false, '2.2');

    But since WP 2.7, WP comes with a copy of the swfobject.js and if the ss_object.js requires this script then you could use a solution without the two lines to include the swfobject.

    wp_register_script('shout-stream', WP_CONTENT_URL . '/plugins/shout-stream/ss_popup.js', array('swfobject'), '1.0');

    These two lines signal WP to add swfobject.js before the script of plugin.

    If you are going to patch the file on your own then you need to modify also line 40

    add_action('wp_head', 'addHeaderSSPOPUPJS');


    add_action('wp_enqueue_scripts', 'addHeaderSSPOPUPJS');

    In conclusion:
    If you are using Shout Stream v3.3 with WP 2.7 or newer then you could replace line 30 – 40 with this:

    function addHeaderSSPOPUPJS() {
    	if (function_exists('wp_enqueue_script')) {
    		wp_register_script('shout-stream', WP_CONTENT_URL . '/plugins/shout-stream/ss_popup.js', array('swfobject'), '1.0');
    add_action('wp_enqueue_scripts', 'addHeaderSSPOPUPJS');

    Plugin Author ntm


    @markoheijnen: it is likely that something similar happened in your case too. Control the usage of wp_print_scripts, wp_register_script and wp_enqueue_script in your plugins and themes.

    ntm I still say the issue is within your plugin because you add it twices.

    If I want to use wp_print_scripts that should be fine. For that site I didn’t do the theming tho. Normally I always use wp_print_scripts for widgets and shortcodes and use wp_print_scripts in the footer.

    Plugin Author ntm



    you can of course use the the Action Hook wp_print_scripts and that would be fine with podPress. But the Shout Stream plugin adds a function to the wp_head hook and calls inside this function the function wp_print_scripts(). Calling this function directly is not good practice. As I understand it, it is no API function. Inside this function is the the Action Hook with the same name do_action( 'wp_print_scripts' );.
    If you call this function directly then it will be executed. But wp_head() or get_header() in you theme call it too. In other words if you call wp_print_scripts() directly the action of the action hook ‘wp_print_scripts’ get executed twice during the page load and since podpress uses this hook, the result is an duplicate code section.

    Please, control whether theme or a plugin calls wp_print_scripts() directly.
    If it does that, please change it. Make use of the Action Hook with the same name e.g.:

    function printmyscript() {
    	echo "\n <!-- print my script test --> \n\n";
    add_action('wp_print_scripts', 'printmyscript');


Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: podPress] Duplice javascript in head’ is closed to new replies.