Archived topic
Putting page header below the title
13 replies · Started by dmendana on March 2, 2017
When editing the layout in the customizer, for the page header, there are four options if it's a single post: above content, inside content, below title and hide.
However, there are only two options if it's a page: above content and inside content.
This makes it impossible to keep the same design for my posts (where I put the page header below the title) and my pages. Is there any way that I can move the title above the page header? Thanks!
Hi there,
Would it work to add the page header as the first thing in your content? Then it should show up below content title?
Let us know.
Sorry for not understanding, but how do I "add the page header as the first thing in my content"?
like add the page header image using Add Media before the page content? Just a thought...
I want the header to be full width, so no. But thanks.
If you add the page header below the title, it won't go full width. It will only be as wide as your content.
Do you currently have it set to inside content or above content?
Sorry to hijack this topic, but I need exactly the same. Is there a way to use some css or function.php code to achieve this until the Customizer has this option?
@Tom I have the page header inside the content.
Kind regards,
Jurgen
Should be able to use hooks to do that - where do you currently have it set? Inside content?
Yep, see last line of my message :-)
I managed to get the page title above the image by putting this in the Before Content hook:
<?php if ( generate_show_title() ) : ?>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title" itemprop="headline">', '</h1>' ); ?>
</header><!-- .entry-header -->
<?php endif; ?>
Now I need to disable the regular page title below the page header image...
Hmm yea, you could it that way.
Disable the title like this:
add_action( 'after_setup_theme', 'tu_disable_page_titles' );
function tu_disable_page_titles() {
if ( is_page() ) {
add_filter( 'generate_show_title', '__return_false' );
}
}
Then add this to your hook:
<?php if ( is_page() ) { ?>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title" itemprop="headline">', '</h1>' ); ?>
</header><!-- .entry-header -->
<?php } ?>
Thanks, but that doesn't seem to work. I put the add_action code in the functions.php of my child theme, that is the right place isn't it?
I am rebuilding a Joomla-site in GP, and almost done.
Joomla: http://www.indeflow.nl/
Wordpress: http://www.indeflow.nl/new/
So you can see how it needs to be.
Regards,
Jurgen
Yea that's the right place.
Try this instead:
add_action( 'wp', 'tu_disable_page_titles' );
function tu_disable_page_titles() {
if ( is_page() ) {
add_filter( 'generate_show_title', '__return_false' );
}
}
Yes, that did the trick! Thank you very much Tom, I really appreciate the support.
You're very welcome :)