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 6 of 6
  1. #1
    New Coder
    Join Date
    May 2018
    Posts
    18
    Thanks
    2
    Thanked 2 Times in 1 Post

    Wordpress wp_head issue - styles not loading properly

    The previous developer left a quirky header.php issue for me to resolve.

    Here is our current Wordpress theme header.php.

    Note the first instance of wp_head(); @ line 12.

    Note the second instance of wp_head(); @ line 83.

    Because we have two wp_head() functions, we obviously double up on all of the head code produced by Wordpress.

    The solution would be to remove the first instance of wp_head(); as it is above the doctype declaration, and leave the second instance of wp_head(); which is @ an appropriate location.

    However, if we do remove the first instance of wp_head(); our page loses all of its style. This doesn't make sense to me as the links to CSS resources are still included within the <head>.

    Here is the doctype and head of our website if we remove the first instance of wp_head();.

    I can see no malformed code in that code.

    This is what our site looks like when we remove the first instance of wp_head();.

    Help appreciated.

  2. #2
    Regular Coder
    Join Date
    Sep 2017
    Location
    Lithuania
    Posts
    172
    Thanks
    1
    Thanked 22 Times in 22 Posts
    If you leave both wp_head functions, do they produce identical code? Can you show an example (HTML source) with both functions enabled?
    Do you license and update your PHP scripts?

  3. #3
    New Coder
    Join Date
    May 2018
    Posts
    18
    Thanks
    2
    Thanked 2 Times in 1 Post
    Yes they do. Here is the HTML source with both functions enabled. Note the doctype is pushed down.

  4. #4
    Regular Coder
    Join Date
    Sep 2017
    Location
    Lithuania
    Posts
    172
    Thanks
    1
    Thanked 22 Times in 22 Posts
    Please excuse my ignorance, but do they really display the same code? I compared both codes printed by this function, and while they share much in common, the 1st code is much, much larger. It prints 112 lines total, while 2nd code prints 38 lines only. First code loads 5 CSS files, second code loads 3 CSS files only.
    Do you license and update your PHP scripts?

  5. #5
    New Coder
    Join Date
    May 2018
    Posts
    18
    Thanks
    2
    Thanked 2 Times in 1 Post
    Hi phpmillion, we ended up changing theme, and the site displays without the extra first wp_head(); so I will close this ticket. I appreciate your support.

  6. #6
    New Coder
    Join Date
    May 2018
    Posts
    18
    Thanks
    2
    Thanked 2 Times in 1 Post
    I can't close this ticket, perhaps a moderator can?


 

Tags for this Thread

Posting Permissions

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