Setting a custom field in both settings and custom post type

Support MB Settings Page Setting a custom field in both settings and custom post typeResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #40176
    spipdesignsspipdesigns
    Participant

    Hi

    i am wondering if this is possible:

    i want to have a checkbox that says whether an item is available for order in restaurant. I would like the owner to have easy access to click a checkbox for yes.

    the item will be in a query loop, and has been set up as a custom post in a custom post type (Menu).

    How would i set the checkbox to say yes, item available, and at the same time, the checkbox also is Yes in the post, so that the query can display that item (query will show items from menu that have available selected?

    Example:

    Pizzeria (settings topmenu) --> Available items (settings submenu) --> Vegan Pizza (Custom Field Checkbox: Y if ticked).

    Pizzeria (settings topmenu) --> Pizzas (settings submenu) ---> Vegan Pizza (Post) --->Available (Custom Field Checkbox: Y if ticked - managed from Vegan Pizza in Available items in settings submenu above.

    However, other pizza items need to be able to be displayed in query loop, so they need an available Checkbox Y

    is that possible?

    #40188
    PeterPeter
    Moderator

    Hello there,

    I think it is possible but it would need to create some custom code to do that. If you are familiar with coding can follow the suggestion below to create the code on your own.
    - create a callback function and hook to the action mb_settings_page_load
    - query to get posts of post type menu and update the field value by using the function update_post_meta()

    Please read more on the documentation
    https://docs.metabox.io/extensions/mb-settings-page/#hooks
    https://developer.wordpress.org/reference/functions/update_post_meta/

    If not, you can create a customization service here https://metabox.io/contact/, our development team will help you with an extra fee.

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