Exemple #1
0
        /**
         * Settings page output
         */
        public function create_admin_page()
        {
            ?>

			<div class="wrap wpex-skins-admin">

				<h2>Theme Skins</h2>

				<?php 
            // Check if admin is enabled
            $notice = apply_filters('wpex_skins_deprecated_notice', true);
            // Display notice
            if ($notice) {
                ?>

					<div class="notice error" style="display:block!important;padding:20px;">
						<h4 style="margin:0 0 10px;font-size:16px;">Important Notice</h4>
						<p>Skins have been deprecated since Total 3.0.0. The theme has enough settings to allow you to create a design that fits your needs without loading extra bloat. If you select the "base" skin this admin panel will be removed and you will see an error message. To re-enable please visit the online snippets for this theme.</p>
						<p>We highly recommend you select the BASE skin and make all your edits via the Customizer to get the design you want or use a child theme (both are more optimized methods).</p>
					</div>

				<?php 
            }
            // Get skins array
            $skins = WPEX_Skin_Loader::skins_array();
            // Current skin from site_theme option
            $current_skin = wpex_active_skin();
            // Get fallback from redux
            if (!$current_skin) {
                $data = get_option('wpex_options');
                $current_skin = isset($data['site_theme']) ? $data['site_theme'] : 'base';
            }
            ?>

				<form method="post" action="options.php">

					<?php 
            settings_fields('wpex_skins_options');
            ?>

					<div class="wpex-skins-select theme-browser" id="theme_skin">

						<?php 
            // Loop through skins
            foreach ($skins as $key => $val) {
                $classes = 'wpex-skin theme';
                $checked = $active = '';
                if (!empty($current_skin) && $current_skin == $key) {
                    $checked = 'checked';
                    $classes .= ' active';
                }
                ?>

						<div class="<?php 
                echo $classes;
                ?>
">

							<input type="radio" id="wpex-skin-<?php 
                echo $key;
                ?>
" name="theme_skin" value="<?php 
                echo $key;
                ?>
" <?php 
                echo $checked;
                ?>
 class="wpex-skin-radio" />

							<?php 
                if (!empty($val['screenshot'])) {
                    ?>

								<div class="theme-screenshot">
									<img src="<?php 
                    echo esc_url($val['screenshot']);
                    ?>
" alt="Screenshot" />
								</div>

							<?php 
                } elseif (function_exists('wpex_placeholder_img_src')) {
                    ?>

								<div class="theme-screenshot">
									<img src="<?php 
                    echo wpex_placeholder_img_src();
                    ?>
" />
								</div>

							<?php 
                }
                ?>

							<h3 class="theme-name">
								<?php 
                if ('active' == $active) {
                    echo '<strong>Active:</strong> ';
                }
                ?>
								<?php 
                echo $val['name'];
                ?>
							</h3>

						</div>
						
						<?php 
            }
            ?>

					</div><!-- .wpex-skin -->

					<?php 
            submit_button();
            ?>

				</form>

			</div><!-- .wpex-skins-select -->

			<script type="text/javascript">
				( function($) {
					"use strict";
					$( '.wpex-skin' ).click( function() {
						$( '.wpex-skin' ).removeClass( 'active' );
						$( this ).addClass( 'active' );
						var radio = $(this).find( '.wpex-skin-radio' );
						radio.prop( 'checked', true );
						event.preventDefault();
					} );
				} ) ( jQuery );
			</script>

		<?php 
        }