Create shortcode with parameter wordpress

Here is the code

First step create shortcode function

function portfolio() {
 return get_home_url();
add_shortcode('portfolio', 'portfolio');

Create parameter

function portfolio($atts) {
 $attributes = shortcode_atts( array(
        'perpage' => -1 
    ), $atts );
 return $attributes ['perpage']; 
add_shortcode('portfolio', 'portfolio');


[portfolio perpage='10']

Related Post

Latest Post

Recent Posts Widget

Make sure to never miss a thing...

Get the latest news from the creative industry along with other creative goodies, conveniently delivered to social media.