Child Theme Authoring: Setting Static Page Titles

Dev Tutorials

Last Updated: Time to Read: 1 minute

This document provides a quick example of how to either modify the header-page-title.php partial to add a conditional title, or use hooks to replace the default titles without modifying the template. This solution is useful if you want a static header across entire sections of your site (such as we do here on this site) or want a special title set for dynamic templates being used as static homepages (like the WooCommerce Shop page, for example).

Below we insert a custom condition to output a static “Shop” title with no breadcrumbs if the Shop page is set as the static front page in WordPress. This code is inserted right after

$details = layers_get_page_title(); and before if( isset( $details[ 'title' ] ) || isset( $details[ 'excerpt' ] ) ) { ?>

You must close off this condition by adding an additional bracket at the very end of the document

If you choose to use a hook such as layers_after_header  you would need to wrap this in a custom function:

You will need to set the original to hidden with CSS on this page: