Support » Fixing WordPress » when I write some code in header.php in child theme all the site coming blank?

  • Resolved johannes999

    (@johannes999)


    Hello,
    I made child theme with style.css and functions.php .
    it is working wel .
    but when I make heade.php file in child theme and write some code on it to divide the header to 3 sectios all the site is becoming a blank page .
    what can be the problem is overwriting header.php is causing problem?
    how I can solve this problem?
    thanks
    johan

    • This topic was modified 2 months ago by Jan Dembowski.
    • This topic was modified 2 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Side note: Could you please stop using Everything else WordPress for support topics? The correct location is Fixing WordPress and I have again moved your topic.

    but when I make heade.php file in child theme and write some code on it to divide the header to 3 sectios all the site is becoming a blank page .

    Problems like that are theme specific. Which theme are you using?

    johannes999

    (@johannes999)

    underscores-me ,
    thanks
    johan

    note: Ok thanks then I use fixing wordpress.

    mrtom414

    (@mrtom414)

    Check your site log files for php errors that might have occurred.

    mrtom414

    (@mrtom414)

    can you post the code you are using in header.php. It probably a php error.

    johannes999

    (@johannes999)

    thanks,
    I don’t have to write any code just when I create header.php file in filezilla for my child theme,then all the site becomes blank.
    this is the url of my blank site to see : [ redundant link removed ]
    I want to make my customized theme(underscores) with css grid .
    where I have to check for log files on my local computer in event vieuwer?
    I don’t see any log file on wodprress or in chrome?
    johan

    JNashHawkins

    (@jnashhawkins)

    Your blank header.php file is clobbering your child theme. There is important code there.

    What I’ve done before is to copy the file I’m planning to modify from the parent theme to the child theme then test to make sure the child still works. It should but things go wrong sometimes.

    Now make a few changes and test. A few more and test. On and on until you’re done or you break things.

    johannes999

    (@johannes999)

    thanks,
    I see a lot of poblems with header.php to use it in child theme so I taught I ceate new file like custom-site.php in place of header.php to solve this problem.
    so I did there is no problem,
    I want to write all my site code in this file(custom-site.php) to build csss grid system.
    now my question is how can wordpress recognize this custom-site.php fle in my child theme.
    do I have to add some code in functions.php to my wordprees theme recognize this custom.site.php file?
    if yes, which code I have to add in functons.php to my new created file to be recognized?

    
    require get_template_directory() . '/test/test-child/custom-site.php';
    

    or some other syntax?
    johan

    mrtom414

    (@mrtom414)

    If you are creating a child theme you only need to place files you want to modify in it. I’m not sure what the custom-site.php does. If you want to make changes copy the original header.php from your theme and modify it to suit your taste. In the index.php file there is a line of code get_header();. This code pulls in the header.php file into the index.php file. There is also a hook that resides in the header.php called wp_head() this line code pulls in all your header configuration like the location of your style sheets that you have enqueued in the functions.php file. The best solution would be to copy the header.php file from your theme into your child and modify it. No one here is going to know what in custom-site.phpis unless you post the code.

    • This reply was modified 2 months ago by mrtom414.
    • This reply was modified 2 months ago by mrtom414.
    mrtom414

    (@mrtom414)

    Also underscore is a starter theme it isn’t a full theme. It made for designers to be used as a starting point. You down loaded the theme from https://underscores.me/. This theme isn’t meant to be used for production. It just defines all the templates need to create a theme. There no styling or configuration of any kind in this theme. If you are using it to create a theme then you should rename it and modify it to what you want. It kind of pointless to create a child theme from an underscore theme.

    johannes999

    (@johannes999)

    thanks
    johan

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.