Below, you’ll find a detailed guide on how to add the Particle Background WP 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 Particle Background WP Plugin shortcode not to show or not to work correctly.
Before starting, here is an overview of the Particle Background WP Plugin and the shortcodes it provides:
- [particle-background-wp]
Particle Background WP [particle-background-wp] Shortcode
The ‘particle-background-wp’ shortcode is a unique identifier that generates a particle background effect on your WordPress site. This shortcode calls the ‘rn_pbwp_shortcode’ function. This function creates a unique ID, applies the particle background effect to it, and returns it as a div element.
Shortcode: [particle-background-wp]
Examples and Usage
Basic Example – The basic usage of the shortcode ‘particle-background-wp’ without any parameters. It generates a unique ID for each particle background.
[particle-background-wp /]
Advanced Examples
Advanced usage of the shortcode ‘particle-background-wp’ is not directly applicable in this case. The function ‘rn_pbwp_shortcode’ does not accept any parameters and generates a unique ID for each particle background. However, you can modify the function to accept parameters. Below is an example of how you can modify the function to accept a ‘color’ parameter:
function rn_pbwp_shortcode( $atts = array() ) {
$atts = shortcode_atts( array(
'color' => 'blue',
), $atts, 'particle-background-wp' );
$id = uniqid ( 'rnpb-' );
rn_pbwp_add_particles_target( '#' . $id, $atts['color'] );
return "";
}
After modifying the function, you can use the shortcode like this to create a particle background with a specific color:
[particle-background-wp color="red" /]
Please note that the above examples are hypothetical and may not work without the corresponding changes in the plugin code.
PHP Function Code
In case you have difficulties debugging what causing issues with [particle-background-wp]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'particle-background-wp', 'rn_pbwp_shortcode' );
Shortcode PHP function:
function rn_pbwp_shortcode( $atts = array() ) {
$id = uniqid ( 'rnpb-' );
rn_pbwp_add_particles_target( '#' . $id );
return "<div id='$id'></div>";
}
Code file location:
particle-background-wp/particle-background-wp/plugin.php
Conclusion
Now that you’ve learned how to embed the Particle Background WP 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.
Leave a Reply