AnsPress_Category::image_field_edit( object $term )
Description #
Image field in category form.
Parameters #
- $termobject (Required) Term.
Source #
File: addons/free/category.php
public static function image_field_edit( $term ) { $term_meta = get_term_meta( $term->term_id, 'ap_category', true ); $term_meta = wp_parse_args( $term_meta, array( 'image' => [ 'id' => '', 'url' => '' ], 'icon' => '', 'color' => '', ) ); ?> <tr class='form-field form-required term-name-wrap'> <th scope='row'> <label for='custom-field'><?php esc_attr_e( 'Image', 'anspress-question-answer' ); ?></label> </th> <td> <a href="#" id="ap-category-upload" class="button" data-action="ap_media_uplaod" data-title="<?php esc_attr_e( 'Upload image', 'anspress-question-answer' ); ?>" data-idc="#ap_category_media_id" data-urlc="#ap_category_media_url"><?php esc_attr_e( 'Upload image', 'anspress-question-answer' ); ?></a> <?php if ( ! empty( $term_meta['image'] ) && ! empty( $term_meta['image']['url'] ) ) { ?> <img id="ap_category_media_preview" data-action="ap_media_value" src="<?php echo esc_url( $term_meta['image']['url'] ); ?>" /> <?php } ?> <input id="ap_category_media_url" type="hidden" data-action="ap_media_value" name="ap_category_image_url" value="<?php echo esc_url( $term_meta['image']['url'] ); ?>"> <input id="ap_category_media_id" type="hidden" data-action="ap_media_value" name="ap_category_image_id" value="<?php echo esc_attr( $term_meta['image']['id'] ); ?>"> <a href="#" id="ap-category-upload-remove" data-action="ap_media_remove"><?php esc_attr_e( 'Remove image', 'anspress-question-answer' ); ?></a> <p class='description'><?php esc_attr_e( 'Featured image for category', 'anspress-question-answer' ); ?></p> </td> </tr> <tr class='form-field term-name-wrap'> <th scope='row'> <label for='custom-field'><?php esc_attr_e( 'Category icon class', 'anspress-question-answer' ); ?></label> </th> <td> <input id="ap_icon" type="text" name="ap_icon" value="<?php echo esc_attr( $term_meta['icon'] ); ?>"> <p class="description"><?php esc_attr_e( 'Font icon class, if image not set', 'anspress-question-answer' ); ?></p> </td> </tr> <tr class='form-field term-name-wrap'> <th scope='row'> <label for='ap-category-color'><?php esc_attr_e( 'Category icon color', 'anspress-question-answer' ); ?></label> </th> <td> <input id="ap-category-color" type="text" name="ap_color" value="<?php echo esc_attr( $term_meta['color'] ); ?>"> <p class="description"><?php esc_attr_e( 'Font icon class, if image not set', 'anspress-question-answer' ); ?></p> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery('#ap-category-color').wpColorPicker(); }); </script> </td> </tr> <?php }
Expand full source code Collapse full source code View on GitHub: addons/free/category.php:563
Add your comment