acf.php
2 years ago
alignment.php
2 years ago
animation.php
2 years ago
beaver_builder.php
2 years ago
cache.php
2 years ago
classes.php
2 years ago
classic-widgets-screen.php
2 years ago
clone.php
2 years ago
columns.php
2 years ago
dates.php
2 years ago
devices.php
2 years ago
disable_widgets.php
2 years ago
elementor.php
2 years ago
fixed.php
2 years ago
import-export.php
2 years ago
links.php
2 years ago
logic.php
2 years ago
move.php
2 years ago
page-and-post-block.php
2 years ago
permission.php
2 years ago
roles.php
2 years ago
search.php
2 years ago
shortcodes.php
2 years ago
sidebar-more_plugins.php
2 years ago
sidebar-opt_in.php
2 years ago
sidebar-support_box.php
2 years ago
sidebar-upsell_pro.php
2 years ago
siteorigin.php
2 years ago
sliding.php
2 years ago
state.php
2 years ago
styling.php
2 years ago
taxonomies.php
2 years ago
title.php
2 years ago
urls.php
2 years ago
visibility.php
2 years ago
widget-area.php
2 years ago
classes.php
140 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Widget Classes Settings Module |
| 4 | * Settings > Widget Options :: Classes & ID |
| 5 | * |
| 6 | * @copyright Copyright (c) 2016, Jeffrey Carandang |
| 7 | * @since 3.0 |
| 8 | */ |
| 9 | |
| 10 | // Exit if accessed directly |
| 11 | if ( ! defined( 'ABSPATH' ) ) exit; |
| 12 | |
| 13 | /** |
| 14 | * Create Card Module for Widget Classes Options |
| 15 | * |
| 16 | * @since 3.0 |
| 17 | * @global $widget_options |
| 18 | * @return void |
| 19 | */ |
| 20 | if( !function_exists( 'widgetopts_settings_classes' ) ): |
| 21 | function widgetopts_settings_classes(){ |
| 22 | global $widget_options; |
| 23 | $classes = ( isset( $widget_options['settings']['classes'] ) ) ? $widget_options['settings']['classes'] : array(); |
| 24 | $classlists = ( isset( $classes['classlists'] ) && is_array( $classes['classlists'] ) ) ? $classes['classlists'] : array();?> |
| 25 | <li class="widgetopts-module-card <?php echo ( $widget_options['classes'] == 'activate' ) ? 'widgetopts-module-type-enabled' : 'widgetopts-module-type-disabled'; ?>" id="widgetopts-module-card-classes" data-module-id="classes"> |
| 26 | <div class="widgetopts-module-card-content"> |
| 27 | <h2><?php _e( 'Classes & ID', 'widget-options' );?></h2> |
| 28 | <p class="widgetopts-module-desc"> |
| 29 | <?php _e( 'Assign custom css classes and ID on each widgets for element targeting.', 'widget-options' );?> |
| 30 | </p> |
| 31 | |
| 32 | <div class="widgetopts-module-actions hide-if-no-js"> |
| 33 | <?php if( $widget_options['classes'] == 'activate' ){ ?> |
| 34 | <button class="button button-secondary widgetopts-toggle-settings"><?php _e( 'Configure Settings', 'widget-options' );?></button> |
| 35 | <button class="button button-secondary widgetopts-toggle-activation"><?php _e( 'Disable', 'widget-options' );?></button> |
| 36 | <?php }else{ ?> |
| 37 | <button class="button button-secondary widgetopts-toggle-settings"><?php _e( 'Learn More', 'widget-options' );?></button> |
| 38 | <button class="button button-primary widgetopts-toggle-activation"><?php _e( 'Enable', 'widget-options' );?></button> |
| 39 | <?php } ?> |
| 40 | |
| 41 | </div> |
| 42 | |
| 43 | </div> |
| 44 | |
| 45 | <?php widgetopts_modal_start( $widget_options['classes'] ); ?> |
| 46 | <span class="dashicons widgetopts-dashicons widgetopts-no-top dashicons-admin-generic"></span> |
| 47 | <h3 class="widgetopts-modal-header"><?php _e( 'Classes & ID', 'widget-options' );?></h3> |
| 48 | <p> |
| 49 | <?php _e( 'Custom alignment widget options will allow you to assign different content alignments for each widgets on specific devices. You can choose whether you want them to be left, right, justify or centered aligned on desktop, tablet or mobile devices.', 'widget-options' );?> |
| 50 | </p> |
| 51 | <table class="form-table widgetopts-settings-section"> |
| 52 | <tr> |
| 53 | <th scope="row"> |
| 54 | <label for="widgetopts-classes-id"><?php _e( 'Show ID Field', 'widget-options' );?></label> |
| 55 | </th> |
| 56 | <td> |
| 57 | <input type="checkbox" id="widgetopts-classes-id" name="classes[id]" <?php echo widgetopts_is_checked( $classes, 'id' ) ?> value="1" /> |
| 58 | <label for="widgetopts-classes-id"><?php _e( 'Enable ID Field', 'widget-options' );?></label> |
| 59 | <p class="description"> |
| 60 | <?php _e( 'Allow user to add custom ID on each widgets. ', 'widget-options' );?> |
| 61 | </p> |
| 62 | </td> |
| 63 | </tr> |
| 64 | <tr> |
| 65 | <th scope="row"> |
| 66 | <label><?php _e( 'Classes Field Type', 'widget-options' );?></label> |
| 67 | </th> |
| 68 | <td> |
| 69 | <label for="widgetopts-classes-class-text"> |
| 70 | <input type="radio" value="text" id="widgetopts-classes-class-text" name="classes[type]" <?php if( isset( $classes['type'] ) && 'text' == $classes['type'] ){ echo 'checked="checked"'; }?> /><?php _e( 'Text Field', 'widget-options' );?> |
| 71 | </label> |
| 72 | |
| 73 | <label for="widgetopts-classes-class-predefined"> |
| 74 | <input type="radio" value="predefined" id="widgetopts-classes-class-predefined" name="classes[type]" <?php if( isset( $classes['type'] ) && 'predefined' == $classes['type'] ){ echo 'checked="checked"'; }?> /><?php _e( 'Predefined Class Checkboxes', 'widget-options' );?> |
| 75 | </label> |
| 76 | |
| 77 | <label for="widgetopts-classes-class-both"> |
| 78 | <input type="radio" value="both" id="widgetopts-classes-class-both" name="classes[type]" <?php if( isset( $classes['type'] ) && 'both' == $classes['type'] ){ echo 'checked="checked"'; }?> /><?php _e( 'Both', 'widget-options' );?> |
| 79 | </label> |
| 80 | |
| 81 | <label for="widgetopts-classes-class-hide"> |
| 82 | <input type="radio" value="hide" id="widgetopts-classes-class-hide" name="classes[type]" <?php if( isset( $classes['type'] ) && 'hide' == $classes['type'] ){ echo 'checked="checked"'; }?> /><?php _e( 'Hide', 'widget-options' );?> |
| 83 | </label> |
| 84 | <p class="description"> |
| 85 | <?php _e( 'Select which field type you want to manage each widget classes option.', 'widget-options' );?> |
| 86 | </p> |
| 87 | </td> |
| 88 | </tr> |
| 89 | <tr> |
| 90 | <th scope="row"> |
| 91 | <label for="widgetopts-classes-auto"><?php _e( 'Remove .widget Class', 'widget-options' );?></label> |
| 92 | </th> |
| 93 | <td> |
| 94 | <input type="checkbox" id="widgetopts-classes-auto" name="classes[auto]" <?php echo widgetopts_is_checked( $classes, 'auto' ) ?> value="1" /> |
| 95 | <label for="widgetopts-classes-auto"><?php _e( 'Disable Additional Class', 'widget-options' );?></label> |
| 96 | <p class="description"> |
| 97 | <?php _e( 'Check this box if you want to disable the automatic addition of .widget class', 'widget-options' );?> |
| 98 | </p> |
| 99 | </td> |
| 100 | </tr> |
| 101 | </table> |
| 102 | <div class="widgetopts-settings-section"> |
| 103 | <h4><?php _e( 'Predefined Classes', 'widget-options' );?></h4> |
| 104 | <p><?php _e( 'Set a class lists that you want to be available as pre-choices on the Class/ID Widget Options tab.', 'widget-options' );?></p> |
| 105 | |
| 106 | <div id="opts-predefined-classes"> |
| 107 | <ul> |
| 108 | <li class="opts-hidden-placeholder"></li> |
| 109 | <?php |
| 110 | if( !empty( $classlists ) && is_array( $classlists ) ){ |
| 111 | $classlists = array_unique( $classlists ); |
| 112 | foreach ($classlists as $key => $value) { |
| 113 | echo '<li><input type="hidden" name="classes[classlists][]" value="'. $value .'" /><span class"opts-li-value">'. $value .'</span> <a href="#" class="opts-remove-class-btn"><span class="dashicons dashicons-dismiss"></span></a></li>'; |
| 114 | } |
| 115 | } |
| 116 | ?> |
| 117 | </ul> |
| 118 | </div> |
| 119 | |
| 120 | <table class="form-table"> |
| 121 | <tbody> |
| 122 | <tr valign="top"> |
| 123 | <td scope="row" valign="middle"> |
| 124 | <input type="text" class="regular-text code opts-add-class-txtfld" /> |
| 125 | <a href="#" class="opts-add-class-btn widgetopts-add-class-btn"><span class="dashicons dashicons-plus-alt"></span></a><br /> |
| 126 | <small><em><?php _e( 'Note: Click the Plus icon to add the class.', 'widget-options' );?></em></small> |
| 127 | </td> |
| 128 | </tr> |
| 129 | </tbody> |
| 130 | </table> |
| 131 | </div> |
| 132 | <?php widgetopts_modal_end( $widget_options['classes'] ); ?> |
| 133 | |
| 134 | </li> |
| 135 | <?php |
| 136 | } |
| 137 | add_action( 'widgetopts_module_cards', 'widgetopts_settings_classes', 50 ); |
| 138 | endif; |
| 139 | ?> |
| 140 |