Archived topic
Page Header page name
7 replies · Started by Jean Paiva on February 18, 2015
Hey Tom, I'm trying to call the title of the pages/posts on the Page Header addon not in the "content-page.php".
Image:

I was looking at the addon files, but I didn't found any filter/action to use in my child theme. You have any clue how can I do that?
You can always add it manually, but you're trying to add it automatically, correct?
Yes.
There's a way that calling the function "generate_page_header_area" on my theme and then I echo the "the_title();" ? Maybe a hook do that, right?
Hmm, well the page header area will only show if some sort of content/image is added to the metabox.
You could try something like this (untested):
add_action('generate_after_header','generate_add_title_below_header');
function generate_add_title_below_header()
{
// If we're not on a page, don't do anything
if ( ! is_page() )
return;
?>
<div class="page-header-content generate-page-header generate-content-header">
<div class="inside-page-header-container inside-content-header grid-container grid-parent">
<?php the_title(); ?>
</div>
</div>
<?php
}
You can add that snippet using a plugin like this: https://wordpress.org/plugins/code-snippets/
Let me know - it may need some tweaking :)
That's it! Sometimes I forget the use of GP Hooks!
One last question, if I want to do the same to posts? And only exclude the homepage?
Thank you so much for your time Tom! And again, awesome job with the GP!
Then I would change the code to this:
add_action('generate_after_header','generate_add_title_below_header');
function generate_add_title_below_header()
{
// If we're not on a page, don't do anything
if ( is_page() || is_single() ) {
?>
<div class="page-header-content generate-page-header generate-content-header">
<div class="inside-page-header-container inside-content-header grid-container grid-parent">
<?php the_title(); ?>
</div>
</div>
<?php }
}
Thank you once again Tom!
You're welcome :)