- This topic has 7 replies, 2 voices, and was last updated 6 years ago by
Tom.
-
AuthorPosts
-
February 18, 2015 at 10:58 am #76326
Jean
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?
February 18, 2015 at 12:34 pm #76362Tom
Lead DeveloperLead DeveloperYou can always add it manually, but you’re trying to add it automatically, correct?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 18, 2015 at 12:59 pm #76389Jean
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?February 18, 2015 at 1:13 pm #76421Tom
Lead DeveloperLead DeveloperHmm, 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 π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 18, 2015 at 3:45 pm #76472Jean
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!
February 19, 2015 at 12:07 am #76538Tom
Lead DeveloperLead DeveloperThen 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 } }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 19, 2015 at 4:52 am #76610Jean
Thank you once again Tom!
February 19, 2015 at 10:09 am #76810Tom
Lead DeveloperLead DeveloperYou’re welcome π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.