Spreadshop Shortcode

Below, you’ll find a detailed guide on how to add the Spreadshop Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Spreadshop Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Spreadshop Plugin and the shortcodes it provides:

Plugin Icon
Spreadshop Plugin

"Spreadshop Plugin is a highly efficient WordPress tool that seamlessly integrates your Spreadshop into your WordPress site, leveraging eCommerce capabilities."

★★★☆✩ (5) Active Installs: 5000+ Tested with: 5.8.0 PHP Version: false
Included Shortcodes:
  • [spreadshop]

Spreadshop [spreadshop] Shortcode

The Spreadshop shortcode is a unique function in WordPress that embeds a Spreadshop into your site. Upon execution, it checks if it has already run. If not, it includes the ‘spreadshop-embed.php’ file and retrieves a start token. The shortcode then returns the Spreadshop embed, ensuring it only runs once.

Shortcode: [spreadshop]

Examples and Usage

Basic example – The following shortcode is used to embed the Spreadshop without any additional parameters. It’s the simplest way to use the shortcode.

[spreadshop]

PHP Function Code

In case you have difficulties debugging what causing issues with [spreadshop] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('spreadshop', 'spreadshopShortcode');

Shortcode PHP function:

function spreadshopShortcode($atts) {
    // Shortcode may only run one time
    static $already_run = false;
    if (!$already_run) {
        require_once plugin_dir_path(__FILE__) . 'spreadshop-embed.php';
        $startToken = isset($atts['deeplink']) ? $atts['deeplink'] : null;
        return spreadshopEmbed(null, $startToken);
    }
    $already_run = true;
}

Code file location:

spreadshop/spreadshop/spreadshop.php

Conclusion

Now that you’ve learned how to embed the Spreadshop Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *