Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10

Thread: PHP / WP Issues

  1. #1
    New Coder
    Join Date
    Jan 2011
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP / WP Issues

    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.

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,927
    Thanks
    6
    Thanked 1,040 Times in 1,013 Posts
    1. Set up a development environment on your computer, e. g. by installing XAMPP, and copy the entire live WP application to your local server for testing and implementing new features without messing with the live site.
    2. 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.

  • #3
    New Coder
    Join Date
    Jan 2011
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 ?

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,927
    Thanks
    6
    Thanked 1,040 Times in 1,013 Posts
    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.

  • #5
    New Coder
    Join Date
    Jan 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by CardinalQuest View Post
    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.

  • #6
    New Coder
    Join Date
    Jan 2011
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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>

  • #7
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,927
    Thanks
    6
    Thanked 1,040 Times in 1,013 Posts
    Mind showing us your site, please? Or at least the complete output source code of the page in question?

  • #8
    New Coder
    Join Date
    Jan 2011
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts
    www.thecreativesheep.ca/bio < theme is live

  • #9
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,927
    Thanks
    6
    Thanked 1,040 Times in 1,013 Posts
    I see two references there, one seems to be related to fancybox (seems to come with the WP plugin):
    Code:
    <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:
    Code:
    <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/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.

    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.

  • #10
    New Coder
    Join Date
    Jan 2011
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 ?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •