• [ Moved from Requests and Feeedback to Fixing WordPress ]

    I’ve been trying to create a shortcode with parameters to show me the categories of products. can anybody help me?
    In functions.php

    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);
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘See taxonomy with shortcode’ is closed to new replies.