Site logo

Archived topic

Header on Home Page Showing List of Latest Posts

4 replies · Started by Anonymous on April 20, 2016

Viewing posts 1–5 of 5

Hi Tom,

Is it possible to have a header image (similar to that in the GP WordPress.org screenshot) for the home page showing the list of latest posts (not a static page) in the free version of GP?

Thanks.

Anis

Hi Anis,

It's tough on the blog page as WordPress doesn't offer any way to do it like they do on static pages (using the Featured Image metabox).

It's possible with some PHP though:

add_action( 'generate_after_header','generate_blog_header_image' );
function generate_blog_header_image()
{
    if ( ! is_home() )
        return;
    ?>
    <div class="page-header-image grid-container grid-parent generate-page-header">
        <img src="URL TO YOUR IMAGE" alt="" />
    </div>
    <?php
}

Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/

Of course the Page Header add-on allows you to do this and way more in the Customizer :)

Thank you, Tom for the code!

By the way, the Page Header add-on can achieve this on the blog page?

Anis

Sure can, it can be achieved in "Customize > Blog Page Header" :)

Cool!

This archived topic is closed to new replies.