• Resolved felixhtoo30

    (@felixhtoo30)


    Hello,
    I’m trying to get the fields based on the sections.
    According to the sample:
    let’s say, opt_name is ‘sample_options‘.
    And the section is ‘colors‘.
    And the fields are ‘site-title-colors‘ and ‘footer-background-color‘.

    I’m already aware of the way $sample_options, and it gives all the fields without section based.

    Is there any way to get the fields based on the ‘colors‘ section related fields only: (‘site-title-colors‘ and ‘footer-background-color‘)?

    • This topic was modified 4 months, 2 weeks ago by felixhtoo30. Reason: To be more clear in main question title
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Kev Provance

    (@kprovance)

    Perhaps this is what you are looking for: https://devs.redux.io/configuration/objects/section.html

    If there are not helper functions in our API, which is documented on that same site, then there isn’t a way. But, you could easily write a function that enumerates the opt_name object and get them that way.

    Good luck.

    Thread Starter felixhtoo30

    (@felixhtoo30)

    Hi Kev,

    Actually, I’ve also tested Redux::get_section way as well. It only shows the info data of the specific section (such as the title, id, desc).

    According to above example,
    If I Redux::get_section(‘sample_options’, ‘colors’), the return data will be:

    {
    "title": "Colors"
    "id": "colors",
    ...
    }


    What I would like to achieve are the specific fields linked with the section ‘color’:
    Expected:

    {
    "site-title-colors": "#ff0000",
    "footer-background-color": "#000"
    }


    According to your answer, I think I’m gonna have to write custom for this if I would like to achieve like that. Thanks for your answer, Kev.

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