...

View Full Version : PHP / WP Issues



CardinalQuest
02-12-2012, 11:39 PM
I'm having some issues with a WP theme. The theme never got a wp_footer() placed into it, I don't have PHP knowledge, I don't know where to add without the theme which is live online, from blowing up.

The theme has a jQuery library call hard coded. I need to remove or replace with wp_enqueue_script() again without causing the theme to, blow up. And I need to convert some of the hard coded jQuery scripts to adhere to the no-conflict rules, which is currently conflicting. I didn't script the PHP part of the theme, and I was unaware of the issues, until over a year later.

VIPStephan
02-13-2012, 12:37 AM
Set up a development environment on your computer, e. g. by installing XAMPP (http://www.apachefriends.org/en/xampp.html), and copy the entire live WP application to your local server for testing and implementing new features without messing with the live site.
jQuery’s noConflict function is almost never needed. You can simply edit the theme to remove or change the hard coded reference to jQuery.


But nobody is able to read your mind, you’ll have to show us your site and elaborate a little more for us to really help you.

CardinalQuest
02-13-2012, 01:50 AM
jQuery’s noConflict function is almost never needed. You can simply edit the theme to remove or change the hard coded reference to jQuery.
What do I edit to remove/change the hard coded reference ?

VIPStephan
02-13-2012, 12:48 PM
In your theme files there’s typically a header.php file or something like that. That’s where the HTML for the header is stored (who would have guessed?) and there should be the reference to jQuery, too.

Aedan
02-14-2012, 01:03 AM
I don't know where to add without the theme which is live online, from blowing up.

Quick and easy way: Make a copy of your theme, rename it and upload it in your theme directory. Then use the WP plugin "Theme Test Drive" to view the copied theme. Other visitors will still see the original theme.

CardinalQuest
02-14-2012, 03:05 AM
In your theme files there’s typically a header.php file or something like that. That’s where the HTML for the header is stored (who would have guessed?) and there should be the reference to jQuery, too.

This was the only reference to jQuery that I found in my header.php. What is conflicting or causing problems, is it the jQuery version ?

<script type="text/javascript" src="<?php echo bloginfo('template_url'); ?>/includes/jquery-1.4.2.min.js"></script>

VIPStephan
02-14-2012, 10:03 PM
Mind showing us your site, please? Or at least the complete output source code of the page in question?

CardinalQuest
02-14-2012, 10:50 PM
www.thecreativesheep.ca/bio < theme is live

VIPStephan
02-14-2012, 11:24 PM
I see two references there, one seems to be related to fancybox (seems to come with the WP plugin):

<link rel='stylesheet' id='easy-fancybox.css-css' href='http://www.thecreativesheep.ca/bio/wp-content/plugins/easy-fancybox/easy-fancybox.css.php?ver=1.3.4' type='text/css' media='screen' />
<script type='text/javascript' src='http://www.thecreativesheep.ca/bio/wp-includes/js/jquery/jquery.js?ver=1.7.1'></script>
<script type='text/javascript' src='http://www.thecreativesheep.ca/bio/wp-content/plugins/easy-fancybox/fancybox/jquery.fancybox-1.3.4.pack.js?ver=1.3.4'></script>
… and the other one:


<script type="text/javascript" src="http://www.thecreativesheep.ca/bio/wp-content/themes/Bio_3D_Design/includes/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://www.thecreativesheep.ca/bio/wp-content/themes/Bio_3D_Design/includes/fading-tabs.js"></script>
<script type="text/javascript" src="http://www.thecreativesheep.ca/bio/wp-content/themes/Bio_3D_Design/includes/jquery.cluetip.js"></script>

… which seems to be included in the theme itself.

Now, you could remove the reference in your theme’s header but that would make your site depend on the presence of the fancybox plugin. A quick search on the issue brought me to this article: http://electrokami.com/coding/wordpress-multiple-jquery-inclusion-fix/ which sounds like a possible solution.
In your theme there should also be a file called functions.php. This is where that 5-line PHP code goes (at the very top of the file) that’s shown in that article. Try that and see what happens.

As to your wp_footer() issue, that’s equally simple. Open the footer.php file and put that line there somewhere (in between <?php and ?> tags). Look at and compare with the default theme’s footer file, that should give you an idea.

CardinalQuest
02-15-2012, 04:47 AM
Now, you could remove the reference in your theme’s header but that would make your site depend on the presence of the fancybox plugin. A quick search on the issue brought me to this article: http://electrokami.com/coding/wordpr...inclusion-fix/ which sounds like a possible solution.
In your theme there should also be a file called functions.php. This is where that 5-line PHP code goes (at the very top of the file) that’s shown in that article. Try that and see what happens.

It looks as though it may have worked, I see only a jQuery for Google and for FancyBox, am I right with my diagnostics ?


As to your wp_footer() issue, that’s equally simple. Open the footer.php file and put that line there somewhere (in between <?php and ?> tags). Look at and compare with the default theme’s footer file, that should give you an idea.

The same link from the link you supplied ?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum