DevVN Local Store Shortcode

Below, you’ll find a detailed guide on how to add the DevVN Local Store 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 DevVN Local Store Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the DevVN Local Store Plugin and the shortcodes it provides:

Plugin Icon
DevVN Local Store

"DevVN Local Store is a WordPress plugin designed to manage and enhance your online store. It simplifies localization processes, making your e-commerce site user-friendly for all customers."

★★★★★ (5) Active Installs: 2000+ Tested with: 4.9.24 PHP Version: false
Included Shortcodes:
  • [devvn_local_stores]

DevVN Local Store [devvn_local_stores] Shortcode

The Devvn Local Stores shortcode is a powerful tool that allows users to display a list of local stores based on the city. This shortcode takes a ‘city’ attribute and fetches the corresponding stores. It enqueues necessary styles and scripts, then returns the stores list after including the ‘dvls-shortcode.php’ file.

Shortcode: [devvn_local_stores]

Parameters

Here is a list of all possible devvn_local_stores shortcode parameters and attributes:

  • city – Identifier for the specific city to display local stores

Examples and Usage

Basic example – Utilizing the devvn_local_stores shortcode to display stores in a specific city.

[devvn_local_stores city=5 /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'devvn_local_stores', array( $this, 'devvn_local_stores_shortcode') );

Shortcode PHP function:

function devvn_local_stores_shortcode( $atts ){
            $atts = shortcode_atts( array(
                'city' => '',
            ), $atts, 'devvn_local_stores' );

            $city = (isset($atts['city']) && $atts['city']) ? intval($atts['city']) : '';
            wp_enqueue_style('devvn-localstore-style');
            wp_enqueue_script('dvls-google-maps');
            wp_enqueue_script('devvn-localstore-script');
            ob_start();
            include DEVVN_LS_PLUGIN_DIR . 'inc/dvls-shortcode.php';
            return ob_get_clean();
        }

Code file location:

devvn-local-store/devvn-local-store/devvn-local-store.php

Conclusion

Now that you’ve learned how to embed the DevVN Local Store 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 *