WP-Polls loading error solved

Recently we wanted to add a poll facility to one of our web posts Official Websites of IPLt20 Teams where we wanted our readers to share their opinion with polls. Some time back I had used Wp-polls plugin for another site and it is surely a wonderful plugin. So obviously I installed it. But to my surprise this did not work as expected. The poll was loading forever and ever.

So now I cross checked the wordpress forums, the developer’s website, for a quick solution.

Some said to add <?php wp_footer(); ?> in footer.php before the

</body>

tag and <?php wp_header(); ?> in header.php before the

</head>

tag. But this did not work for me.

Got another suggestion of changing the folder permissions to 755 and files to 644 through ftp. Still no luck for me! (I thought this as an issue with my version of wordpress and the plugin version)

The plugin author suggested in his website that the plugin works perfectly with the default theme, so I also did a testing with the default wordpress theme and the polls were working OK.

So I was confirmed that there must be some problem with my custom theme files only. By checking the function.php I saw that I had used a deregister script/styles code in my theme function similar to this below:


if ( !is_admin() ) wp_deregister_script('jquery');
add_action( 'wp_print_styles', 'my_deregister_styles', 100 );
function my_deregister_styles() {
wp_deregister_style( 'wp-polls' );
wp_deregister_style( 'thickbox' );
}

So now when I removed wp_deregister_style( 'wp-polls' ); and if ( !is_admin() ) wp_deregister_script('jquery'); from that, the polls are working perfectly just as it was before.

Although now I have to edit the the plugin files and theme files once again so that it does not load the jquery twice which I had previously added it manually to the theme to minimize page loading. But that is another story.

Since this the wp-poll solution was not available on googling, I thought I should write it down. Hope this helps someone else.

Last modified on May 24th, 2010 at 7:16 pm.
Share this post:

Priyanka Naskar Majumder - the Owner, Eyedea LAB. Graphic & Web Design Studio, lives in Kolkata, India. Interested in: Usability research, Graphic Design, Web Design & Development.


3 Comments

  • This tips are very useful. I got a question : do you know how to remove Javascript files from the header of wordpress and add them to the common.js file in order to Improve load times in wordpress ? I really need a help.

    • There are many processes but these are beyond the scope of this post. You can search the internet and obviously get loads of tutorials related to this topic only!

      But to give you a general idea, I am highlighting some points that you can start with.

      1. You can use “w3 total cache” plugin (google minify already added), to combine and cache all your js/css files.
      2. You can use “WP-Minify” plugin (google minify already added), to combine and cache all your js/css files.
      3. You can use the command “wp_deregister_script” in your functions.php to remove all scripts automatically added by the plugins.
      (a) Now either add content manually from all of them in one commom.js file and use the “wp_register_script” to add this to your theme header/footer.
      (b) Or get the script paths and add them to google minify “groupsConfig.php” file and manually add this file’s link to your theme header/footer [you need to install google minify in your server before hand].

      and there are many other processes too.

  • Hey, quick note to others with the issue. I had to add not to my template just prior to the tag. I also needed the before the tag. These were added to a template.php file I was using on a separate page to get it working.

One Trackback


Leave a Reply

Your email address will not be published. Required fields are marked *

*

Allowed HTML tags: <strong> <em> <pre> <code> <a href="" title="">