course
6 years ago
announcements-metabox.php
6 years ago
course-add-edd-product-metabox.php
6 years ago
course-add-product-metabox.php
6 years ago
course-additional-data.php
6 years ago
course-contents.php
6 years ago
course-level-metabox.php
6 years ago
course-topics.php
6 years ago
instructors-metabox.php
6 years ago
lesson-attachments-metabox.php
6 years ago
lesson-metabox.php
6 years ago
user-profile-fields.php
6 years ago
video-metabox.php
6 years ago
course-add-product-metabox.php
70 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Add product metabox |
| 4 | * |
| 5 | * @author Themeum |
| 6 | * @url https://themeum.com |
| 7 | * |
| 8 | * @since v.1.0.0 |
| 9 | */ |
| 10 | |
| 11 | |
| 12 | $_tutor_course_price_type = tutils()->price_type(); |
| 13 | |
| 14 | ?> |
| 15 | |
| 16 | <div class="tutor-option-field-row"> |
| 17 | <div class="tutor-option-field-label"> |
| 18 | <label for=""> |
| 19 | <?php _e('Select product', 'tutor'); ?> <br /> |
| 20 | <p class="text-muted">(<?php _e('When selling the course', 'tutor'); ?>)</p> |
| 21 | </label> |
| 22 | </div> |
| 23 | <div class="tutor-option-field"> |
| 24 | <?php |
| 25 | $products = tutor_utils()->get_wc_products_db(); |
| 26 | $product_id = tutor_utils()->get_course_product_id(); |
| 27 | ?> |
| 28 | |
| 29 | <select name="_tutor_course_product_id" class="tutor_select2" style="min-width: 300px;"> |
| 30 | <option value="-1"><?php _e('Select a Product'); ?></option> |
| 31 | <?php |
| 32 | foreach ($products as $product){ |
| 33 | if ($product->ID == $product_id){ |
| 34 | echo "<option value='{$product->ID}' ".selected($product->ID, $product_id)." >{$product->post_title}</option>"; |
| 35 | } |
| 36 | $usedProduct = tutor_utils()->product_belongs_with_course($product->ID); |
| 37 | if ( ! $usedProduct){ |
| 38 | echo "<option value='{$product->ID}' ".selected($product->ID, $product_id)." >{$product->post_title}</option>"; |
| 39 | } |
| 40 | } |
| 41 | ?> |
| 42 | </select> |
| 43 | |
| 44 | <p class="desc"> |
| 45 | <a href="<?php echo get_edit_post_link($product_id); ?>" target="_blank"><?php _e('Edit attached Product', 'tutor'); ?></a> <br /> |
| 46 | <?php _e("Select a product if you want to sell your course. The sale will be handled by your preferred monetization option. (WooCommerce, EDD, Paid Memberships Pro)", 'tutor'); ?> |
| 47 | </p> |
| 48 | </div> |
| 49 | </div> |
| 50 | |
| 51 | |
| 52 | <div class="tutor-option-field-row"> |
| 53 | <div class="tutor-option-field-label"> |
| 54 | <label for=""> |
| 55 | <?php _e('Course Type', 'tutor'); ?> <br /> |
| 56 | </label> |
| 57 | </div> |
| 58 | <div class="tutor-option-field"> |
| 59 | |
| 60 | <label> |
| 61 | <input id="tutor_course_price_type_pro" type="radio" name="tutor_course_price_type" value="paid" <?php $_tutor_course_price_type ? checked($_tutor_course_price_type, 'paid') : checked('true', 'true'); ?> > |
| 62 | <?php _e('Paid', 'tutor'); ?> |
| 63 | </label> |
| 64 | <label> |
| 65 | <input type="radio" name="tutor_course_price_type" value="free" <?php checked($_tutor_course_price_type, 'free'); ?> > |
| 66 | <?php _e('Free', 'tutor'); ?> |
| 67 | </label> |
| 68 | </div> |
| 69 | </div> |
| 70 |