StyleBidet

Mô tả

As site designers, developers & owners we all have clients & editors who, even with the best of intentions, can make a hash job of editing a page or a post; for example, making a headline italic, and purple, and Papyrus (despite the site’s overall aesthetic of non-italic cobalt-blue Open Sans everywhere else); or the oft-seen act of making all of the text red & bold so that it all stands out all the time.

What StyleBidet does is subtly take back some of that design control to ensure that sites look the way they were intended to. Via the handy Settings panel, you can optionally set StyleBidet to:

  • Remove inline style attributes when saving & displaying post content;
  • Remove <style> & <font> tags when saving & displaying content;
  • Remove <script> tags when saving & displaying content;
  • Remove the Text Color button from the WordPress Classic/WYSIWYG Editor;
  • New! Remove inline style/font attributes & tags when saving & displaying Advanced Custom Fields.

Cài đặt

To install and run StyleBidet, all you need to do is:

  1. Click New Plugin & search for ‘StyleBidet’, or download and then upload StyleBidet to your /wp-content/plugins/ directory;
  2. Activate the plugin through the Plugins menu in WordPress;
  3. Set up StyleBidet via Settings -> StyleBidet Settings
  4. Alternatively, you can configure StyleBidet with constants – see below.

Configure with constants

Instead of using the super-friendly settings page, you can optionally configure StyleBidet with constants in your code. This can be particularly helpful if you have a client who likes to poke around in the settings, or if you just want to set the options and forget about it.

You can set these in your site’s wp-config.php file or in the active theme’s functions.php file – just remember that if you do the latter and then change the theme, your settings will be lost.

Set StyleBidet’s Settings

You can define any or all of the settings below:

define('VNM_STYLEBIDET_SETTINGS', array(
    'clean_output'      => true,    //  Remove style & font tags & attributes from content at the point it is displayed
    'clean_save'        => true,    //  Permanently remove style & font tags & attributes from content at the point it is saved. 
    'remove_text_color' => true     //  Remove the Text Color button from the TinyMCE editor
));

‘clean_acf’ => true, // Remove style & font tags & attributes from ACF field content

If you have left the Settings page visible (see below), you’ll see a lock icon next to any options you have set in code, and the option can’t be changed. If there are any options that you haven’t pre-set, you can still toggle these on & off and save your settings. If you’ve pre-set all of the options in code, then the Save Settings button will be disabled, and you should probably hide the StyleBidet Settings page at this point.

To set just one option in code, for example:

define('VNM_STYLEBIDET_SETTINGS', array('clean_output' => true));

This will lock the Remove style/font tags & attributes when displaying option to enabled, but leave the rest changeable via the settings page.

Hide StyleBidet’s Settings Page

The following will hide the settings page from wp-admin. This should only be done if you’re adding the VNM_STYLBIDET_SETTINGS constant as above; or after you’ve ensured all of the settings are set & working as expected.

define('VNM_STYLEBIDET_SHOW_SETTINGS', false);

Hỏi đáp

I added StyleBidet, but now all of my fancy styles have disappeared! What’s going on?

If you’re comfortable and happy adding plenty of custom styles to each and every post and page, then this plugin is most definitely not for you. It assumes that your website’s styling really should be taken care of by your theme’s stylesheet, and so ruthlessly removes anything else.

I installed this on a client’s site and now they’re complaining that they can’t make all the text red & purple anymore.

Hopefully this goes without saying, but if you’re thinking of installing this on a client’s site in response to their penchant for creative additions, you really need to check with your client first. This plugin was developed in response to clients making such changes and then realising they’d made a terrible mistake, unintentionally sullying the appearance of a site they’d paid good money to have designed. Always use this plugin responsibly and with client consent.

I installed this on my site and now a bunch of stuff looks weird / isn’t animating / has disappeared.

Similarly to the point above: if you know or suspect that the site has a lot of inline <script> tags in the content for countdown timers, animating SVGs etc. then this plugin may not be the solution for you. Inline <script> tags generally aren’t safe or a great idea, and StyleBidet will clean them out by default if any options are enabled.

The ‘Remove script tags’ button is locked. WTH?

Inline <script> tags generally aren’t safe or a great idea, and StyleBidet will clean them out by default if any options are enabled. Because it does this by default, the Remove script tags option is locked to to ON, mostly just to let you know that it will be removing them.

I want to keep inline styling, but remove inline script tags. How do I do this?

As with the question above: this plugin may not be the solution for you. Inline <script> tags generally aren’t safe or a great idea, and StyleBidet will clean them out by default if any options are enabled.

Does this work with custom post types?

StyleBidet will work with any post type that can either be displayed or saved.

Does this work with Advanced Custom Fields?

It totally does! As of version 1.0.0, StyleBidet can optionally clean out your ACF text, textarea & WYSIWYG fields.

Does this work with Gutenberg and/or Classic Editor?

StyleBidet works with both! It was originally developed with the ‘classic’ WYSIWYG editor, and more recently updated to ensure it works with Gutenberg content.

Đánh giá

9 Tháng Một, 2020
I've used variations on this plugin and this one does what it says on the tin. I have so many wonderful clients, but there are a few that really love (and I mean LOVE) to style their posts in Word before copy/pasting them to their website. And while I do discourage this and try to share how they certainly hired me to make their website a more beautiful place, the lure of lime green Comic Sans is almost too much to bear. StyleBidet has saved me loads of headaches manually removing spans and inline styles. If my client asks why their styling isn't working, I gently let them know that "my stylesheet overrides theirs" to ensure a consistent brand experience for the user. Mostly, it's just StyleBidet. 🙂 You're doing god's work here. Testify. Preach. Etc.
Đọc tất cả 1 đánh giá

Người đóng góp & Lập trình viên

“StyleBidet” là mã nguồn mở. Những người sau đã đóng góp vào plugin này.

Những người đóng góp

Nhật ký thay đổi

1.0.0

  • Removed dependency on htmlLawed and made all cleaning operations native;
  • Added option for cleaning ACF fields

0.6.0

Initial public release of StyleBidet.