Support

Account

Home Forums Add-ons Options Page Universal Field

Solving

Universal Field

  • I know I can use the Options, however I may have a unique situation, so any help would be awesome.

    I would like to create a textarea (or more than one), specifically for a stylesheet. I’ve already done this before, however, in this case I would like to display that textarea on every page with updated live code.

    In a nutshell, I have used repeater fields to create sections -> rows-> columns. Each has the option for an id and classes. So, ideally if while editing or creating a page, the user has access to update the css right there on the page and update it instead of having to go into the setting panel each time, that would be great!

  • Hi @dtek516

    Did you mean you want to do it on the front end? If you did, you can always use the acf_form() function. You can also use the acf/save_post hook and the update_field() function to update the value on the real field everytime you saved the form. To load the same value from the real field, you can use the acf/load_field hook.

    I hope this helps πŸ™‚

  • No, the backend. Sorry, should have been more specific. It would be a convenience while creating pages on the back end.

  • Hi @dtek516

    In that case, I think you need to create a custom location rule. This page should give you more idea about it: https://www.advancedcustomfields.com/resources/custom-location-rules/. After that, you can load and update the field value like I told you before.

    Hope this helps πŸ™‚

  • Perhaps Im missing something in that documentation, but if i create a group for my css and have it located on everypage, wont that data be different each time?

  • Hi @dtek516

    Yes, it would be different on each page, but you can use the acf/save_post hook and the update_field() function to update certain custom field (i.e. the custom field in an options page).

    You can also use the acf/load_field hook to load the value from that particular custom field so all of the dummy stylesheet fields will show the value from the correct one.

    Please take a look at my previous answers.

    I hope this makes sense πŸ™‚

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

You must be logged in to reply to this topic.