• I tried adding the PHP:
    <?php wp_head(); ?>
    that is necessary for a plugin which works when its in that PHP is in the header. But, when it is in the header, any scripts also in the header do not function. When I take out the PHP, the scripts work again. Is there some trick to this?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Put it within the opening and closing head tags (before </head>).

    Thread Starter pokepsw

    (@pokepsw)

    I did, I put it right before </head> Header PHP Code below:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Justin Cener Design</title>
    <link rel="shortcut icon" href="http://www.justincener.com/images/favicon.ico" >
    <link rel="stylesheet" type="text/css" href="http://www.justincener.com/css.css" media="screen" />
    <!--[if IE]> <style type="text/css">@import "http://www.justincener.com/IE-override.css";</style> <![endif]-->
    <script type='text/javascript' src='<?php bloginfo('stylesheet_directory'); ?>/jquery-1.2.6.min.js'></script>
    <script type='text/javascript' src='<?php bloginfo('stylesheet_directory'); ?>/kwicks.js'></script>
    <script type='text/javascript' src='<?php bloginfo('stylesheet_directory'); ?>/custom.js'></script>
    <?php wp_head(); ?>
    </head>
    <body>
    
    <div id="container">
    
    <div id="header">
    
    <div id="menu">
     <ul class="kwicks">
         <li id="kwick1"><a href="http://www.justincener.com/">Home</a></li>
         <li id="kwick2"><a href="http://www.justincener.com/services">Services</a></li>
         <li id="kwick3"><a href="http://www.justincener.com/portfolio">Portfolio</a></li>
         <li id="kwick4"><a href="http://www.justincener.com/blog">Blog</a></li>
         <li id="kwick5"><a href="http://www.justincener.com/contact/">Contact</a></li>
     </ul>
    </div><!--end menu-->
    
    <center><img src="http://justincener.com/images/logo.gif" height="172" width="551" alt="Justin Cener New Jersey Web and Graphic Design" /></center>
    
    </div><!--end header-->

    Thread Starter pokepsw

    (@pokepsw)

    Has anyone else had this sort of problem?

    Thread Starter pokepsw

    (@pokepsw)

    Shameless Bump

    Check your page code with a validator, you have errors in your header code:

    http://validator.w3.org/

    Thread Starter pokepsw

    (@pokepsw)

    Iridiax – I checked the errors, but they’re not really errors. The errors came back for having PHP code inside an <img src=”…”> tag and for not closing divs (they close outside of header.php). For example, the div “container” starts in the header.php and ends in the body of index.php. Any other ideas?

    Validate your site, not just the code fragment. If they flag as errors, then they are errors. Some errors can be safely ignored (like missing alt tags), but your favicon.ico tag is unclosed and you may have an issue with using single quotes both in your script php tags and in your script code.

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

The topic ‘Adding PHP to Header changes functionality’ is closed to new replies.