blocks
3 years ago
class-do-css.php
3 years ago
class-dynamic-content.php
3 years ago
class-enqueue-css.php
3 years ago
class-legacy-attributes.php
4 years ago
class-plugin-update.php
5 years ago
class-query-loop.php
3 years ago
class-render-blocks.php
3 years ago
class-rest.php
3 years ago
class-settings.php
4 years ago
dashboard.php
3 years ago
defaults.php
3 years ago
functions.php
3 years ago
general.php
3 years ago
dashboard.php
330 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Our admin Dashboard. |
| 4 | * |
| 5 | * @package GenerateBlocks |
| 6 | */ |
| 7 | |
| 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | exit; // Exit if accessed directly. |
| 10 | } |
| 11 | |
| 12 | add_action( 'admin_menu', 'generateblocks_register_dashboard', 9 ); |
| 13 | /** |
| 14 | * Register our Dashboard page. |
| 15 | * |
| 16 | * @since 0.1 |
| 17 | */ |
| 18 | function generateblocks_register_dashboard() { |
| 19 | $dashboard = add_menu_page( |
| 20 | __( 'GenerateBlocks', 'generateblocks' ), |
| 21 | __( 'GenerateBlocks', 'generateblocks' ), |
| 22 | 'manage_options', |
| 23 | 'generateblocks', |
| 24 | 'generateblocks_do_dashboard' |
| 25 | ); |
| 26 | |
| 27 | add_submenu_page( |
| 28 | 'generateblocks', |
| 29 | __( 'Dashboard', 'generateblocks' ), |
| 30 | __( 'Dashboard', 'generateblocks' ), |
| 31 | 'manage_options', |
| 32 | 'generateblocks' |
| 33 | ); |
| 34 | |
| 35 | add_action( "admin_print_styles-$dashboard", 'generateblocks_enqueue_dashboard_scripts' ); |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Add our Dashboard-specific scripts. |
| 40 | * |
| 41 | * @since 1.0.0 |
| 42 | */ |
| 43 | function generateblocks_enqueue_dashboard_scripts() { |
| 44 | wp_enqueue_style( |
| 45 | 'generateblocks-dashboard', |
| 46 | GENERATEBLOCKS_DIR_URL . 'assets/css/dashboard.css', |
| 47 | array(), |
| 48 | GENERATEBLOCKS_VERSION |
| 49 | ); |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Get a list of our Dashboard pages. |
| 54 | * |
| 55 | * @since 1.2.0 |
| 56 | */ |
| 57 | function generateblocks_get_dashboard_pages() { |
| 58 | return apply_filters( |
| 59 | 'generateblocks_dashboard_screens', |
| 60 | array( |
| 61 | 'toplevel_page_generateblocks', |
| 62 | 'generateblocks_page_generateblocks-settings', |
| 63 | ) |
| 64 | ); |
| 65 | } |
| 66 | |
| 67 | add_filter( 'admin_body_class', 'generateblocks_set_admin_body_classes' ); |
| 68 | /** |
| 69 | * Add admin body classes when needed. |
| 70 | * |
| 71 | * @since 1.2.0 |
| 72 | * @param string $classes The existing classes. |
| 73 | */ |
| 74 | function generateblocks_set_admin_body_classes( $classes ) { |
| 75 | $dashboard_pages = generateblocks_get_dashboard_pages(); |
| 76 | $current_screen = get_current_screen(); |
| 77 | |
| 78 | if ( in_array( $current_screen->id, $dashboard_pages ) ) { |
| 79 | $classes .= ' generateblocks-dashboard-page'; |
| 80 | } |
| 81 | |
| 82 | return $classes; |
| 83 | } |
| 84 | |
| 85 | add_action( 'in_admin_header', 'generateblocks_do_dashboard_headers' ); |
| 86 | /** |
| 87 | * Add our Dashboard headers. |
| 88 | * |
| 89 | * @since 1.3.0 |
| 90 | */ |
| 91 | function generateblocks_do_dashboard_headers() { |
| 92 | $dashboard_pages = generateblocks_get_dashboard_pages(); |
| 93 | $current_screen = get_current_screen(); |
| 94 | |
| 95 | if ( in_array( $current_screen->id, $dashboard_pages ) ) { |
| 96 | generateblocks_do_dashboard_header(); |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | add_action( 'admin_enqueue_scripts', 'generateblocks_enqueue_global_dashboard_scripts' ); |
| 101 | /** |
| 102 | * Add our scripts to the page. |
| 103 | * |
| 104 | * @since 0.1 |
| 105 | */ |
| 106 | function generateblocks_enqueue_global_dashboard_scripts() { |
| 107 | wp_enqueue_style( |
| 108 | 'generateblocks-dashboard-global', |
| 109 | GENERATEBLOCKS_DIR_URL . 'assets/css/dashboard-global.css', |
| 110 | array(), |
| 111 | GENERATEBLOCKS_VERSION |
| 112 | ); |
| 113 | |
| 114 | $dashboard_pages = generateblocks_get_dashboard_pages(); |
| 115 | $current_screen = get_current_screen(); |
| 116 | |
| 117 | if ( in_array( $current_screen->id, $dashboard_pages ) ) { |
| 118 | wp_enqueue_style( |
| 119 | 'generateblocks-settings-build', |
| 120 | GENERATEBLOCKS_DIR_URL . 'dist/dashboard.css', |
| 121 | array( 'wp-components' ), |
| 122 | GENERATEBLOCKS_VERSION |
| 123 | ); |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Build our Dashboard menu. |
| 129 | */ |
| 130 | function generateblocks_dashboard_navigation() { |
| 131 | $screen = get_current_screen(); |
| 132 | |
| 133 | $tabs = apply_filters( |
| 134 | 'generateblocks_dashboard_tabs', |
| 135 | array( |
| 136 | 'dashboard' => array( |
| 137 | 'name' => __( 'Dashboard', 'generateblocks' ), |
| 138 | 'url' => admin_url( 'admin.php?page=generateblocks' ), |
| 139 | 'class' => 'toplevel_page_generateblocks' === $screen->id ? 'active' : '', |
| 140 | ), |
| 141 | 'settings' => array( |
| 142 | 'name' => __( 'Settings', 'generateblocks' ), |
| 143 | 'url' => admin_url( 'admin.php?page=generateblocks-settings' ), |
| 144 | 'class' => 'generateblocks_page_generateblocks-settings' === $screen->id ? 'active' : '', |
| 145 | ), |
| 146 | ) |
| 147 | ); |
| 148 | |
| 149 | // Don't print any markup if we only have one tab. |
| 150 | if ( count( $tabs ) === 1 ) { |
| 151 | return; |
| 152 | } |
| 153 | ?> |
| 154 | <div class="gblocks-navigation"> |
| 155 | <?php |
| 156 | foreach ( $tabs as $tab ) { |
| 157 | printf( |
| 158 | '<a href="%1$s" class="%2$s">%3$s</a>', |
| 159 | esc_url( $tab['url'] ), |
| 160 | esc_attr( $tab['class'] ), |
| 161 | esc_html( $tab['name'] ) |
| 162 | ); |
| 163 | } |
| 164 | ?> |
| 165 | </div> |
| 166 | <?php |
| 167 | } |
| 168 | |
| 169 | /** |
| 170 | * Build our Dashboard header. |
| 171 | * |
| 172 | * @since 1.2.0 |
| 173 | */ |
| 174 | function generateblocks_do_dashboard_header() { |
| 175 | ?> |
| 176 | <div class="gblocks-dashboard-header"> |
| 177 | <div class="gblocks-dashboard-header-title"> |
| 178 | <h1> |
| 179 | <svg aria-hidden="true" role="img" xmlns="http://www.w3.org/2000/svg" x="0" y="0" viewBox="0 0 50 60.12" xml:space="preserve"><path class="st0" d="M6.686 31.622V18.918a.077.077 0 01.05-.072l6.5-2.313 6.5-2.313 9.682-3.445L39.1 7.33a.067.067 0 00.036-.028.074.074 0 00.014-.044V.076a.077.077 0 00-.032-.062.076.076 0 00-.069-.009l-13 4.625-13 4.625-6.5 2.313-6.5 2.313a.067.067 0 00-.036.028.097.097 0 00-.013.046V52.067c0 .026.013.048.032.062s.044.018.069.009l3.267-1.163 3.267-1.163c.015-.005.028-.015.036-.028s.014-.028.014-.044V37.999l.001-6.377c-.001 0 0 0 0 0z"/><path class="st0" d="M23.949 29.976l13-4.625 13-4.625c.015-.005.028-.015.036-.028s.015-.028.015-.044V8.056a.077.077 0 00-.032-.062.076.076 0 00-.069-.009l-13 4.625-13 4.625-6.5 2.313-6.5 2.313a.067.067 0 00-.036.028.074.074 0 00-.014.044V60.045c0 .026.013.048.032.062a.076.076 0 00.069.009l6.475-2.304 6.475-2.304 6.525-2.322 6.525-2.322 6.5-2.313 6.5-2.313c.015-.005.028-.015.036-.028s.014-.025.014-.041V27.193a.077.077 0 00-.032-.062.076.076 0 00-.069-.009l-6.45 2.295L37 31.711a.067.067 0 00-.036.028.074.074 0 00-.014.044v6.272a.077.077 0 01-.05.072l-6.45 2.295L24 42.715a.075.075 0 01-.101-.071V30.046c0-.016.005-.031.014-.044a.08.08 0 01.036-.026z"/></svg> |
| 180 | <?php echo esc_html( get_admin_page_title() ); ?> |
| 181 | </h1> |
| 182 | </div> |
| 183 | |
| 184 | <?php generateblocks_dashboard_navigation(); ?> |
| 185 | </div> |
| 186 | <?php |
| 187 | } |
| 188 | |
| 189 | /** |
| 190 | * Output our Dashboard HTML. |
| 191 | * |
| 192 | * @since 0.1 |
| 193 | */ |
| 194 | function generateblocks_do_dashboard() { |
| 195 | ?> |
| 196 | <div class="wrap gblocks-dashboard-wrap"> |
| 197 | <div class="gblocks-dashboard-intro-content"> |
| 198 | <?php esc_html_e( 'A small collection of lightweight WordPress blocks that can accomplish nearly anything.', 'generateblocks' ); ?> |
| 199 | |
| 200 | <div class="gblocks-sub-navigation"> |
| 201 | <a class="button" href="https://generateblocks.com" target="_blank" rel="noreferrer noopener"><?php esc_html_e( 'Learn More', 'generateblocks' ); ?></a> |
| 202 | <a class="button" href="https://docs.generateblocks.com" target="_blank" rel="noreferrer noopener"><?php esc_html_e( 'Documentation', 'generateblocks' ); ?></a> |
| 203 | |
| 204 | <?php if ( ! function_exists( 'generateblocks_pro_init' ) ) : ?> |
| 205 | <a class="button primary" href="https://generateblocks.com/pro" target="_blank" rel="noreferrer noopener"><?php esc_html_e( 'GenerateBlocks Pro', 'generateblocks' ); ?></a> |
| 206 | <?php endif; ?> |
| 207 | </div> |
| 208 | </div> |
| 209 | |
| 210 | <div class="gblocks-dashboard-content-container"> |
| 211 | <div class="gblocks-dashboard-blocks"> |
| 212 | <div class="gblocks-block"> |
| 213 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" className="gblocks-block-icon"><path className="gblocks-svg-icon-box" d="M0 0h24v24H0z" /><path d="M21.375 22h-3.75v-1.25h3.125v-3.125H22v3.75c0 .345-.28.625-.625.625zM9.188 20.75h5.625V22H9.188zM6.375 22h-3.75A.625.625 0 0 1 2 21.375v-3.75h1.25v3.125h3.125V22zM2 9.187h1.25v5.625H2zm1.25-2.812H2v-3.75C2 2.28 2.28 2 2.625 2h3.75v1.25H3.25v3.125zM9.188 2h5.625v1.25H9.188zM22 6.375h-1.25V3.25h-3.125V2h3.75c.345 0 .625.28.625.625v3.75zm-1.25 2.812H22v5.625h-1.25z" /></svg> |
| 214 | |
| 215 | <h3><?php esc_html_e( 'Container', 'generateblocks' ); ?></h3> |
| 216 | <p><?php esc_html_e( 'Organize your content into rows and sections.', 'generateblocks' ); ?></p> |
| 217 | |
| 218 | <div class="gblocks-block-learn-more"> |
| 219 | <a class="button" href="https://docs.generateblocks.com/collection/container/" target="_blank" rel="noreferrer noopener"><?php esc_html_e( 'Container Documentation', 'generateblocks' ); ?></a> |
| 220 | </div> |
| 221 | </div> |
| 222 | |
| 223 | <div class="gblocks-block"> |
| 224 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" className="gblocks-block-icon"><path className="gblocks-svg-icon-box" d="M0 0h24v24H0z" /><path d="M21.375 10.755h-4.689a.625.625 0 0 1-.625-.625V2.625c0-.345.28-.625.625-.625h4.689a.624.624 0 0 1 .625.625v7.505c0 .345-.28.625-.625.625zm-4.064-1.251h3.44V3.25h-3.44v6.254zm-4.474 1.251H2.625A.625.625 0 0 1 2 10.13V2.625C2 2.28 2.28 2 2.625 2h10.212c.345 0 .625.28.625.625v7.505a.626.626 0 0 1-.625.625zM3.249 9.504h8.963V3.25H3.249v6.254zm4.064 12.497H2.625A.625.625 0 0 1 2 21.375V13.87c0-.345.28-.625.625-.625h4.688c.345 0 .625.28.625.625v7.505a.627.627 0 0 1-.625.626zM3.249 20.75h3.439v-6.255H3.249v6.255zm18.126 1.251H11.162a.625.625 0 0 1-.625-.625V13.87c0-.345.28-.625.625-.625h10.213c.345 0 .625.28.625.625v7.505c0 .346-.28.626-.625.626zm-9.588-1.251h8.964v-6.255h-8.964v6.255z" /></svg> |
| 225 | |
| 226 | <h3><?php esc_html_e( 'Grid', 'generateblocks' ); ?></h3> |
| 227 | <p><?php esc_html_e( 'Create advanced layouts with flexible grids.', 'generateblocks' ); ?></p> |
| 228 | |
| 229 | <div class="gblocks-block-learn-more"> |
| 230 | <a class="button" href="https://docs.generateblocks.com/collection/grid/" target="_blank" rel="noreferrer noopener"><?php esc_html_e( 'Grid Documentation', 'generateblocks' ); ?></a> |
| 231 | </div> |
| 232 | </div> |
| 233 | |
| 234 | <div class="gblocks-block"> |
| 235 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" className="gblocks-block-icon"><path className="gblocks-svg-icon-box" d="M0 0h24v24H0z" /><path d="M21.375 22h-5.769a.625.625 0 0 1-.625-.625v-6.042H9.019v6.042a.625.625 0 0 1-.625.625H2.625A.625.625 0 0 1 2 21.375V2.625C2 2.28 2.28 2 2.625 2h5.769c.346 0 .625.28.625.625v6.041h5.961V2.625A.626.626 0 0 1 15.606 2h5.769c.345 0 .625.28.625.625v18.75c0 .345-.28.625-.625.625zm-5.144-1.25h4.519V3.25h-4.519v6.041c0 .345-.28.625-.625.625H8.394a.625.625 0 0 1-.625-.625V3.25H3.25v17.5h4.519v-6.042c0-.345.28-.625.625-.625h7.212c.345 0 .625.28.625.625v6.042z" /></svg> |
| 236 | |
| 237 | <h3><?php esc_html_e( 'Headline', 'generateblocks' ); ?></h3> |
| 238 | <p><?php esc_html_e( 'Craft text-rich content with advanced typography.', 'generateblocks' ); ?></p> |
| 239 | |
| 240 | <div class="gblocks-block-learn-more"> |
| 241 | <a class="button" href="https://docs.generateblocks.com/collection/headline/" target="_blank" rel="noreferrer noopener"><?php esc_html_e( 'Headline Documentation', 'generateblocks' ); ?></a> |
| 242 | </div> |
| 243 | </div> |
| 244 | |
| 245 | <div class="gblocks-block"> |
| 246 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" className="gblocks-block-icon"><path className="gblocks-svg-icon-box" d="M0 0h24v24H0z" /><path d="M21.375 16.45H2.625A.625.625 0 0 1 2 15.825v-7.65c0-.345.28-.625.625-.625h18.75c.345 0 .625.28.625.625v7.65c0 .345-.28.625-.625.625zM3.25 15.2h17.5V8.8H3.25v6.4z" /><path d="M15.536 12.625H5.882a.625.625 0 0 1 0-1.25h9.654a.625.625 0 0 1 0 1.25z" /><circle cx="17.936" cy="12" r=".807" /></svg> |
| 247 | |
| 248 | <h3><?php esc_html_e( 'Button', 'generateblocks' ); ?></h3> |
| 249 | <p><?php esc_html_e( 'Drive conversions with beautiful buttons.', 'generateblocks' ); ?></p> |
| 250 | |
| 251 | <div class="gblocks-block-learn-more"> |
| 252 | <a class="button" href="https://docs.generateblocks.com/collection/buttons/" target="_blank" rel="noreferrer noopener"><?php esc_html_e( 'Buttons Documentation', 'generateblocks' ); ?></a> |
| 253 | </div> |
| 254 | </div> |
| 255 | |
| 256 | <div class="gblocks-block"> |
| 257 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" className="gblocks-block-icon"><path className="gblocks-svg-icon-box" d="M0 0h24v24H0z" /><path d="M21.374 6.133H14.67a.625.625 0 0 1 0-1.25h6.704a.625.625 0 0 1 0 1.25zm0 2.882H14.67a.625.625 0 0 1 0-1.25h6.704a.625.625 0 0 1 0 1.25zm0-5.764H14.67a.625.625 0 0 1 0-1.251h6.704a.625.625 0 0 1 0 1.251zM9.329 19.118H2.625a.625.625 0 1 1 0-1.25h6.704a.625.625 0 0 1 0 1.25zm0 2.883H2.625a.625.625 0 0 1 0-1.25h6.704a.625.625 0 0 1 0 1.25zm0-5.766H2.625a.625.625 0 1 1 0-1.25h6.704a.625.625 0 0 1 0 1.25z" /><path d="M16.841 22.001a5.17 5.17 0 0 1-3.661-1.517c-1.961-1.961-1.876-5.29-1.793-8.51.095-3.705.185-7.204-2.646-8.399-1.275-.538-2.731-.405-3.8.351-.981.692-1.576 1.721-1.677 2.895a3.929 3.929 0 0 0 1.137 3.116c.882.882 2.245 1.322 4.419 1.428.344.017.61.31.594.655a.621.621 0 0 1-.655.594c-1.688-.082-3.81-.36-5.242-1.792a5.179 5.179 0 0 1-1.498-4.107A5.211 5.211 0 0 1 4.22 2.904c1.418-1.002 3.337-1.186 5.006-.481 3.616 1.526 3.511 5.622 3.409 9.583-.076 2.956-.154 6.012 1.428 7.594a3.924 3.924 0 0 0 3.114 1.137c1.174-.1 2.202-.695 2.896-1.675.754-1.066.889-2.52.353-3.796-.72-1.716-2.283-2.509-5.226-2.652a.626.626 0 0 1-.594-.655.615.615 0 0 1 .655-.594c2.32.112 5.136.602 6.317 3.416.701 1.67.515 3.587-.486 5.002a5.204 5.204 0 0 1-4.251 2.218z" /></svg> |
| 258 | |
| 259 | <h3><?php esc_html_e( 'Query Loop', 'generateblocks' ); ?></h3> |
| 260 | <p><?php esc_html_e( 'Build a list of posts from any post type using advanced query parameters.', 'generateblocks' ); ?></p> |
| 261 | |
| 262 | <div class="gblocks-block-learn-more"> |
| 263 | <a class="button" href="https://docs.generateblocks.com/collection/query-loop/" target="_blank" rel="noreferrer noopener"><?php esc_html_e( 'Query Loop Documentation', 'generateblocks' ); ?></a> |
| 264 | </div> |
| 265 | </div> |
| 266 | |
| 267 | <div class="gblocks-block"> |
| 268 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" className="gblocks-block-icon"><path className="gblocks-svg-icon-box" d="M0 0h24v24H0z" /><path d="M15.77 11.655a3.429 3.429 0 0 1-3.425-3.425 3.428 3.428 0 0 1 3.425-3.425 3.429 3.429 0 0 1 3.424 3.425 3.429 3.429 0 0 1-3.424 3.425zm0-5.6a2.179 2.179 0 0 0-2.176 2.175c0 1.199.977 2.175 2.176 2.175s2.175-.976 2.175-2.175a2.178 2.178 0 0 0-2.175-2.175z" /><path d="M21.375 22.001H2.625A.625.625 0 0 1 2 21.375V2.625C2 2.28 2.28 2 2.625 2h18.751a.624.624 0 0 1 .624.625v18.751c0 .345-.28.625-.625.625zM3.249 20.75H20.75V3.25H3.249v17.5z" /><path d="M20.956 21.839 8.968 11.018l-5.91 5.698-.867-.9L8.52 9.714a.624.624 0 0 1 .853-.014l12.422 11.212-.839.927z" /></svg> |
| 269 | |
| 270 | <h3><?php esc_html_e( 'Image', 'generateblocks' ); ?></h3> |
| 271 | <p><?php esc_html_e( 'Add images to your content to make a visual statement.', 'generateblocks' ); ?></p> |
| 272 | |
| 273 | <div class="gblocks-block-learn-more"> |
| 274 | <a class="button" href="https://docs.generateblocks.com/collection/image/" target="_blank" rel="noreferrer noopener"><?php esc_html_e( 'Image Documentation', 'generateblocks' ); ?></a> |
| 275 | </div> |
| 276 | </div> |
| 277 | </div> |
| 278 | |
| 279 | <div class="gblocks-generatepress"> |
| 280 | <div class="gblocks-inside-generatepress"> |
| 281 | <div class="gblocks-generatepress-content"> |
| 282 | <img width="300" src="<?php echo esc_url( GENERATEBLOCKS_DIR_URL ) . 'assets/images/generatepress.svg'; ?>" alt="" /> |
| 283 | <p><?php esc_html_e( 'Looking for a WordPress theme? GenerateBlocks and GeneratePress are built with the same principles in mind and complement each other perfectly.', 'generateblocks' ); ?></p> |
| 284 | <div class="stats"> |
| 285 | <div class="downloads"> |
| 286 | <strong>4,000,000+</strong><br> <?php esc_html_e( 'Downloads', 'generateblocks' ); ?> |
| 287 | </div> |
| 288 | |
| 289 | <div class="stars"> |
| 290 | <strong>1000+</strong><br> |
| 291 | <img src="<?php echo esc_url( GENERATEBLOCKS_DIR_URL ) . 'assets/images/stars.svg'; ?>" alt="" width="98" height="17" class="alignnone size-full wp-image-44"> |
| 292 | </div> |
| 293 | |
| 294 | <div class="active-websites"> |
| 295 | <strong>400,000+</strong><br> <?php esc_html_e( 'Active websites', 'generateblocks' ); ?> |
| 296 | </div> |
| 297 | |
| 298 | <div class="active-websites"> |
| 299 | <strong>90,000+</strong><br> <?php esc_html_e( 'Happy customers', 'generateblocks' ); ?> |
| 300 | </div> |
| 301 | </div> |
| 302 | <a class="gblocks-button" href="https://generatepress.com" target="_blank" rel="noreferrer noopener"><?php esc_html_e( 'Learn more', 'generateblocks' ); ?></a> |
| 303 | </div> |
| 304 | |
| 305 | <div class="gblocks-generatepress-image"> |
| 306 | <img width="450" src="<?php echo esc_url( GENERATEBLOCKS_DIR_URL ) . 'assets/images/generatepress-sites.png'; ?>" alt="" /> |
| 307 | </div> |
| 308 | </div> |
| 309 | </div> |
| 310 | </div> |
| 311 | </div> |
| 312 | <?php |
| 313 | } |
| 314 | |
| 315 | add_action( 'admin_init', 'generateblocks_dashboard_redirect' ); |
| 316 | /** |
| 317 | * Redirect to the Dashboard page on single plugin activation. |
| 318 | * |
| 319 | * @since 0.1 |
| 320 | */ |
| 321 | function generateblocks_dashboard_redirect() { |
| 322 | $do_redirect = apply_filters( 'generateblocks_do_activation_redirect', get_option( 'generateblocks_do_activation_redirect', false ) ); |
| 323 | |
| 324 | if ( $do_redirect ) { |
| 325 | delete_option( 'generateblocks_do_activation_redirect' ); |
| 326 | wp_safe_redirect( esc_url( admin_url( 'admin.php?page=generateblocks' ) ) ); |
| 327 | exit; |
| 328 | } |
| 329 | } |
| 330 |