Support

Account

Home Forums Front-end Issues Getting value from options page when a checkbox is selected

Solving

Getting value from options page when a checkbox is selected

  • I’m not sure if I am wording this right but what I am trying to achieve is to get a value from an options page when a checkbox is selected from a different page. I’m really stumped on how I am going about this.

    To elaborate this more is that I have this list of people with bios and links. They are displayed in multiple parts of the site. In the different parts of the site that the list is shown I want the user to be able to pick on choose which people will be on the list for the different pages.

  • Hopefully I have this right, I’m assuming you have these people added on an options page.

    A better way to do this would be to have a Custom Post Type for adding the people and then use a relationship type of a field on the page editor where you want to allow them to be selected. If you’re not sure about adding CPTs check out Custom Post Type UI. You can set public to false in the post type so the posts are not accessible from the front end.

    Using and options page for your people you’re going to need to build a filter on the acf/load_field hook that gets all the values from the option pages and makes them choices for your checkbox field. I think displaying them on the front end would probably be a bit more complicated than the other way.

  • Hmm ok I understand the custom post but how do I get the user to be able to pick and choose which bio gets put on which page?

    The context of the pages are plays/performances that are coming up or previously shown. They have a credits section that shows who has been working or acting in the performance. Not every one listed would be in the same performance. These performances would be custom posts as well.

  • So you actually have 3 different things that need to be related.

    • Plays
    • People (Actors, Workers, Etc)
    • Performances

    This may not work for you, but, I’d probably create 3 custom post types, that match each of the above.

    Since the thing you’ll may be adding most often is performances that’s the one I’d probably use to tie the other them all together. Each play post would have information about just the play. Each person post would have just information about the person. Then when creating a performance post you’d select a play and the people involved.

    Anyway, you pick what bios go on each performance page using one of the relationship type fields, same with selecting the play.

    Hope that helps.

    ~JH

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

The topic ‘Getting value from options page when a checkbox is selected’ is closed to new replies.