2

Bear with me a moment as I am still relatively new to WP dev.

I am currently building a custom site that loads certain blocks on pages using get_template_part(); .

So for example, the home page will have it's own relevant content but will also include generic content (subscribe, contact, awards...). I do not want these sections to be hard-coded but instead leave them as editable, ideally as an additional menu option within the admin area so the user only needs to change it in one place.

My current solution is not ideal. I am using the Advanced Custom Forms plugin and placing the required text in the default text area. However, even if this is updated it will not update all pages globally and the user will need to go into each individual page to re-publish the it with the new content.

Is it possible to code a new option onto the side menu that will store global settings for template parts?

4
  • Yes you can add new settings pages to the wp-admin -> developer.wordpress.org/reference/functions/add_menu_page. You will need to create a form with settings (which will be saved in the wp-options table) More information here -> codex.wordpress.org/Creating_Options_Pages
    – berend
    Jul 6, 2017 at 10:10
  • 1
    If you have global settings/content, I strongly suggest using the Customization API. Jul 6, 2017 at 10:27
  • 1
    @JacobPeattie that suggestion was actually what I was looking for and seems to do the trick. I'm not sure if you want to create it as an answer and I can mark it as so?
    – Bagseye
    Jul 7, 2017 at 11:15
  • Done. Only because I think I still don't have enough rep to do some basic stuff on this site. :) Jul 7, 2017 at 11:45

1 Answer 1

0

The Customization API is what you're after. Lets you define site-wide settings for theme/plugin customization.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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