Below, you’ll find a detailed guide on how to add the WordPress Picture / Portfolio / Media Gallery 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 WordPress Picture / Portfolio / Media Gallery Plugin shortcode not to show or not to work correctly.
Before starting, here is an overview of the WordPress Picture / Portfolio / Media Gallery Plugin and the shortcodes it provides:
"WordPress Picture / Portfolio / Media Gallery is a versatile plugin that beautifully showcases your images, projects, or media files. With nimble-portfolio, create stunning galleries effortlessly."
- [nimble-portfolio]
WordPress Picture / Portfolio / Media Gallery [nimble-portfolio] Shortcode
The Nimble-Portfolio shortcode is a handy tool that dynamically generates a portfolio display on your WordPress site. This shortcode calls the ‘getPortfolio’ function, which captures and returns the output of the ‘showPortfolio’ function. The ‘showPortfolio’ function takes attributes ($atts) as parameters to customize the portfolio display. The output is then cleaned and returned as content.
Shortcode: [nimble-portfolio]
Examples and Usage
Basic example – In this example, we use the ‘nimble-portfolio’ shortcode without any parameters. This will display the default portfolio as set in the plugin’s settings.
[nimble-portfolio]
Advanced examples
Displaying a specific portfolio by referencing its ID. The portfolio will load based on the provided ID.
[nimble-portfolio id=2]
Using the shortcode to display a portfolio with a specific layout and filter. The portfolio will load with the specified layout and filter.
[nimble-portfolio layout="grid" filter="photography"]
Combining multiple attributes to display a portfolio. In this example, we’re displaying a specific portfolio with a defined layout and filter. The portfolio will first load by ID, but if not found, it will try to load with the specified layout and filter.
[nimble-portfolio id=3 layout="list" filter="graphic-design"]
PHP Function Code
In case you have difficulties debugging what causing issues with [nimble-portfolio]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('nimble-portfolio', array(__CLASS__, 'getPortfolio'));
Shortcode PHP function:
function getPortfolio($atts) {
ob_start();
self::showPortfolio($atts);
$content = ob_get_clean();
return $content;
}
Code file location:
nimble-portfolio/nimble-portfolio/nimble-portfolio.php
Conclusion
Now that you’ve learned how to embed the WordPress Picture / Portfolio / Media Gallery 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