Custom Fields
Support General The select field, which would show the list of values from specified type

  • Creator
  • #15390
    Resolved Денис

    I have a clonable group to create the sections of the page. Each group has a select field with a list of the templates for the frontend to choose. So the user could create as many pages with different sections he wants with different types of the templates of sections I created in any order he wants. Like a builder.

    The screenshot will help to understand better

    Each section has the name.
    Some of the templates of the sections have buttons. My client wants to have the possibility to add behavior to the buttons. Some of the buttons could open other pages, some of them should scroll to the specified section.

    For now, I see only 1 possible way to do this - is to add the text field, where he should put the name of the section he wants to scroll to or the URL he wants to go to. But this is too complicated for the user. He needs to remember it, and he can make mistakes.
    I wish I could have the select field, which could print all the clonable fields I specified. In my case all the sections I created.

    Is there any possibility to do that?

    I came up with the idea to make +1 type of the field which could accept the id of the group in the config I created and make the request to the database, to print all of the values. I guess the same thing as rvmb() method does, not for the frontend, but for admin panel.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
  • #15391

    Few minutes after I made this post I asked myself. Why would not I use the same functionality for admin panel as for pages?

    Cause it works!

    The same file with $meta_boxes config I made request to get the meta boxes using get_post_meta method with $_GET['post'] to get the id of current page.

    Then I created another array, to filter out sections without any id-s.
    I used makeIdFromString custom method to rid off all of the spaces and capital letters
    And then I put this array to the config.
    That's it. It works.

    Anh Tran

    That's very creative. I'd suggest adding the index of the section ($key in your code) to generate the ID, to make sure it's unique.


    True. The thing is the name of the sections should be unique, cause they go to the top navigation menu, between the sections. So there would no mistake for the client.

    But you are right. Your decision is bulletproof.

    Anyways, it would be awesome to have the kind of type of the field, which could get the specified list of other filled fields on the fly. I think it should be simple to do for devs and it adds more flexibility. My decision does not work on the fly right now, cause it does not uses Ajax and I need to reload the page, if I added some other sections or names.

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