Home Support Themes ListingHive Static page as home page? Header/Featured image isn’t in hero image

Static page as home page? Header/Featured image isn’t in hero image

  • Author
    Posts
  • jwittorf

    Hi,
    first off: thanks for the free theme and plugin, works nice 95% so far 🙂

    I’ve set a static page in the general settings -> read to be my home page. I’ve added a header image via customizer as default and to check another one via the page itself “featured image”.
    However, the image doesn’t show on the home page. In fact, the entire header-hero header-hero--cover header-hero--title is missing.

    I’ve set up another page “testing” and did the same (but haven’t selected it to be my home page in the settings), the image appears nicely with the page title on it. This is my reference for testing.

    I’ve then changed the general settings -> read -> home page to the “testing” page and voilà: now this page is missing the hero image. When I then open my “original homepage” from the first paragraph of this post via URL, the image is loaded correctly.

    => So there is the proof the image won’t get shown once a page is selected to be the home page. How can I fix this?

    Thanks in advance!
    Julian

    ihor developer

    Thanks! If you have a moment, please rate it on WP.org, this really helps to continue the development https://wordpress.org/support/plugin/hivepress/reviews/

    The header area can be added via the “more” block (or code, depends on which editor you’re using). Any content above the “more” block will be displayed in the header area. Here’s how the demo site Home page looks in the editor https://prnt.sc/116rqkk

    jwittorf

    Thanks for your quick response, you’ll get a review 🙂

    I’m using Elementor and I can see something beeing added to the header. But now I have the content duplicated inside the header (although the “read more” is the first element of the page).

    Is there another trick on how to handle Elementor?

    jwittorf

    Oh and another problem with Elementor I’ve encountered: I can’t switch to the template “Elemntor full width”, I’m getting this an error redirecting me to https://elementor.com/help/the-content-area-was-not-found-error/

    ihor developer

    Can’t say for sure about Elementor, but ListingHive follows the WordPress coding standards so it should be ok (maybe with a few CSS tweaks). We don’t guarantee 100% integration with Elementor yet (it’s on the roadmap) – I highly recommend using the default WordPress block editor (there’s a 100% integration) because third-party page builders affect the website performance.

    jwittorf

    Hi again, I’ve dropped Elemtor an did as you said but the heading is duplicated: http://prntscr.com/11fw01l

    How can I change this? It’s almost perfect!

    jwittorf

    Solved it myself with a child theme.

    Copied page.php and then set: <?php the_content(null, true); ?> to strip the “more” content from the page.

    Or would you have gone a different approach?

    jwittorf

    If anybody stumbles upon this post, you can use this code to display the default header image and the current page title on the blog list and listing lists pages. I’ve already prepared a few common page types, you can find other type here (https://wordpress.stackexchange.com/questions/14768/determine-if-page-is-the-posts-page/202567#202567) or in the WordPress docs.

    This is the code for the functions.php, adjust according to your needs:

    
    <?php
    // Exit if accessed directly.
    defined('ABSPATH') || exit;
    
    add_filter(
        'hivetheme/v1/areas/site_hero',
        function ($output) {
    
            if (is_front_page()) {
    //            echo "<h1>Homepage of WordPress</h1>";
    ?>
                        <!-- extra hero HTML for front page -->
    
    <?php
            }
            else if (is_home()) {
    //                echo "<h1>List of posts</h1>";
    ?>
                        <!-- extra hero HTML for blog page -->
                        <section class="header-hero header-hero--cover header-hero--title">
                            <div class="header-hero__content">
                                <div class="container">
                                    <div class="row">
                                        <div class="col-sm-8 col-sm-offset-2 col-xs-12">
                                            <h1 class="page__title"><?php echo wp_title(''); ?></h1>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </section>
    
    <?php
            }
            else if (is_post_type_archive()) {
    //            echo "<h1>General post archive/list, can be filtered with parameter</h1>";
    ?>
                <!-- extra hero HTML for special archive page -->
                <section class="header-hero header-hero--cover header-hero--title">
                    <div class="header-hero__content">
                        <div class="container">
                            <div class="row">
                                <div class="col-sm-8 col-sm-offset-2 col-xs-12">
                                    <h1 class="page__title"><?php echo wp_title(''); ?></h1>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
    
    <?php
            }
            else if (is_archive()) {
    //            echo "<h1>Regular archive page</h1>";
    ?>
                <!-- extra hero HTML for archive -->
    
    <?php
            }
            else if (is_singular('post')) {
    //            echo "<h1>Detail page for a blog post</h1>";
    ?>
                <!-- extra hero HTML for singe blog post -->
    
    <?php
            }
            else if (is_singular('hp_listing')) {
    //            echo "<h1>Detail page for a listing</h1>";
    ?>
                <!-- extra hero HTML for singe listing post -->
    
    <?php
            }
    
            return $output;
        }
    );
    
    ihor developer

    Thanks for sharing!

    To avoid content duplication, you can select the “Read More” block and check the “Hide the content before…” option on the right (in the Block Settings section) – code changes are not required for this.

    jwittorf

    Ah great, thanks! Didn’t know that 🙂

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.