Grow your CSS skills. Land your dream job.

WordPress plugin php problem

  • # April 25, 2011 at 12:22 am

    Hey all,
    I was messing around with a wordpress plugin that adds modernizr.js to your blog. Well, I deleted the plugin off the server and then deleted the plugin from the admin panel, in that order, so I don’t know if that is what is causing my issue or not. Anyway, I am getting this error thrown at me when you visit the site:
    “Warning: Missing argument 2 for rw_modernizr_nojs() in /homepages/6/d364289486/htdocs/wp-content/plugins/modernizr/modernizr.php on line 23
    class=”home blog no-js”>”

    I then thought to try and install the plugin again, which I did and is currently installed. It makes the site do what I need it to do in IE, but it’s still throwing the error.

    I opened the php file for the plugin and here is what it looks like:
    function rw_modernizr() {
    wp_deregister_script('modernizr'); // deregister
    // wp_register_script( $handle, $src, $deps, $ver, $in_footer );
    wp_register_script('modernizr', plugins_url('/js/modernizr-1.7.min.js', __FILE__), false, '1.7.0', false); // re register // false for not in footer
    wp_enqueue_script('modernizr'); // load
    }
    add_action('init', 'rw_modernizr'); // init

    // add class no-js to body element since HTML element is not possible
    // no-js is required for modernizr to work
    add_filter('body_class','rw_modernizr_nojs');
    function rw_modernizr_nojs($classes, $class) {
    // add 'my-class' to the $classes array
    $classes[] = 'no-js';
    // return the $classes array
    return $classes;
    }

    Can anyone help me out with this? Thanks in advance!
    (Oh, and I did email the author too, but I figured I would try here as well.)

    You can view the site at http://www.thebowandthebeautiful.com if you would like.

    # April 25, 2011 at 12:49 am

    Hmm, looks like your page is loading modernizr twice. I see you’re using the html5 reset theme, which already has modernizr built into it, so installing the plugin was redundant and might have mucked something up.

    # April 25, 2011 at 1:38 am

    yeah, I did make sure to not call modernizr twice. I took it out of the reset’s header.php. I also forgot to mention that the error is still there even if the plugin isn’t active and deleted from the server! Very odd.

    # April 25, 2011 at 1:42 am

    and btw, line 23 in the plugin’s php file is this: function rw_modernizr_nojs($classes, $class) {

    And the only reason why I wanted to try the plugin, was because IE wasn’t recognizing my

    tag even with modernizr being linked to.

    # April 25, 2011 at 7:27 pm

    oh boy, so the author of the plugin released an upgrade that was supposed to fix the problem, but it only fixed it in Firefox. Error still shows in IE and Safari! Even with it deactivated and deleted! I wish I would of never even messed with it!

    # April 25, 2011 at 7:39 pm

    Ok, so just in case anyone else ends up with this problem. I deactivated and deleted the plugin. Then manually added modernizr into the head.php. This fixed the problem.

    # April 26, 2011 at 10:09 am
    function rw_modernizr_nojs($classes, $class) {

    remove the $class parameter and it should be fine.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".