Advertisement
Guest User

Untitled

a guest
Aug 20th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. <?php
  2.  
  3. add_shortcode('clearfix', 'clearfix_shortcode');
  4.  
  5. function clearfix_shortcode($args = []) {
  6. $args_lc = array_map('strtolower', (array)$args);
  7. if (array_search('left', $args_lc) !== false) {
  8. $direction = 'left';
  9. }
  10. else if (array_search('right', $args_lc) !== false) {
  11. $direction = 'right';
  12. }
  13. else {
  14. $direction = 'both';
  15. }
  16. return '<div style="display:block;visibility:hidden;height:0;clear:' . $direction . ';"></div>';
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement