Add to Web Page
1. Shortcode Generator
back to menuFrom your page's main editor, select the Essential Grid icon from the tool bar.
Then from the "Choose Predefined Grid" section toward the top, select your grid from the dropdown list.
Result:
2. PHP Method (advanced)
back to menu- Important Note:
This technique involves editing your theme's page template files, which should only be attempted by experienced users. In the following example, we'll add the grid's shortcode to the TwentySixteen theme's "page.php" file.
Step 1: Grab your grid's shortcode from the plugin's main admin page.
Step 2: Choose to use one of the code variations below.
Add Grid to ALL pages:
1 2 3 4 5 6 7 8 |
<?php // Ess. Grid shortcode is placed inside the "do_shortcode" method, wrapped in single quotes echo do_shortcode('ess_grid alias="masonry_grid_ronald_reagan"]'); ?> |
Add Grid to Homepage only:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<?php // example to add the grid to the homepage only if(is_home()) { // Ess. Grid shortcode is placed inside the "do_shortcode" method, wrapped in single quotes echo do_shortcode('ess_grid alias="masonry_grid_ronald_reagan"]'); } ?> |
Add Grid to a list of certain pages only:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<?php // id's of pages to add the grid to $page_ids = array(535, 716); if(in_array(get_the_ID(), $page_ids, true)) { // Ess. Grid shortcode is placed inside the "do_shortcode" method, wrapped in single quotes echo do_shortcode('[ess_grid alias="masonry_grid_ronald_reagan"]'); } ?> |