{"id":6528,"date":"2021-11-28T10:39:00","date_gmt":"2021-11-28T10:39:00","guid":{"rendered":"https:\/\/musilda.cz\/?p=6528"},"modified":"2021-11-28T10:39:00","modified_gmt":"2021-11-28T10:39:00","slug":"nastaveni-vlastniho-typu-produktu-v-administraci","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/nastaveni-vlastniho-typu-produktu-v-administraci\/","title":{"rendered":"Nastaven\u00ed vlastn\u00edho typu produktu v administraci"},"content":{"rendered":"\n
Pro plugin kter\u00fd jsem pracovn\u011b pojmenovat EventPress budeme pot\u0159ebovat p\u0159idat n\u011bjak\u00e9 nastaven\u00ed, kter\u00e9 n\u00e1m umo\u017en\u00ed p\u0159idat vlastn\u00ed funkce. <\/p>\n\n\n\n
Jako z\u00e1klad si p\u0159iprav\u00edme registraci na online webin\u00e1\u0159 a nebudeme d\u011blat nic slo\u017eit\u00e9ho, tak\u017ee p\u0159id\u00e1me n\u00e1sleduj\u00edc\u00ed pole:<\/p>\n\n\n\n
Nic jin\u00e9ho pot\u0159ebovat nebudeme<\/p>\n\n\n\n
Do funkce musilda_eventpress_product_option si p\u0159id\u00e1me n\u00e1sleduj\u00edc\u00ed k\u00f3d:<\/p>\n\n\n\n
global $post;\n$min_participants = get_post_meta( $post->ID, '_min_participants', true );\nif ( empty( $min_participants ) ) {\n\t$min_participants = 1;\n}\n$max_participants = get_post_meta( $post->ID, '_max_participants', true );\nif ( empty( $max_participants ) ) {\n\t$max_participants = 1;\n}\n\nwoocommerce_wp_text_input(\n\tarray(\n\t\t'id' => '_min_participants',\n\t\t'value' => $min_participants,\n\t\t'label' => __( 'Minimal participants', 'musilda-eventpress' ),\n\t\t'placeholder' => __( '1', 'musilda-eventpress' ),\n\t\t'description' => __( 'Add minimum participants for event', 'musilda-eventpress' ),\n\t\t'type' => 'number',\n\t\t'custom_attributes' => array(\n\t\t\t'step' => '1',\n\t\t\t'min' => '1',\n\t\t),\n\t)\n);\nwoocommerce_wp_text_input(\n\tarray(\n\t\t'id' => '_max_participants',\n\t\t'value' => $max_participants,\n\t\t'label' => __( 'Maximal participants', 'musilda-eventpress' ),\n\t\t'placeholder' => __( '1', 'musilda-eventpress' ),\n\t\t'description' => __( 'Add maximal participants for event', 'musilda-eventpress' ),\n\t\t'type' => 'number',\n\t\t'custom_attributes' => array(\n\t\t\t'step' => '1',\n\t\t\t'min' => '1',\n\t\t),\n\t)\n);<\/code><\/pre>\n\n\n\nV\u00fdsledek:<\/p>\n\n\n\n