PluginProbe
LoginPress | wp-login Custom Login Page Customizer / 1.6.0
LoginPress | wp-login Custom Login Page Customizer v1.6.0
6.2.5 6.2.4 6.2.3 6.2.2 6.2.1 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 1.0.23 1.0.3 1.0.4 All 118 releases
loginpress / classes / controls / background-gallery.php

background-gallery.php in LoginPress | wp-login Custom Login Page Customizer 1.6.0, at classes/controls/background-gallery.php

116 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class for Background Gallery Control.
4 *
5 * @since 1.1.0
6 * @access public
7 */
8
9 // Exit if accessed directly.
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit;
12 }
13
14 // Exit if WP_Customize_Control does not exsist.
15 if ( ! class_exists( 'WP_Customize_Control' ) ) {
16 return null;
17 }
18
19 /**
20 * This class is for the gallery selector in the Customizer.
21 *
22 * @access public
23 */
24 class LoginPress_Background_Gallery_Control extends WP_Customize_Control {
25
26 /**
27 * The control type.
28 *
29 * @access public
30 * @var string
31 */
32 public $type = 'loginpress-gallery';
33
34 /**
35 * Enqueue neccessary custom control scripts.
36 */
37 public function enqueue() {
38
39 // Custom control scripts.
40 // wp_enqueue_script( 'loginpress-gallery-control', LOGINPRESS_DIR_URL . 'js/controls/loginpress-gallery-control.js', array( 'jquery' ), LOGINPRESS_VERSION, true );
41 }
42
43 /**
44 * Displays the control content.
45 *
46 * @since 1.1.0
47 * @access public
48 * @return void
49 */
50 public function render_content() {
51
52 if ( empty( $this->choices ) )
53 return;
54
55 $name = 'loginpress_gallery-' . $this->id; ?>
56
57 <span class="customize-control-title">
58 <?php echo esc_attr( $this->label ); ?>
59 <?php if ( ! empty( $this->description ) ) : ?>
60 <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
61 <?php endif; ?>
62 </span>
63
64 <div id="loginpress-gallery" class="gallery">
65 <?php foreach ( $this->choices as $value ) : ?>
66 <div class="loginpress_gallery_thumbnails">
67 <input id="<?php echo $this->id . esc_attr( $value['id'] ); ?>" class="image-select" type="radio" value="<?php echo esc_attr( $value['id'] ); ?>" name="<?php echo esc_attr( $name ); ?>" <?php $this->link(); checked( $this->value(), $value['id'] ); ?> />
68 <label for="<?php echo $this->id . esc_attr( $value['id'] ); ?>">
69 <div class="gallery_thumbnail_img">
70 <img src="<?php echo $value['thumbnail']; ?>" alt="<?php echo esc_attr( $value['id'] ); ?>" title="<?php echo esc_attr( $value['id'] ); ?>">
71 </div>
72 </label>
73 </div>
74 <?php endforeach; ?>
75 </div>
76
77 <input name='presets_hidden' type="hidden" <?php $this->link(); ?> value="<?php echo $this->value(); ?>" />
78
79 <?php
80 }
81 }
82
83 function loginpress_gallery_control_css() {
84 ?>
85 <style>
86 .loginpress_gallery_thumbnails {
87 width: 33%;
88 float: left;
89 box-sizing: border-box;
90 padding: 4px;
91 }
92 .loginpress_gallery_thumbnails .gallery_thumbnail_img{
93 border-radius: 2px;
94 transition: all .4s;
95 border: 1px solid transparent;
96 }
97 .loginpress_gallery_thumbnails .gallery_thumbnail_img img{
98 border:2px solid #fff;
99 display: block;
100 border-radius: 2px;
101 width: calc(100% - 4px)
102 }
103 .customize-control .loginpress_gallery_thumbnails input[type=radio] {
104 display: none;
105 }
106 .customize-control .loginpress_gallery_thumbnails input[type=radio]:checked + label .gallery_thumbnail_img{
107 border-radius: 2px;
108 border: 1px solid #36bcf2;
109 box-shadow: 0 0 1px #36bcf2;
110 }
111 </style>
112 <?php
113 }
114 add_action( 'customize_controls_print_styles', 'loginpress_gallery_control_css' );
115 ?>
116