Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class My_Custom_Control_Class extends WP_Customize_Control {
- public $type = 'my-custom-control';
- /*
- public function slide_args( $args ) {
- $attachment = get_post( $id );
- $image = $attachment->guid;
- $url = get_post_meta( $id, 'rtslider_link', true );
- $cta = get_post_meta( $id, 'cta_button', true );
- $title = $attachment->post_title;
- $description = $attachment->post_content;
- return $args;
- }
- */
- public function render_content() {
- ?>
- <div class="slider-container">
- <?php if ( $this->label) { ?>
- <span class="customize-control-title"><?php echo esc_html($this->label); ?></span>
- <?php } ?>
- <?php if($this->description){ ?>
- <span class="description customize-control-description">
- <?php echo wp_kses_post($this->description); ?>
- </span>
- <?php } ?>
- <div class="slide_thumbs">
- <?php
- $ids = explode( ',', $this->value() );
- foreach ( $ids as $attachment_id ) {
- if ($attachment_id != '' ) :
- $edit_fields = get_attachment_fields_to_edit( get_post( $attachment_id ) );
- $img = wp_get_attachment_image_src( $attachment_id, 'large' ); ?>
- <div class="slide-image">
- <img src=" <?php echo esc_url( $img[0] ); ?> " data-id=" <?php echo $attachment_id ?> ">
- <div class="slide-title">
- <h3>
- <?php echo $edit_fields['post_title']['label']; ?>
- </h3>
- <?php echo $edit_fields['post_title']['html']; ?>
- </div>
- <div class="slide-description">
- <h3>
- <?php echo $edit_fields['post_content']['label']; ?>
- </h3>
- <?php echo $edit_fields['post_content']['html']; ?>
- </div>
- <div class="slide-url">
- <h3>
- <?php echo $edit_fields['rtslider_link']['label']; ?>
- </h3>
- <?php echo $edit_fields['rtslider_link']['html']; ?>
- </div>
- <div class="slide-url">
- <h3>
- <?php echo $edit_fields['cta_button']['label']; ?>
- </h3>
- <?php echo $edit_fields['cta_button']['html']; ?>
- </div>
- <button type="button" class="button remove_slide_button">Remove Slide</button>
- </div>
- <?php endif;
- }
- ?>
- </div>
- <button type="button" class="button button-primary add_slide_button">Add Slide</button>
- <button type="button" class="button button-primary reset_slide_button">Reset</button>
- <input type="hidden" class="slide_values" <?php echo esc_attr($this->link()) ?> value="<?php echo esc_attr( $this->value() ); ?>">
- </div>
- <?php
- }
- }
Add Comment
Please, Sign In to add comment