Grid/List View for WooCommerce Shortcode

Below, you’ll find a detailed guide on how to add the Grid/List View for WooCommerce 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 Grid/List View for WooCommerce Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Grid/List View for WooCommerce Plugin and the shortcodes it provides:

Plugin Icon
Grid/List View for WooCommerce

"Grid/List View for WooCommerce is a dynamic plugin designed to conveniently shift product displays between grid and list views, enhancing your WooCommerce store's user experience."

★★★★✩ (46) Active Installs: 4000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [br_grid_list]

Grid/List View for WooCommerce [br_grid_list] Shortcode

The Gridlist-view-for-WooCommerce plugin shortcode, ‘br_grid_list’, is used to display a widget within a post or page. This shortcode executes the ‘shortcode’ function which initiates the ‘berocket_lgv_widget’ with any passed attributes. The output is then returned for display.

Shortcode: [br_grid_list]

Examples and Usage

Basic example – The shortcode below displays the grid list view of WooCommerce products without any specific parameters.

[br_grid_list /]

Advanced examples

The following shortcode displays the grid list view of WooCommerce products with specific parameters. In this case, the parameters define the product category and number of products to display.

[br_grid_list category="clothing" number="10" /]

In this next example, the shortcode is used to display the grid list view of WooCommerce products with additional parameters. These parameters define the product category, number of products to display, and the order in which they are displayed.

[br_grid_list category="electronics" number="5" order="desc" /]

Lastly, this shortcode example showcases the grid list view of WooCommerce products with parameters defining the product tag, number of products to display, and the order in which they are displayed.

[br_grid_list tag="new-arrival" number="3" order="asc" /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'br_grid_list', array( $this, 'shortcode' ) );

Shortcode PHP function:

function shortcode( $atts = array() ) {
        ob_start();
        the_widget( 'berocket_lgv_widget', $atts );
        $return = ob_get_clean();
        return $return;
    }

Code file location:

gridlist-view-for-woocommerce/gridlist-view-for-woocommerce/main.php

Conclusion

Now that you’ve learned how to embed the Grid/List View for WooCommerce 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 *