I’ve been trying to create a shortcode with parameters to show me the categories of products. can anybody help me?
]]>Can you post the code you are currently using?
~ Steven
]]>function shortcode_Paramet( $atts ) {
extract( shortcode_atts( array(
‘taxonomy’ => ‘products’
), $atts ) );
$salida='<div>
<div>
<p><span>Taxonomy</span></p>
</div>
</div>’;
return $salida;
}
add_shortcode( ‘shortcode_Param’, ‘shortcode_Paramet’ );
// Taxonomy
function crear_taxonomia() {
register_taxonomy(‘products’, ‘post’, array( ‘hierarchical’ => false, ‘label’ => ‘Products’, ‘query_var’ => true, ‘rewrite’ => true));
}
add_action(‘init’, ‘crear_taxonomia’, 0);
]]>
function shortcode_Paramet( $atts ) {
extract( shortcode_atts( array(
'titulo'=> 'Products',
'taxonomy' => 'product',
'number' => '2'
), $atts ) );
$out='<div>
<div>
<ul>
<li>Título:'.$titulo.'</li>
<li>Taxonomía:'.$taxonomy.'</li>
<li>Number:'.$number.'</li>
</ul>
</div>
</div>';
return $out;
}
add_shortcode( 'details', 'shortcode_Paramet' );
// Taxonomy
function crear_taxonomia() {
register_taxonomy('product', 'post', array( 'hierarchical' => false, 'label' => 'Product', 'query_var' => true, 'rewrite' => true));
}
add_action('init', 'crear_taxonomia', 0);
]]>