new-modal-content.php
95 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Render form to create new placements. |
| 4 | * |
| 5 | * @package AdvancedAds |
| 6 | * @author Advanced Ads <info@wpadvancedads.com> |
| 7 | * |
| 8 | * @var string $placements_description Whether a placement already exists. |
| 9 | */ |
| 10 | |
| 11 | if ( '' !== $placements_description ) : ?> |
| 12 | <p class="description"> |
| 13 | <?php echo esc_html( $placements_description ); ?> |
| 14 | <a href="https://wpadvancedads.com/manual/placements/?utm_source=advanced-ads&utm_medium=link&utm_campaign=placements" target="_blank" class="advads-manual-link"> |
| 15 | <?php esc_html_e( 'Manual', 'advanced-ads' ); ?> |
| 16 | </a> |
| 17 | </p> |
| 18 | <?php endif; ?> |
| 19 | |
| 20 | <form method="POST" class="advads-placements-new-form advads-form" id="advads-placements-new-form"> |
| 21 | <input type="hidden" name="nonce" value="<?php echo esc_attr( wp_create_nonce( 'advads-create-placement' ) ); ?>"/> |
| 22 | <h3>1. <?php esc_html_e( 'Choose a placement type', 'advanced-ads' ); ?></h3> |
| 23 | <p class="description"> |
| 24 | <?php |
| 25 | printf( |
| 26 | wp_kses( |
| 27 | /* translators: %s is a URL. */ |
| 28 | __( 'Placement types define where the ad is going to be displayed. Learn more about the different types from the <a href="%s">manual</a>', 'advanced-ads' ), |
| 29 | [ |
| 30 | 'a' => [ |
| 31 | 'href' => [], |
| 32 | ], |
| 33 | ] |
| 34 | ), |
| 35 | 'https://wpadvancedads.com/manual/placements/#utm_source=advanced-ads&utm_medium=link&utm_campaign=placements' |
| 36 | ); |
| 37 | ?> |
| 38 | </p> |
| 39 | |
| 40 | <?php require 'placement-types.php'; ?> |
| 41 | |
| 42 | <?php |
| 43 | // show Pro placements if Pro is not activated. |
| 44 | if ( ! defined( 'AAP_VERSION' ) ) : |
| 45 | require ADVADS_ABSPATH . 'admin/views/upgrades/pro-placements.php'; |
| 46 | endif; |
| 47 | ?> |
| 48 | <div class="clear"></div> |
| 49 | <p class="advads-notice-inline advads-error advads-form-type-error"> |
| 50 | <?php esc_html_e( 'Please select a type.', 'advanced-ads' ); ?> |
| 51 | </p> |
| 52 | <br/> |
| 53 | <h3>2. |
| 54 | <label for="advads-placement-title"> |
| 55 | <?php esc_html_e( 'Choose a Name', 'advanced-ads' ); ?> |
| 56 | </label> |
| 57 | </h3> |
| 58 | <p> |
| 59 | <input name="advads[placement][title]" id="advads-placement-title" class="advads-form-name" type="text" value="" placeholder="<?php esc_html_e( 'Placement Name', 'advanced-ads' ); ?>"/> |
| 60 | <span class="advads-help"> |
| 61 | <span class="advads-tooltip"> |
| 62 | <?php esc_html_e( 'The name of the placement is only visible to you. Tip: choose a descriptive one, e.g. Below Post Headline.', 'advanced-ads' ); ?> |
| 63 | </span> |
| 64 | </span> |
| 65 | </p> |
| 66 | <p class="advads-notice-inline advads-error advads-form-name-error"> |
| 67 | <?php esc_html_e( 'Please enter a name.', 'advanced-ads' ); ?> |
| 68 | </p> |
| 69 | <h3> |
| 70 | 3. <label for="advads-placement-item"> |
| 71 | <?php esc_html_e( 'Choose the Ad or Group', 'advanced-ads' ); ?> |
| 72 | </label> |
| 73 | </h3> |
| 74 | <p> |
| 75 | <?php require 'item-select.php'; ?> |
| 76 | </p> |
| 77 | <?php wp_nonce_field( 'advads-new-placement', 'advads_placement' ); ?> |
| 78 | <input type="hidden" name="action_advads" value="new_placement"> |
| 79 | </form> |
| 80 | |
| 81 | <script type="text/html" id="tmpl-advads-placement-ad-select"> |
| 82 | <select name="advads[placement][item]" id="advads-placement-item"> |
| 83 | <option value=""><?php esc_html_e( '--not selected--', 'advanced-ads' ); ?></option> |
| 84 | <# for ( group of data.items ) { #> |
| 85 | <optgroup label="{{ group.label }}"> |
| 86 | <# for ( item_id in group.items ) { #> |
| 87 | <option value="{{ item_id }}"> |
| 88 | {{ group.items[item_id] }} |
| 89 | </option> |
| 90 | <# } #> |
| 91 | </optgroup> |
| 92 | <# } #> |
| 93 | </select> |
| 94 | </script> |
| 95 |