[Resolved] Header on Home Page Showing List of Latest Posts

Home Forums Support [Resolved] Header on Home Page Showing List of Latest Posts

Home Forums Support Header on Home Page Showing List of Latest Posts

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #188237
    Anis

    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

    #188246
    Tom
    Lead Developer
    Lead Developer

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

    #188265
    Anis

    Thank you, Tom for the code!

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

    Anis

    #188362
    Tom
    Lead Developer
    Lead Developer

    Sure can, it can be achieved in “Customize > Blog Page Header” ๐Ÿ™‚

    #188370
    Anis

    Cool!

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