I am currently creating a shortcode in order to display custom taxonomy terms as a list in my template :
// First we create a function
function list_terms_forme_juridique_taxonomy( $atts ) {
// Inside the function we extract custom taxonomy parameter of our
shortcode
extract( shortcode_atts( array(
'custom_taxonomy' => 'forme_juridique',
),
$atts ) );
// arguments for function wp_list_categories
$args = array(
taxonomy => $custom_taxonomy,
title_li => ''
);
// We wrap it in unordered list
echo '<ul>';
echo wp_list_categories($args);
echo '</ul>';
}
// Add a shortcode that executes our function
add_shortcode( 'forme_juridique', 'list_terms_forme_juridique_taxonomy'
);
I run in the 2 following issues :
- The shortcode (render) is displayed at the top of my page, not where I've placed it in the page;
- PHP Console flag the 2 followings errores :
- Use of undefined constant taxonomy - assumed 'taxonomy'
- Use of undefined constant title_li - assumed 'title_li'
Any help appreciated!
Thanks