0

I'm setting up a Wordpress project with Gatsby as frontend, and also using ACF for content. But I wonder how you would setup global content parts like header, footer, or any other kind of content that is being used globally throughout the website? For example both HOME and ABOUT pages need to have their "own" content, but also shares some specific blocks with same content.

I need to be able to edit the content for my header like setting up links to internal pages, be able to edit footer content (like text, an image etc), and for any other global blocks I'm looking for a way to setup them like title, text, maybe an image and so on (ACF control kind of...)

Please help me out!

Thanks

6
  • 1
    If your front end is being built with Gatsby, then this is more of a Gatsby question. Header links are typically navigation menus, and other content could be managed with the Customize API, but how you use those things in Gatsby is entirely a Gatsby question, which is off topic here. You'd be better off asking in a Gatsby specific forum. Jul 24 '20 at 6:54
  • Thanks @JacobPeattie. But in order to edit content of a "navigation menu", how do I do that? As I remember menues just allow you to choose what pages/urls the menu should have, and their labels? About Gatsby: Yes, in order to do the layout etc it's a Gatsby question, but the content is within Wordpress and I need to be able to fetch all my data via wp-json and that is based on how it is setup within Wordpress. Gatsby will only care for the data it fetches.
    – nickelman
    Jul 24 '20 at 7:02
  • Menus are edited in Apperance > Menus. It will only appear if your theme supports menus. Which theme you use or how you use it when using Gatsby is, again, a Gatsby question. Jul 24 '20 at 7:18
  • @JacobPeattie yes, but where do I put an editable text (other than regular menu items) that needs to be in the menu?
    – nickelman
    Jul 24 '20 at 7:32
  • That's not supported. You'd need to use the Customize API, as I suggested in my first comment. Jul 24 '20 at 7:34
1

ACF has the ability to create a 'Theme Options' page which you can then use to conveniently centralise options for things like headers and footer etc..

ACF Options Page information

As Jacob Peattie rightly points out, how you integrate this into Gatsby is outside of the scope of WPSE and may require custom development. However, providing you can inject custom code into these areas, via a function, shortcode or custom widget etc., using an ACF Options Page to control that content works nicely and is worth exploring.

2
  • Thanks man, exactly what I was looking for!
    – nickelman
    Jul 24 '20 at 9:06
  • No worries! Jacob Peattie mentioned Customize API and thats another route for sure and centralises all your controls in one place but it requires mode hand-coding whereas this route is more convenient as a toolset. Either route can work, just depends on your preferred approach.
    – t2pe
    Jul 24 '20 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.