Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathan-dejong/8c96825114c80fd147a2a05dce141079 to your computer and use it in GitHub Desktop.
Save jonathan-dejong/8c96825114c80fd147a2a05dce141079 to your computer and use it in GitHub Desktop.
<?php
global $post;
if ( function_exists( 'acf_add_local_field_group' ) ) :
acf_add_local_field_group(array(
'key' => 'group_58bff7f25c321',
'title' => 'Garderobsbyggaren',
'fields' => array(),
'location' => array(
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'product',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => 1,
'description' => '',
));
/**
* Instructions at the top!
*/
acf_add_local_field(
array(
'key' => 'field_58bffffb60ca1',
'label' => 'Instruktioner',
'name' => '',
'type' => 'message',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'message' => 'Börja med att bestämma alla stommar. Spara sedan produkten. Då får ni alla uppdaterade val för övriga komponenter.',
'new_lines' => 'wpautop',
'esc_html' => 0,
'parent' => 'group_58bff7f25c321',
)
);
/**
* Stommar
*/
acf_add_local_field(
array(
'key' => 'field_58bff7f85e02b',
'label' => 'Stommar',
'name' => 'bases',
'type' => 'repeater',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'collapsed' => 'field_58bff82c5e02d',
'min' => 0,
'max' => 0,
'layout' => 'block',
'button_label' => '+ Lägg till stomme',
'parent' => 'group_58bff7f25c321',
'sub_fields' => array(),
)
);
/**
* Title for base
*/
acf_add_local_field(
array(
'key' => 'field_58bff82c5e02d',
'label' => 'Titel',
'name' => 'title',
'type' => 'text',
'instructions' => '',
'required' => 1,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '50',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'parent' => 'field_58bff7f85e02b',
)
);
/**
* Image for base
*/
acf_add_local_field(
array(
'key' => 'field_58bffa8e5e02e',
'label' => 'Bild',
'name' => 'image',
'type' => 'image',
'instructions' => '',
'required' => 1,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '50',
'class' => '',
'id' => '',
),
'return_format' => 'array',
'preview_size' => 'medium',
'library' => 'all',
'min_width' => '',
'min_height' => '',
'min_size' => '',
'max_width' => '',
'max_height' => '',
'max_size' => '',
'mime_types' => '',
'parent' => 'field_58bff7f85e02b',
)
);
/**
* Height for base
*/
acf_add_local_field(
array(
'key' => 'field_58bff82c5e02c',
'label' => 'Höjd',
'name' => 'height',
'type' => 'number',
'instructions' => '',
'required' => 1,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '33',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => 'mm',
'min' => '',
'max' => '',
'step' => 1,
'parent' => 'field_58bff7f85e02b',
)
);
/**
* Width for base
*/
acf_add_local_field(
array(
'key' => 'field_58bff9f45e02d',
'label' => 'Bredd',
'name' => 'width',
'type' => 'number',
'instructions' => '',
'required' => 1,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '33',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => 'mm',
'min' => '',
'max' => '',
'step' => 1,
'parent' => 'field_58bff7f85e02b',
)
);
/**
* Price for base
*/
acf_add_local_field(
array(
'key' => 'field_58bff9f45e02g',
'label' => 'Pris',
'name' => 'price',
'type' => 'number',
'instructions' => '',
'required' => 1,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '33',
'class' => '',
'id' => '',
),
'default_value' => 0,
'placeholder' => '',
'prepend' => '',
'append' => 'SEK/st',
'min' => 0,
'max' => '',
'step' => 1,
'parent' => 'field_58bff7f85e02b',
)
);
/**
* Extra save button. Just for good measure.
*/
acf_add_local_field(
array(
'key' => 'field_58bffffb60ca2',
'label' => '',
'name' => '',
'type' => 'message',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => 'save-bases-button',
'id' => '',
),
'message' => '<button type="submit" class="button-primary">' . __( 'Spara stommar', 'byggaren' ) . '</button>',
'new_lines' => 'wpautop',
'esc_html' => 0,
'parent' => 'group_58bff7f25c321',
)
);
/**
* Decoration (inredning)
*/
acf_add_local_field(
array(
'key' => 'field_decoration',
'label' => 'Inredning',
'name' => 'decorations',
'type' => 'repeater',
'instructions' => '',
'required' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'collapsed' => 'field_decoration_title',
'min' => 0,
'max' => 0,
'layout' => 'table',
'button_label' => '+ Lägg till inredning',
'parent' => 'field_58bff7f85e02b',
'sub_fields' => array(
array(
'key' => 'field_decoration_title',
'label' => 'Titel',
'name' => 'title',
'type' => 'text',
'instructions' => '',
'required' => 1,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '50',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'max_length' => '',
'readonly' => 0,
'disabled' => 0,
),
array(
'key' => 'field_decoration_image',
'label' => 'Bild',
'name' => 'image',
'type' => 'image',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '25',
'class' => '',
'id' => '',
),
'return_format' => 'array',
'preview_size' => 'medium',
'library' => 'all',
'min_width' => '',
'min_height' => '',
'min_size' => '',
'max_width' => '',
'max_height' => '',
'max_size' => '',
'mime_types' => '',
),
array(
'key' => 'field_decoration_price',
'label' => 'Pris',
'name' => 'price',
'type' => 'number',
'instructions' => '',
'required' => 1,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '25',
'class' => '',
'id' => '',
),
'default_value' => 0,
'placeholder' => '',
'prepend' => '',
'append' => 'SEK/st',
'min' => 0,
'max' => '',
'step' => 1,
),
),
)
);
/**
* Garderobsbyggaren - Doors
*/
acf_add_local_field(
array(
'key' => 'field_doors',
'label' => 'Dörrar',
'name' => 'doors',
'type' => 'repeater',
'instructions' => '',
'required' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'collapsed' => 'field_door_title',
'min' => 0,
'max' => 0,
'layout' => 'table',
'button_label' => '+ Lägg till dörr',
'parent' => 'field_58bff7f85e02b',
'sub_fields' => array(
array(
'key' => 'field_door_title',
'label' => 'Titel',
'name' => 'title',
'type' => 'text',
'instructions' => '',
'required' => 1,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '50',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
),
array(
'key' => 'field_door_image',
'label' => 'Bild',
'name' => 'image',
'type' => 'image',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '25',
'class' => '',
'id' => '',
),
'return_format' => 'array',
'preview_size' => 'medium',
'library' => 'all',
'min_width' => '',
'min_height' => '',
'min_size' => '',
'max_width' => '',
'max_height' => '',
'max_size' => '',
'mime_types' => '',
),
array(
'key' => 'field_door_price',
'label' => 'Pris',
'name' => 'price',
'type' => 'number',
'instructions' => '',
'required' => 1,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '25',
'class' => '',
'id' => '',
),
'default_value' => 0,
'placeholder' => '',
'prepend' => '',
'append' => 'SEK/st',
'min' => 0,
'max' => '',
'step' => 1,
),
),
)
);
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment