Optimize shortcode callbacks
There is a very important programming principle: DRY – Don’t repeat yourself. Whenever you realize you are repeating almost the same job try to write an abstraction. For your pad* shortcodes this means: function get_padding( $atts ) { $args = shortcode_atts( array( ‘num’ => 10 ), $atts ); return str_repeat( ‘ ‘, (int) $args[‘num’] ); … Read more