WordPress.org

Support

Support » How-To and Troubleshooting » need to call a custom .php file in my header (using a child theme)

need to call a custom .php file in my header (using a child theme)

  • basically i need to add this to my header:

    <?php include(“main_nav_links.php”); ?>

    but i’m using a child theme. should I just modify header.php instead?

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

    @jdembowski

    Brute Squad and Volunteer Moderator

    Close but not quite. There is probably a better way to do it, but copy the header.php from the parent directory into the child directory.

    Modify that copy and you’ll be all set.

    Right now that’s what i’m doing, however when wordpress updates in the future, i’ll have to replace the entire header.php

    is there way to use my child theme functions.php to inject the additional php file information?

    Moderator Jan Dembowski

    @jdembowski

    Brute Squad and Volunteer Moderator

    It really depends on what you want to add. If you can do so via wp_header() then you can add just that via your functions.php file for your child theme.

    If you really want to dramatically change the output of header.php, then you’ll need to keep your own copy and modify that one.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘need to call a custom .php file in my header (using a child theme)’ is closed to new replies.
Skip to toolbar