Passing variable as add_shortcode argument

There are two solutions: Use the third argument for the shortcode. Use the use keyword. Examples The third parameter for each shortcode callback is the name of the shortcode: foreach ($files1 as $value) { $new_value = substr($value, 0, -4); add_shortcode($new_value, function( $attributes, $content, $shortcode ) { return ‘<img src=”‘ . PATH . L_ITEMS . $shortcode … Read more

Shortcode and whitespace formatting problem

You should give the Attributes Section of the Shortcode API WordPress Codex page a read. Unquoted values also must never contain spaces. Short summary, use quotes – either ” or ‘ – for attribute values with a space in it. Because an attribute name isn’t actually needed I think the »Info« part of your name … Read more