Site logo

Archived topic

ACF Field to Page Header?

10 replies · Started by Sebastian on February 13, 2017

Viewing posts 1–11 of 11

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

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?

Did you try before header content hook?

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

Is your site live by any chance?

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.

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?

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.

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

I'll see what I can do :)

This archived topic is closed to new replies.