Widget CSS Classes

Beschreibung

Mit Widget CSS Classes kannst du eigene CSS-Klassen und CSS-IDs an Widgets anfügen.

Bitte beachte, dass du mit diesem Plugin keinen eigenen CSS-Code einfügen kannst! Du musst die Datei „style.css“ deines Themes bearbeiten oder ein weiteres Plugin benutzen, mit dem du eigenes CSS ergänzen kannst.

Das Plugin ergänzt deine Widgets um weitere Klassen, so dass du sie leichter stylen kannst:

  • widget-first: wird an das erste Widget in der Seitenleiste vergeben
  • widget-last: wird an das letzte Widget in der Seitenleiste vergeben
  • widget-odd: wird an die „ungeraden“ Widgets in der Seitenleiste vergeben
  • widget-even: wird an die „geraden“ Widgets in de Seitenleiste vergeben
  • widget-#: die Widgets werden durchnummeriert, z. B. widget-1, widget-2

Funktionen

  • Ergänzt bei Widgets ein Textfeld, mit dem du eine CSS-Klasse definieren kannst
  • Du kannst mehrere Klassen angeben. Trenne sie einfach durch Leerstellen.
  • Optionally adds checkboxes with predefined classes
  • Optionally adds a text field to add an id to a widget
  • Adds first and last classes to the first and last widget instances in a sidebar
  • Adds even/odd classes to widgets
  • Adds number classes to widgets
  • Vollständig übersetzbar
  • Kompatibel mit WordPress Multisite
  • Kompatibel mit den Plugins „Widget Logic“, „Widget Context“ und „WP Page Widget“
  • Has filters and hooks for customizing output including class names

Plugin Website

Danksagungen

Mitwirkende bei GitHub

Screenshots

  • Ein Standard-Widget
  • Widget with ID field and Predefined Choices
  • Einstellungs-Seite
  • Generiertes HTML

Installation

  1. Upload the folder /widget-css-classes/ to the /wp-content/plugins/ directory
  2. Activate the plugin through the Plugins menu in WordPress
  3. Configure the settings under Settings > Widget CSS Classes
  4. Visit Appearance > Widgets to add or change the custom classes and ids for a widget.
  5. Expand the appropriate widget in the desired sidebar.
  6. You’ll see a field labeled CSS Class. Depending on your settings, this will be a text field and/or checkboxes.
  7. If you are using the text field you can enter multiple class names by separating them with a space.
  8. If you’ve enabled the id field, you will see a text field called CSS ID.

FAQ

Warum tauchen die Klassen nicht in meinem Widget auf?

You need to make sure you have an HTML element defined for before_widget and after_widget in your active theme’s register_sidebar functions,
usually located in your theme’s functions.php (/wp-content/themes/yourtheme/functions.php).

This HTML element must have class and id attributes. This plugin will not work if before_widget and after_widget are blank.

Example:
register_sidebar( array(
'name' => 'Sidebar',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>'
) );

Wie kann ich den CSS-Code für meine eigenen Klassen hinzufügen?

Dazu gibt es zwei Möglichkeiten:

  1. Bearbeite die CSS-Datei deines Themes (normalerweise zu finden in /wp-content/themes/dein-theme/).
  2. Benutze ein Plugin wie z. B. Simple Custom CSS.
Wie kann ich die Einstellungen exportieren?

You can export the Settings from Settings > Widget CSS Classes > Import/Export.

Was soll ich tun, wen ich einen Fehler finde?

Please file a bug report on GitHub.

Rezensionen

März 27, 2019
Very useful plugin! it's a wonder WP core doesn't have such a feature. Support is great also, thanks a lot! ;D
Januar 4, 2019
Great plugin that does what it says and gets out of the way! This is going to become one of those plugins I install on every site I build. Adding arbitrary classes to widgets should really be a core wordpress function IMO, but until then, this is a great solution!
Juli 28, 2018
Thanks so much for this plugin - it doesn't add unwanted cruft/bloat and does what it's intended to do perfectly. To echo some of the other user's sentiment: this is a feature that belongs in WP core.
Lies alle 66 Rezensionen

Mitwirkende & Entwickler

„Widget CSS Classes“ ist Open-Source-Software. Folgende Menschen haben an diesem Plugin mitgewirkt:

Mitwirkende

„Widget CSS Classes“ wurde in 8 Sprachen übersetzt. Danke an die Übersetzerinnen und Übersetzer für ihre Mitwirkung.

Übersetze „Widget CSS Classes“ in deine Sprache.

Interessiert an der Entwicklung?

Durchstöbere den Code, sieh dir das SVN Repository an oder abonniere das Entwicklungsprotokoll per RSS.

Änderungsprotokoll

1.5.3

  • Compatibility: dFactory Responsive Lightbox widget option. #33
  • Getestet mit WordPress 5.0

1.5.2.1

  • i18n: Remove sv_SE translation from the plugin directory. It’s 95% on translate.wordpress.org and accepted as the better version. #23
  • Documentation: Readme & Wiki. #31
  • Kompatibilität: Getestet mit WordPress 4.9

Detailed info: PR on GitHub

1.5.2

  • Enhancement: Make translations of core widget classes optional instead of default. #29
  • Enhancement: Allow vertical resize of defined classes box for CSS3 compatible browsers.

Detailed info: PR on GitHub

1.5.1

  • Fix: Widget Logic widget_content filter compatibility. #27
  • Enhancement: Make uninstall script compatible with network installations.

1.5.0

  • Feature: Option to try and fix the widget parameters if they are invalid. #24
  • Feature: Option to remove duplicate classes. #25
  • Enhancement: Sort classes based on the predefined classes on the frontend by default. #19
  • Enhancement: Classes filter for frontend (for sorting or modifications). #19
    • widget_css_classes: modify all classes added by this plugin.
    • widget_css_classes_custom: modify custom input classes.
  • Enhancement: Plugin settings filter (widget_css_classes_set_settings), overwrites user settings. #16
  • Enhancement: Plugin default settings filter (widget_css_classes_default_settings). #4
  • Enhancement: Capability filters for form fields. #21
    • widget_css_classes_id_input_capability: ID input
    • widget_css_classes_class_input_capability: classes input
    • widget_css_classes_class_select_capability: predefined classes select (also hides classes input if invalid)
  • Compatibility: WP External Links. #17, thanks to Victor @freelancephp
  • Fix: Form wrapper div style. #18, thanks to Chuck Reynolds @ryno267
  • Fix: Enable sortable input selection (IE-11 fix). #20
  • UI: Enhance setting page JavaScript and remove relCopy library dependency.
  • i18n: Remove Dutch and Russian languages from plugin distribution (available on translate.wordpress.org). #23
  • Started using TravisCI and CodeClimate. #15

Detailed info: PR on GitHub

1.4.0

  • Feature: Sort Pre-defined classes (thanks Jory Hogeveen)
  • Security: Prevent unauthenticated import of settings
  • Fix: Notice message when classes is empty (thanks Jory Hogeveen)

1.3.0

  • Feature: Change dropdown to checkboxes for multiple class selection
  • Feature: Option to use both predefined and text input classes
  • Feature: Migrate classes when predefined classes are available
  • Improvement: Do not show previously defined classes that are removed in the settings page when a widget is not updated yet
  • Fix: Only show stored classes if the field-type in the setting page is correct
  • Fix: When predefined is selected, show previous text input classes if they are defined
  • Fix: Ids index notice
  • i18n: Added Dutch translation by Jory Hogeveen at Keraweb
  • i18n: Added Russian translation by Наталия Завьялова
  • i18n: Added Swedish translation by Olle Gustafsson

1.2.9

  • Changed h2 to h1 on settings page
  • Changed plus/minus icons on settings page to dashicons

1.2.8

  • Added text domain to plugin header in preparation for automatic language translations

1.2.7

  • Changed class and ID fields to full-width
  • Added missing escaping from settings page
  • Enqueue admin scripts on correct hook
  • Fixed undefined notice when option was not found

1.2.6

  • Fixed error notice

1.2.5

  • Fixed notice

1.2.4

1.2.3

1.2.2

  • Fix for notice on line 103 when using Widget Logic
  • Tested with WordPress 3.7 beta 1

1.2.1

  • Added Slovak translation by Branco WebHostingGeeks.com
  • Updated Widget Context compatibility fix plus notice fix by Joan Piedra
  • Changed jQuery live to on for 1.9 compatibility

1.2

  • Replace ID with custom ID rather than appending to existing ID
  • Added settings to not show numbered widget classes, first/last classes, and even/odd classes

1.1

  • Added support for Widget Context plugin
  • Fixed notices appearing when Widget Logic plugin was enabled but filter was disabled
  • Added Hide option for the Class Field Type in Settings
  • Don’t show any previously added IDs in front end if Show Additional Field for ID is set to No
  • Don’t show any previously added classes in front end if Class Field Type is set to Hide

1.0

  • Erste Version