Which is a better practice when writing shortcodes: pack lots of configuration parameters or just give an id?

It sounds like your function that your shortcode is working with has a lot of parameters that it can take.

In general, I definitely think the better option is to use attributes for each parameter you want to control.

As you know from that tutorial, shortcodes can have default values defined for the variables and use the attributes from the shortcode to override them. This is what I would recommend doing.

You could even create a few different core “styles” to work from that have different default values to start with, and people can customize them how they like. This way, someone could start with a particular style, and then override parameters where necessary instead of requiring every single one to be defined by the shortcode itself.

Check this out:

add_shortcode('my_widget', 'my_widget_shortcode');
function my_widget_shortcode($atts) {

if(!isset($atts['style']))
    $atts['style'] = ''; // if that attribute isn't set, it will throw an error in the switch otherwise

    // define defaults based on style
    switch ($atts['style']) {

        // style="1"
        case 1:
            $defaults = array(
                'color' => 'red',
                'height' => 600,
                'width' => 600,
                );
            break;

        // style="dog"  
        case 'dog':
            $defaults = array(
                'color' => 'green',
                'height' => 400,
                'width' => 600,
                );
            break;

        // style="frisbee"
        case 'frisbee':
            $defaults = array(
                'color' => 'blue',
                'height' => 200,
                'width' => 200,
                );
            break;

        // no style attribute defined or something else that doesn't have a case defined above
        // eg: style="dinosaur"
        default:
            $defaults = array(
                'color' => 'yellow',
                'height' => 800,
                'width' => 500,
                );
    }

    // merge arrays and override defaults with shortcode atts
    extract(shortcode_atts($defaults, $atts));


    // do some stuff

}

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş