Slider Revolution WP
09.06.2016
In order for this to work, first create a grid from within the plugin’s main admin. This will essentially be used as a “settings grid”, where the settings from the grid will be used, but the actual post source of the grid will be auto-generated via PHP.
Next, decide where you’re going to add the PHP code. This will depend on where you want the grid to show up on any given one of your web pages. As a proof of concept, you can switch to the TwentyFifteen theme, and then add the code to the very bottom of TwentyFifteen’s “header.php” file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
// the "Alias" name from the grid you created within the plugin's main admin // this will be used as the "settings template" for the auto-generated grid $esg_alias = 'my-grid'; $esg_list = array(); $esg_args = array( 'post_type' => 'post' ); $esg_loop = new WP_Query( $esg_args ); while ( $esg_loop->have_posts() ) : $esg_loop->the_post(); $esg_list[] = get_the_id(); endwhile; echo do_shortcode( '[ess_grid alias="' . $esg_alias . '" posts="' . implode( ',', $esg_list ) . '"]' ); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
// the "Alias" name from the grid you created within the plugin's main admin // this will be used as the "settings template" for the auto-generated grid $esg_alias = 'my-grid'; $esg_list = array(); $esg_args = array( 'post_type' => 'page' ); $esg_loop = new WP_Query( $esg_args ); while ( $esg_loop->have_posts() ) : $esg_loop->the_post(); $esg_list[] = get_the_id(); endwhile; echo do_shortcode( '[ess_grid alias="' . $esg_alias . '" posts="' . implode( ',', $esg_list ) . '"]' ); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
// the "Alias" name from the grid you created within the plugin's main admin // this will be used as the "settings template" for the auto-generated grid $esg_alias = 'my-grid'; $esg_list = array(); // where "essential_grid" is the slug of the Custom Post Type $esg_args = array( 'post_type' => 'essential_grid' ); $esg_loop = new WP_Query( $esg_args ); while ( $esg_loop->have_posts() ) : $esg_loop->the_post(); $esg_list[] = get_the_id(); endwhile; echo do_shortcode( '[ess_grid alias="' . $esg_alias . '" posts="' . implode( ',', $esg_list ) . '"]' ); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
// the "Alias" name from the grid you created within the plugin's main admin // this will be used as the "settings template" for the auto-generated grid $esg_alias = 'my-grid'; $esg_list = array(); $esg_args = array( 'post_type' => 'any' ); $esg_loop = new WP_Query( $esg_args ); while ( $esg_loop->have_posts() ) : $esg_loop->the_post(); $esg_list[] = get_the_id(); endwhile; echo do_shortcode( '[ess_grid alias="' . $esg_alias . '" posts="' . implode( ',', $esg_list ) . '"]' ); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
// Where the grid would be added to the page with ID "23" if( get_the_ID() == '23' ) { // the "Alias" name from the grid you created within the plugin's main admin // this will be used as the "settings template" for the auto-generated grid $esg_alias = 'my-grid'; $esg_list = array(); $esg_args = array( 'post_type' => 'post' ); $esg_loop = new WP_Query( $esg_args ); while ( $esg_loop->have_posts() ) : $esg_loop->the_post(); $esg_list[] = get_the_id(); endwhile; echo do_shortcode( '[ess_grid alias="' . $esg_alias . '" posts="' . implode( ',', $esg_list ) . '"]' ); } |