Guest User

Untitled

a guest
Feb 21st, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. /**********************
  2.  
  3. 2 *
  4.  
  5. 3 * shortcode handler for columnization of project posts
  6.  
  7. 4 * ex: [leftcol]content here...[/leftcol]
  8.  
  9. 5 */
  10.  
  11. 6 function shortcode_columnize_left( $atts, $content = null ) {
  12.  
  13. 7 $content = wptexturize( $content );
  14.  
  15. 8 $content = wpautop( $content );
  16.  
  17. 9 $content = '<div style="width: 45%; margin-right: 5%; float: left; text-align: justify; ">' . $content . '</div>';
  18.  
  19. 10 return $content;
  20.  
  21. 11 }
  22.  
  23. 12
  24.  
  25. 13 /* columnize right inserts 'clear' div after content */
  26.  
  27. 14 function shortcode_columnize_right( $atts, $content = null ) {
  28.  
  29. 15 $content = wptexturize( $content );
  30.  
  31. 16 $content = wpautop( $content );
  32.  
  33. 17 $content = '<div style="width: 45%; float: left; text-align: justify;">' . $content . '</div><div style="clear: both;"></div>';
  34.  
  35. 18 return $content;
  36.  
  37. 19 }
  38.  
  39. 20 add_shortcode( 'leftcol', 'shortcode_columnize_left' );
  40.  
  41. 21 add_shortcode( 'rightcol', 'shortcode_columnize_right' );
Add Comment
Please, Sign In to add comment