[Resolved] Page Header page name

Home Forums Support [Resolved] Page Header page name

Home Forums Support Page Header page name

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #76326
    Jean Paiva
    Developer

    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:
    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?

    #76362
    Tom
    Lead Developer
    Lead Developer

    You can always add it manually, but you’re trying to add it automatically, correct?

    #76389
    Jean Paiva
    Developer

    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?

    #76421
    Tom
    Lead Developer
    Lead Developer

    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 ๐Ÿ™‚

    #76472
    Jean Paiva
    Developer

    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!

    #76538
    Tom
    Lead Developer
    Lead Developer

    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 }
    }
    #76610
    Jean Paiva
    Developer

    Thank you once again Tom!

    #76810
    Tom
    Lead Developer
    Lead Developer

    You’re welcome ๐Ÿ™‚

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