Grid Shortcodes Shortcodes

Below, you’ll find a detailed guide on how to add the Grid Shortcodes Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Grid Shortcodes Plugin shortcodes not to show or not to work correctly.

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

Plugin Icon
Grid Shortcodes

"Grid Shortcodes is a handy WordPress plugin that lets users incorporate stylish and responsive grid layouts in their posts and pages with simple shortcodes. Ideal for organized presentation."

★★★★★ (10) Active Installs: 2000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • []
  • [GDC_column]

Grid Shortcodes [null] Shortcode

The GDC_row shortcode is part of the grid-shortcodes plugin. It’s used to create a new row within your content. The shortcode: [GDC_row] wraps the content in a div with the class “gdc_row”, allowing for custom styling and layout. This shortcode uses regex to identify and handle any preceding or trailing content, ensuring a clean implementation.

Shortcode: [null]

Examples and Usage

Basic example – A simple implementation of the GDC_row shortcode without any parameters.

[GDC_row][/GDC_row]

Advanced examples

Using the GDC_row shortcode to wrap two GDC_column shortcodes. The content within the GDC_column shortcodes will be displayed in two columns within a single row.


[GDC_row]
[GDC_column]Content for column 1[/GDC_column]
[GDC_column]Content for column 2[/GDC_column]
[/GDC_row]

Implementing the GDC_row shortcode to wrap three GDC_column shortcodes. The content within the GDC_column shortcodes will be displayed in three columns within a single row.


[GDC_row]
[GDC_column]Content for column 1[/GDC_column]
[GDC_column]Content for column 2[/GDC_column]
[GDC_column]Content for column 3[/GDC_column]
[/GDC_row]

Please note that the GDC_row shortcode doesn’t support any parameters or attributes. It’s mainly used to wrap GDC_column shortcodes, which will be displayed as columns within a single row.

PHP Function Code

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

Shortcode line:

add_shortcode( 'GDC_row', 'gsc_row_sc' );

Shortcode PHP function:

function gsc_row_sc( $atts, $content = null ) {

  $before_column_regex = '/^(\s*(<p>)*(<\/p>)*(<br \/>)*(<br>)*)*(\[GDC_column)/';
  $mid_column_regex = '/(\[\/GDC_column\])(\s*(<p>)*(<\/p>)*(<br \/>)*(<br>)*)*(\[GDC_column)/';
  $last_column_regex = '/(\[\/GDC_column\])(\s*(<p>)*(<\/p>)*(<br \/>)*(<br>)*)*$/';

  $new_content = trim(strstr($content, '[GDC_'));
  $new_content = preg_replace($before_column_regex, "$6", $new_content);
  $new_content = preg_replace($mid_column_regex, "$1$7", $new_content);
  $new_content = preg_replace($last_column_regex, "$1", $new_content);
  $output = '<div class="gdc_row">' . $new_content . '</div>';

  return do_shortcode($output);

}

Code file location:

grid-shortcodes/grid-shortcodes/gsc.php

Grid Shortcodes [GDC_column] Shortcode

The Grid-Shortcodes plugin shortcode, ‘GDC_column’, is used to create a custom-sized column in a grid layout. ‘GDC_column’ shortcode allows you to specify the size of the column using the ‘size’ attribute. The content within the column is wrapped within a div with class ‘gdc_inner’.

Shortcode: [GDC_column]

Parameters

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

  • size – Determines the width of the column in the grid layout.

Examples and Usage

Basic example – A simple usage of the ‘GDC_column’ shortcode to create a grid column of unspecified size.

[GDC_column size=1 /]

Advanced examples

Creating a grid column with a specified size using the ‘size’ attribute. The size attribute determines the width of the column.

[GDC_column size=3 /]

Creating multiple grid columns with different sizes. This example creates three columns with sizes 2, 3, and 4 respectively.

[GDC_column size=2 /]
[GDC_column size=3 /]
[GDC_column size=4 /]

Embedding content within a grid column. This example creates a column of size 3 and embeds a paragraph of text within it.

[GDC_column size=3]This is some content within a grid column.[/GDC_column]

PHP Function Code

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

Shortcode line:

add_shortcode( 'GDC_column', 'gsc_column_sc' );

Shortcode PHP function:

function gsc_column_sc( $atts, $content = null ) {

    extract( shortcode_atts( array(
        'size' => '',
    ), $atts ) );
    
    $content = '<div class="gdc_column gdc_c'.$size.'"><div class="gdc_inner">'.$content.'</div></div>';

    return do_shortcode($content);

}

Code file location:

grid-shortcodes/grid-shortcodes/gsc.php

Conclusion

Now that you’ve learned how to embed the Grid Shortcodes Plugin shortcodes, 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 *