Pods Including Extra Jquery

0

I am running the current version of PODS and have a big problem:

PODS appears to be inject the following in the <HEAD> section of all my front-end web pages:

<script type='text/javascript' src='http://projects/parableink_2010-06-09_cw/www_working/wp-includes/js/jquery/jquery.js?ver=1.4.2'></script>
<script type='text/javascript' src='http://projects/parableink_2010-06-09_cw/www_working/wp-content/plugins/pods/ui/js/pods.ui.js?ver=3.0'></script>

This is a big problem because: a) I don't like it putting anything into my front-end code that I can't control b) I'm already including JQuery and this double include causes $(document).ready() to fire twice which messes up my animations, etc.

Help!

asked Jul 28 '10 at 6:23

wpries

11

add comment
enter at least 15 characters

6 Answers

0

Ok. I fixed this by hacking the pods core, but unless I'm missing something this is a problem that needs to be fixed by pods team in next update.

For the fix, I changed /pods/init.php lines 199-120

FROM

wp_enqueue_script('jquery');
wp_enqueue_script('pods-ui', PODS_URL . '/ui/js/pods.ui.js');

TO

if (is_admin()) {
      wp_enqueue_script('jquery');
      wp_enqueue_script('pods-ui', PODS_URL . '/ui/js/pods.ui.js');
}

answered Jul 28 '10 at 6:29

wpries

11

add comment
enter at least 15 characters
0

And another issue... PODS calling session_start(); in front-end during the WordPress init hook. That's going to cause problems if any of your front-end pages include classes and store them in the session (when you call session_start(), php deserializes objects stored in the session and so the class must already be included.

Anyway, I don't think PODS should be starting sessions on the front-end (why?) so I changed For the fix, I changed /pods/init.php lines 199ish to

if (is_admin()) {
     // Session start
      if (false === headers_sent() && '' == session_id()) {
            session_start();
        }

        // Load necessary JS
        wp_enqueue_script('jquery');
       wp_enqueue_script('pods-ui', PODS_URL . '/ui/js/pods.ui.js');
}

answered Jul 28 '10 at 9:35

wpries

11

add comment
enter at least 15 characters
0

I believe that the session_start is there to handle form expiration. If you're using any Pods UI powered public forms this may give you headaches.

Also if you're including jQuery already using wp_enqueue_script shouldn't it only load one instance regardless?

answered Jul 28 '10 at 9:48

jackson

33

add comment
enter at least 15 characters
0

session_start() is only used when a session hasn't already been started so this won't interfere with session variables stored already.

As for the jQuery, I'm working on a solution for this, but it probably won't be ready by 1.9.0. For now, remove the scripts before wp_head() and you should have no problem.

Use wp_deregister_script('jquery'); or wp_deregister_script('pods-ui'); it should work out well.

answered Jul 29 '10 at 12:28

sc0ttkclark

2123

edited Jul 29 '10 at 12:28

add comment
enter at least 15 characters
0

Thanks!

answered Jul 29 '10 at 10:58

wpries

11

add comment
enter at least 15 characters
0

I used deregister to remove the javascripts from the front-end and I moved my class includes to my theme's functions.php so they are included before Pods starts the session.

For what it's worth, I'd strongly prefer that PODS not output any code to the front-end of the site. We create all our themes from the ground up and prefer to put all of the output/templating in one place: the WordPress templates.

We use PODS to create custom data structures and the admin panels but do not use PODS templates to output code to the front-end. Instead we create custom WordPress templates for each pod display template we need and in those templates, we retrieve and output the PODS data.

Thanks!

answered Jul 29 '10 at 11:06

wpries

11

add comment
enter at least 15 characters