Giter Site home page Giter Site logo

widget-css-classes's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

widget-css-classes's Issues

Feature Request

Hi, I'd like to be able to import widget class settings via theme level.

Can you provide an example of how this might be done and still allow the user to modify the settings? Would you recommend attaching this to after_theme_setup? Thanks!

update_option( 'WCSSC_options', $options );

[FEATURE REQUEST] - Class Groups

Predefined widget class groups / radio buttons.

I have a set of classes that affect different CSS properties, and would like them to be grouped since they are mutually exclusive:
Group 1 ( text color )

  • text-color--gray
  • text-color--white
  • text-color--black

Group 2 ( background color )

  • background-color--gray
  • background-color--white
  • background-color--black

Group 3 ( text alignment )

  • align--left
  • align--right
  • align--center

It would be great to have 2 additional features with predefined classes:

  1. Specify Groups
  2. Specify radio buttons ( or select )

If I could define Groups in my $theme_classes array like so:

add_filter( 'widget_css_classes_set_settings', 'mytheme_css_classes_default_settings' );
function mytheme_css_classes_default_settings( $settings ) {
    $theme_classes = [
        'group_1' => [
      	  'background-color--gray', 
    	  'background-color--white',
    	  'background-color--black',
        ],
      'group_2' => [
    	'text-color--gray',
    	'text-color--white',
    	'text-color--black', 
      ],
      'group_3' => [
    	'align--left', 
    	'align--right', 
    	'align--center'
      ],
    ];

    // Append your classes.
    $settings['defined_classes'] = array_merge( $settings['defined_classes'], $theme_classes );

    // Or Prepend your classes.
    $settings['defined_classes'] = array_merge( $theme_classes, $settings['defined_classes'] );

    // Allways remove possible duplicates
    $settings['defined_classes'] = array_unique( $settings['defined_classes'] );

    // And return modified settings array
    return $settings;
}

Then on the Widget form, the options within each group would be converted to an array of radio buttons ( or select options ). This would help prevent users from setting more than one background color, etc. They would be able to set 1 background color, 1 text color, 1 alignment, and not have to worry about setting conflicting styles ( which could have unpredictable results ).

A further enhancement could be to add titles to each group:

    $theme_classes = [
        'group_1' => [
          'title' => "Background Color",
          "styles" => [
        	  'background-color--gray', 
        	  'background-color--white',
                  'background-color--black',
           ],
        ],
     ];

And to make it even nicer for users, the classes themselves could be given labels:

    $theme_classes = [
        'group_1' => [
          'title' => "Background Color",
          "styles" => [
        	  'background-color--gray' => 'Gray', 
        	  'background-color--white' => 'White,
                  'background-color--black' => 'Black',
           ],
        ],
     ];

I think this would be a kick ass addition. This feature could even be exposed in the UI.

Conflict with one setting in dFactory Repsonsive Lightbox plugin

Expected Behavior

Custom classes can be added to widgets.

Actual Behavior

Custom classes (text or predefined) do not get written out to html, but are displayed in Widget UI. Even custom widget css classes built into theme no longer work. The standard ones do get written out to html successfully (widget-first, widget-last, etc)

Steps to Reproduce the Problem

  1. Install dFactory Responsive Lightbox plugin v 1.7.2 ( https://wordpress.org/plugins/responsive-lightbox/ )
  2. Goto Plugin Settings, and General Settings tab
  3. Select either "PrettyPhoto" or "Featherlight" as Default Lightbox (only tested with these two and the paid "Lightcase" that I purchased)
  4. Check the box (enable) for "Widgets : Enable lightbox for widgets content."
  5. Click Save at bottom.
  6. Clear browser cache, and reload site to see issue.
  7. Tried deactivating and deleting Widget CSS Classes and reinstalling, but issue persisted.
  8. Disabled Repsonsive Lightbox setting for widget contents to resolve.

Notes

  • I use a page caching plugin, but cleared cache for all test steps.

Specifications

  • Plugin Version: 1.5.2.1
  • WordPress Version: 4.9.1
  • Other plugins installed: many listed in attached image. Issue occurred on installing and configuring Responsive Lightbox
  • Theme: Shaped Pixels v 1.1.2 ( http://shapedpixels.com )
  • Browser: On Mac, tested with current versions of Firefox, Chrome and Safari

plugin-list

Option to fix invalid registered sidebars

Since the code relies on properly registered sidebars with the class and id parameters set it might be a good idea to add an option to let this plugin try and fix the invalid ones.

If the before_widget and after_widget content isn't correct we can add a wrapper div with only this plugin's data.
Only add this as an option in the setting page, not by default.

Readme updates

@cleverness
I'd like to hear your thoughts on the ideas below for the readme file.

  • Plugin website > Move to GitHub Wiki or update website after each update. We can create a website link on the GitHub Wiki.
  • Credits as a list item (more compact)
  • Licence can be removed since there is a licence file within the plugin. All plugins on WP.org are GPL compatible.
  • FAQ
    • Apply correct markup
    • Bug reporting: Change links to GitHub so contributors can help if possible.
    • Add numbers for FAQ questions

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.