Meks Flexible Shortcodes Shortcode

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

Before starting, here is an overview of the Meks Flexible Shortcodes Plugin and the shortcodes it provides:

Plugin Icon
Meks Flexible Shortcodes

"Meks Flexible Shortcodes is a versatile WordPress plugin, enabling users to enhance their website with additional features and functionalities. It simplifies the process of adding complex code snippets to your site."

★★★★✩ (10) Active Installs: 20000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [mks_columns_sc]

Meks Flexible Shortcodes [mks_columns_sc] Shortcode

The ‘mks-flexible-shortcodes’ plugin shortcode is a versatile tool that allows the creation of custom columns in your WordPress content. Using this shortcode, you can add a class, and decide whether to use bootstrap styling. The shortcode takes in these parameters and generates a div with the specified class and content. When bootstrap is enabled, it generates appropriate classes.

Shortcode: [mks_columns_sc]

Parameters

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

  • class – Assigns a custom CSS class to the column
  • bootstrap – Determines if Bootstrap classes should be used

Examples and Usage

Basic example – The shortcode allows you to add a custom class to your column.

[mks_col class="custom-class"]Your content[/mks_col]

Advanced examples

Using the shortcode to create a column with a custom class and bootstrap enabled. If bootstrap is enabled, the plugin will generate bootstrap classes based on the tag.

[mks_col class="custom-class" bootstrap="true"]Your content[/mks_col]

Here’s another advanced example where we’re using nested shortcodes. The outer shortcode creates a column with a custom class and bootstrap enabled. The inner shortcode adds another column inside the first one.

[mks_col class="custom-class" bootstrap="true"][mks_col class="inner-class"]Your inner content[/mks_col]Your outer content[/mks_col]

PHP Function Code

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

Shortcode line:

add_shortcode( 'mks_'.$item, 'mks_columns_sc' );

Shortcode PHP function:

function mks_columns_sc( $atts, $content, $tag ) {

        global $mks_shortcodes_use_bootstrap;
        $defaults = array(
            'class' => '',
            'bootstrap' => false
        );
        $atts = shortcode_atts( $defaults, $atts );
        $class = esc_attr( $atts['class'] );
        $bootstrap = (bool) $atts['bootstrap'];
        
        if( $tag == 'mks_col'){
            $mks_shortcodes_use_bootstrap = $bootstrap;
        }

        if ( $mks_shortcodes_use_bootstrap ) {
            $tag = mks_generate_bootstrap_classes($tag);
        }

        $output = '<div class="'.esc_attr($tag).' '.$class.'">' . do_shortcode( $content ) . '</div>';
        return $output;
    }

Code file location:

meks-flexible-shortcodes/meks-flexible-shortcodes/meks-shortcodes.php

Conclusion

Now that you’ve learned how to embed the Meks Flexible Shortcodes 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 *