Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A very simple shortcode to clear content following aligned images.
<?php
/*
Plugin Name: Clear Aligned Content Shortcode
Description: A way to ensure floated images in page content don't wrap. Use [clear] in editor to push following content below any aligned images.
Author: Mark Root-Wiley
Version: 1.0
Author URI: https://MRWweb.com
Plugin URI: https://gist.githubusercontent.com/mrwweb/f627f3fe407a64293f6a99d701526b94/raw/c0e23d2f5b0252332e4f7c549a2990b4c944cfe1/mrw-clear-shortcode.php
USAGE:
Place "[clear]" on own line in WordPress editor.
Any content on following lines will appear below any previous aligned images.
*/
add_shortcode( 'clear', 'mrw_clear_shortcode' );
function mrw_clear_shortcode() {
return '<span style="display:block !important; clear:both !important; width: 100% !important; height: 1px !important; border: 0 !important; background: transparent !important;"></span>';
}
@mrwweb
Copy link
Author

mrwweb commented Feb 9, 2018

screenshot-1
screenshot-2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment