Powr Pack Shortcode

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

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

Plugin Icon
Contact Form – Custom Builder, Payment Form, and More

"Contact Form – Custom Builder, Payment Form, and More is a versatile WordPress plugin. Known as 'powr-pack', it lets you create customized contact forms, integrate payment options, and more with ease."

★★★★☆ (58) Active Installs: 3000+ Tested with: 6.0.6 PHP Version: 5.5
Included Shortcodes:
  • [powr-powr-pack]

Powr Pack [powr-powr-pack] Shortcode

The POWR Pack shortcode is a versatile tool that embeds a POWR plugin on your WordPress site. Depending on the attribute provided, it either displays a specific POWR Pack based on its ID or label. If no attribute is given, it simply generates a generic POWR Pack.

Shortcode: [powr-powr-pack]

Parameters

Here is a list of all possible powr-powr-pack shortcode parameters and attributes:

  • id – A unique identifier for the POWr Pack plugin element.
  • label – A distinguishing label for the POWr Pack plugin element.

Examples and Usage

Basic example – Showcases a simple usage of the shortcode where we only pass the id parameter

[powr-powr-pack id='123' /]

Advanced examples

Illustrates the usage of the shortcode with the ‘label’ parameter. The powr-pack will load using the label if the id is not found.

[powr-powr-pack label='myLabel' /]

Demonstrates the shortcode usage without any parameters. In this case, the powr-pack will load with default settings.

[powr-powr-pack /]

Shows the shortcode usage with both ‘id’ and ‘label’ parameters. The powr-pack will first try to load using the id, if not found, it will try to load using the label.

[powr-powr-pack id='123' label='myLabel' /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'powr-powr-pack', 'powr_powr_pack_shortcode' );

Shortcode PHP function:

                    function powr_powr_pack_shortcode( $atts ){
  if(isset($atts['id'])){
    $id = $atts['id'];
    return "<div class='powr-powr-pack' id='$id'></div>";
  }else if(isset($atts['label'])){
    $label = $atts['label'];
    return "<div class='powr-powr-pack' label='$label'></div>";
  }else{
    "<div class='powr-powr-pack'></div>";
  }
}
                    

Code file location:

powr-pack/powr-pack/src/pack.php

Conclusion

Now that you’ve learned how to embed the Powr Pack 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 *