code snippets attributes fail
-
Simple code to pass attributes from shortcode to snippets fails, nothing is sent to the $atts parameter. Shortcode is [fj_testfish count=”home” fred=”fish”]
Code is
function fj_shortparam($attr){
$args = shortcode_atts( array(
‘count’ => ‘not found’
), $attr );$output = count($attr) . ‘ ‘ . $args[‘count’];
return $output;
}function fj_test($atts=[]) {
return ‘ param ‘ . fj_shortparam($atts) . ‘ ‘ . ‘no content’. ‘<br/>’;
}add_shortcode(‘fj_testfish’, function() {
return fj_test();
} );`I am using Flywheel Local. All I want to do is pass a simple parameter to the snippet. I am probably doing something stupid, and I can’t see it.
Help, please lyond@essex.ac.uk
Dave
`
The topic ‘code snippets attributes fail’ is closed to new replies.