| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <?php
- $fields = array(
- 'color' => esc_html__( 'Color:', 'vamtam-consulting' ),
- 'image' => esc_html__( 'Image / pattern:', 'vamtam-consulting' ),
- 'repeat' => esc_html__( 'Repeat:', 'vamtam-consulting' ),
- 'attachment' => esc_html__( 'Attachment:', 'vamtam-consulting' ),
- 'position' => esc_html__( 'Position:', 'vamtam-consulting' ),
- 'size' => esc_html__( 'Size:', 'vamtam-consulting' ),
- );
- $sep = isset( $sep ) ? $sep : '-';
- $current = array();
- if ( ! isset( $only ) ) {
- if ( isset( $show ) ) {
- $only = explode( ',', $show );
- } else {
- $only = array();
- }
- } else {
- $only = explode( ',', $only );
- }
- $show = array();
- global $post;
- foreach ( $fields as $field => $fname ) {
- if ( isset( $GLOBALS['vamtam_in_metabox'] ) ) {
- $current[ $field ] = get_post_meta( $post->ID, "$id-$field", true );
- } else {
- $current[ $field ] = vamtam_get_option( "$id-$field" );
- }
- $show[ $field ] = ( in_array( $field, $only ) || count( $only ) === 0 );
- }
- $selects = array(
- 'repeat' => array(
- 'no-repeat' => esc_html__( 'No repeat', 'vamtam-consulting' ),
- 'repeat-x' => esc_html__( 'Repeat horizontally', 'vamtam-consulting' ),
- 'repeat-y' => esc_html__( 'Repeat vertically', 'vamtam-consulting' ),
- 'repeat' => esc_html__( 'Repeat both', 'vamtam-consulting' ),
- ),
- 'attachment' => array(
- 'scroll' => esc_html__( 'scroll', 'vamtam-consulting' ),
- 'fixed' => esc_html__( 'fixed', 'vamtam-consulting' ),
- ),
- 'position' => array(
- 'left center' => esc_html__( 'left center', 'vamtam-consulting' ),
- 'left top' => esc_html__( 'left top', 'vamtam-consulting' ),
- 'left bottom' => esc_html__( 'left bottom', 'vamtam-consulting' ),
- 'center center' => esc_html__( 'center center', 'vamtam-consulting' ),
- 'center top' => esc_html__( 'center top', 'vamtam-consulting' ),
- 'center bottom' => esc_html__( 'center bottom', 'vamtam-consulting' ),
- 'right center' => esc_html__( 'right center', 'vamtam-consulting' ),
- 'right top' => esc_html__( 'right top', 'vamtam-consulting' ),
- 'right bottom' => esc_html__( 'right bottom', 'vamtam-consulting' ),
- ),
- );
- ?>
- <div class="vamtam-config-row background clearfix <?php echo esc_attr( $class ) ?>">
- <div class="rtitle">
- <h4><?php echo esc_html( $name ) ?></h4>
- <?php vamtam_description( $id, $desc ) ?>
- </div>
- <div class="rcontent">
- <div class="bg-inner-row">
- <?php if ( $show['color'] ) : ?>
- <div class="bg-block color">
- <div class="single-desc"><?php esc_html_e( 'Color:', 'vamtam-consulting' ) ?></div>
- <input name="<?php echo esc_attr( $id . $sep . 'color' ) ?>" id="<?php echo esc_attr( $id ) ?>-color" type="text" data-hex="true" value="<?php echo esc_attr( $current['color'] ) ?>" class="vamtam-color-input" />
- </div>
- <?php endif ?>
- </div>
- <div class="bg-inner-row">
- <?php if ( $show['image'] ) : ?>
- <div class="bg-block bg-image">
- <div class="single-desc"><?php esc_html_e( 'Image / pattern:', 'vamtam-consulting' ) ?></div>
- <?php $_id = $id;
- $id .= $sep . 'image'; // temporary change the id so that we can reuse the upload field ?>
- <div class="image <?php vamtam_static( $value ) ?>">
- <?php include VAMTAM_ADMIN_CGEN . 'upload-basic.php'; ?>
- </div>
- <?php $id = $_id;
- unset( $_id ); ?>
- </div>
- <?php endif ?>
- <?php if ( $show['size'] ) : ?>
- <div class="bg-block bg-size">
- <div class="single-desc"><?php esc_html_e( 'Cover:', 'vamtam-consulting' ) ?></div>
- <label class="toggle-radio">
- <input type="radio" name="<?php echo esc_attr( $id . $sep ) ?>size" value="cover" <?php checked( $current['size'], 'cover' ) ?>/>
- <span><?php esc_html_e( 'On', 'vamtam-consulting' ) ?></span>
- </label>
- <label class="toggle-radio">
- <input type="radio" name="<?php echo esc_attr( $id . $sep ) ?>size" value="auto" <?php checked( $current['size'], 'auto' ) ?>/>
- <span><?php esc_html_e( 'Off', 'vamtam-consulting' ) ?></span>
- </label>
- </div>
- <?php endif ?>
- <?php foreach ( $selects as $s => $options ) : ?>
- <?php if ( $show[ $s ] ) : ?>
- <div class="bg-block bg-<?php echo esc_attr( $s )?>">
- <div class="single-desc"><?php echo wp_kses_post( $fields[ $s ] ) ?></div>
- <select name="<?php echo esc_attr( $id . $sep . $s ) ?>" class="bg-<?php echo esc_attr( $s ) ?>">
- <?php foreach ( $options as $val => $opt ) : ?>
- <option value="<?php echo esc_attr( $val ) ?>" <?php selected( $val, $current[ $s ] ) ?>><?php echo esc_html( $opt ) ?></option>
- <?php endforeach ?>
- </select>
- </div>
- <?php endif ?>
- <?php endforeach ?>
- </div>
- </div>
- </div>
|