Okay
  Public Ticket #1351198
edit values in drop down
Open

Comments

  •  2
    chefcove started the conversation

    hi,

    Currently, in submit recipe -  the selection for prepare time / cook time / serving drop down menu shows selection from 1,2,3,4 ....  X amount. 

    How do i change the respective selections to be eg. 

    Prepare time -> 15 , 30, 45, 60, 90, 120

    Same for cook time. 

    Servings --> 5, 10, 15, 20 etc.

    thanks

  •  617
    Theme replied

    Hi,

    Are you referring to the frontend or the backend?

    Best regards,

    themeenergy support

  •  2
    chefcove replied

    Back end, where one is submit a new receipt

    thanks!

  •  617
    Theme replied

    Hi,

    You would have to copy includes/theme_meta_boxes.php to your child theme (same folder structure), edit the file and change the step part (for example for cooking time) from:

    $this->recipe_custom_meta_fields[] = array( // Post ID select box
                    'label'    => __('Cooking time (in minutes)', 'socialchef'), //
                    'desc'    => '', // description
                    'id'    => 'recipe_cooking_time', // field id and name
                    'type'    => 'slider',
                    'min'    => '1',
                    'max'    => '360',
                    'step'    => '1'
                );

    to

    $this->recipe_custom_meta_fields[] = array( // Post ID select box
                    'label'    => __('Cooking time (in minutes)', 'socialchef'), //
                    'desc'    => '', // description
                    'id'    => 'recipe_cooking_time', // field id and name
                    'type'    => 'slider',
                    'min'    => '1',
                    'max'    => '360',
                    'step'    => '15'
                );

    You would do the same for the other fields you want to change.

    Best regards,

    themeenergy support

  •  2
    chefcove replied

    Hi sorry, I copied the code but could not observe the change.

    Could you advice on the frontend as well.

    thanks

  •   chefcove replied privately
  •  617
    Theme replied

    Hi,

    The instructions I gave you are for the backend as that is what you requested.

    For the frontend editor, you would have to copy includes/plugins/frontend-submit/frontend-submit.php (same folder structure), edit the file and change the code on line 1088

    Right now it's 

    $cook_time_str = ":" . __('Select cook time (minutes)', 'socialchef') . "";
                for ($i = 1;$i < 181;$i++) {
                    $cook_time_str .= ",$i:$i";
                }

    It would need to be modified by you to go in increments you desire.

    Best regards,

    themeenergy support

  •  2
    chefcove replied

    Hi,

    Managed to locate the code.

    Could you also give an example of the edited part, like what you did for the backend editor.

    Assuming i requires increments of 15min.

    Eg. "if step=15"

    thanks

  •  2
    chefcove replied

    Hi, thanks. I found my answer. 

    $i++ becomes $i+=15

    For users whom are new to php like me.

  •  617
    Theme replied

    Great to hear, thanks for posting the answer.

    Best regards,

    themeenergy support