Site logo

[Support request] ACF Field to Page Header?

Home Forums Support [Support request] ACF Field to Page Header?

Home Forums Support ACF Field to Page Header?

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #278322
    Sebastian

    Hi Tom, Hi Leo,

    I would like to include an ACF field <?php the_field('text'); ?> in the “Page Header” (combined with site header). The ACF field should be inside the “div class: inside-page-header”. Is there a way to integrate this using functions.php?

    Regards, Sebastian

    #278341
    Leo
    Staff
    Customer Support

    Hi Sebastian,

    I think you would use GP hooks for that: https://docs.generatepress.com/article/hooks-overview/.

    Take a look at where they are located: http://demo.generatepress.com/hook-locations/

    Both before header content and after header content are inside header.

    Let me know if this works

    #278344
    Sebastian

    Hi Leo, Thanks your quick response. I mean, inside the generated Page Header from GP Premium. The Content is enclosed by the class “create-inside-combined-content”. Inside this class i would linke put the ACF Field. You know what I mean?

    #278361
    Leo
    Staff
    Customer Support

    Did you try before header content hook?

    #278371
    Sebastian

    Yes I tried. But it is not the right place.

    #278375
    Leo
    Staff
    Customer Support

    Is your site live by any chance?

    #278439
    Tom
    Lead Developer
    Lead Developer

    You could use the Page Header area, but you would first have to create a new shortcode with your custom fiend.

    add_shortcode( 'your_shortcode_tag','sebastian_acf_shortcode' );
    function sebastian_acf_shortcode() {
        ob_start();
        ?> 
        Your custom field/HTML in here
        <?php
        return ob_get_clean();
    }

    Then you would add [your_shortcode_tag] into the page header content area.

    #278994
    Sebastian

    Hi Tom, many thanks for the support.

    This is a very good solution, but for a customer website another solution would be better. Is there any way to solve this problem using functions.php?

    #279229
    Tom
    Lead Developer
    Lead Developer

    There’s the generate_inside_merged_page_header hook which might help.

    Looks like that’s the only hook inside Page Header at the moment.

    #280235
    Sebastian

    Yes, I have seen. But the content appears above the navigation. Will you perhaps add another hook in the future?

    #280818
    Tom
    Lead Developer
    Lead Developer

    I’ll see what I can do 🙂

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