-1

I am currently using the Onepress theme and want to edit the header section, the part that prints the site title. However, I cannot for the love of life figure out which part actually controls the header. Header.php does not show anything and neither does the frontpage template.

  • Hello @QuyNguyen2013 - Welcome to the WordPress Development community! While header-related code often resides in a theme's header.php or index.php files, this is not always the case - and without knowing with the specific theme, your question is difficult for our community members to answer. For this reason, questions regarding 3rd-party plugins and themes are considered off-topic here. You can try to rephrase your question in a more general format, but it would probably be best addressed in the 3rd-party's official support channels. – bosco Jul 22 '16 at 20:09
  • @bosco So is there no general way to figure out where the header is? – QuyNguyen2013 Jul 22 '16 at 20:14
  • Not really... generally it's self evident. The vast majority of themes just use the get_header() function in index.php (and/or another top-level template) to load header.php or header-{something}.php. If the theme uses it's own loading logic however - then you'll probably have to dig or ask the author. You could try to search for the functions that print the site title in the theme directory, I guess .Usually get_bloginfo() or bloginfo(). – bosco Jul 22 '16 at 20:23
  • 1
    I took a look at the theme. You'll want to check out the onepress_site_header() and onepress_site_logo() functions in inc/template-tags.php. The hint was that the theme is using do_action() calls where the site header should be - searching for the action tags in the theme revealed the add_action() calls that execute functions there. Instead of editing the functions, you could alternately use the Plugin API to detach those action hooks and add your own functions in their place. – bosco Jul 22 '16 at 20:35
2

In WP, you first need to understand the template hierarchy https://developer.wordpress.org/themes/basics/template-hierarchy/

So as per hierarchy,

-- front-page.php

-- home.php / custom page template.

If you have front-page.php , then please check which header file it is enqueuing.

If there is no front-page.php then check home.php exist in your theme file. If yes check which header file it is enqueuing .

If it doesn't have both file, goto Appearance >> Customise >> Static Front Page.

enter image description here

So if it has some template name in Front Page then you need to check in your template file for which header file it is adding.

Header File

For header file, if they are using get_header(), then it will use header.php from your active theme.

If it has get_header( 'home' ); then it will use header-home.php

So from there you can go customise your header.

Also if you are using child theme , then please make check if it has header related file in your child theme or not.

Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.