class-do-css.php
4 years ago
class-dynamic-content.php
4 years ago
class-enqueue-css.php
4 years ago
class-legacy-attributes.php
4 years ago
class-plugin-update.php
5 years ago
class-query-loop.php
4 years ago
class-render-blocks.php
4 years ago
class-rest.php
4 years ago
class-settings.php
4 years ago
dashboard.php
4 years ago
defaults.php
4 years ago
functions.php
4 years ago
general.php
4 years ago
generate-css.php
4 years ago
dashboard.php
341 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" height="20" width="20" className="gblocks-block-icon"><path d="M23.7 24h-5.2v-2.2h3.3v-3.3H24v5.2c0 .2-.1.3-.3.3zm-15-2.2h6.5V24H8.7zM5.5 24H.3c-.2 0-.3-.1-.3-.3v-5.2h2.2v3.3h3.3V24zM0 8.7h2.2v6.5H0zm2.2-3.2H0V.3C0 .1.1 0 .3 0h5.2v2.2H2.2v3.3zM8.7 0h6.5v2.2H8.7zM24 5.5h-2.2V2.2h-3.3V0h5.2c.2 0 .3.1.3.3v5.2zm-2.2 3.2H24v6.5h-2.2z" /></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" height="20" width="20" className="gblocks-block-icon"><path d="M13.8 10.8H.3c-.2 0-.3-.1-.3-.3V.3C0 .1.1 0 .3 0h13.6c.2 0 .3.1.3.3v10.3c-.1.1-.2.2-.4.2zM1.8 9h10.6V1.8H1.8V9zm21.9 1.8h-7c-.2 0-.3-.1-.3-.3V.3c0-.2.1-.3.3-.3h7c.2 0 .3.1.3.3v10.3c0 .1-.1.2-.3.2zM18.2 9h4V1.8h-4V9zm-8 4.2h13.6c.2 0 .3.1.3.3v10.3c0 .2-.1.3-.3.3H10.2c-.2 0-.3-.1-.3-.3V13.5c0-.2.1-.3.3-.3zm12 1.8H11.7v7.3h10.6V15zM.3 13.2h7c.2 0 .3.1.3.3v10.3c0 .2-.1.3-.3.3h-7c-.2-.1-.3-.2-.3-.4V13.5c0-.2.1-.3.3-.3zM5.8 15h-4v7.3h4V15z" /></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" height="20" width="20" className="gblocks-block-icon gblocks-block-icon__headline"><path d="M23.7 24h-8c-.1 0-.3-.1-.3-.3V16H8.7v7.6c0 .1-.1.3-.3.3H.3c-.1.1-.3 0-.3-.2V.3C0 .2.1 0 .3 0h8c.2 0 .4.1.4.3V8h6.8V.3c0-.1.1-.3.3-.3h8c.1 0 .2.1.2.3v23.5c0 .1-.1.2-.3.2zm-6.6-1.7h5V1.7h-5v8H6.9v-8h-5v20.4h5v-8h10.3v8.2z" /></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" height="20" width="20" className="gblocks-block-icon"> |
| 247 | <path d="M23.7 10.8H.3c-.1 0-.1 0-.2-.1-.1 0-.1-.1-.1-.1V.4C0 .3 0 .3.1.2S.2 0 .3 0h23.4c.1 0 .1 0 .2.1.1 0 .1.1.1.2v10.2c0 .1 0 .1-.1.2 0 .1-.1.1-.2.1zM1.8 9.1h20.4V1.9L12 1.8H1.8v7.3z" /> |
| 248 | <path d="M15 6.3H4.8V4.5H15v.9zm4.2 0h-2.6V4.5h2.6v.9zM23.7 24H.3c-.1 0-.1 0-.2-.1s-.1-.1-.1-.2V13.5c0-.1 0-.1.1-.2s.1-.1.2-.1h23.4c.1 0 .1 0 .2.1s.1.1.1.2v10.2c0 .1 0 .1-.1.2 0 .1-.1.1-.2.1zM1.8 22.2h20.4V15H1.8v7.2z" /> |
| 249 | <path d="M19.2 19.5H9v-1.8h10.2v.9zM4.8 17.7h2.6v1.8H4.8v-.9z" /> |
| 250 | </svg> |
| 251 | |
| 252 | <h3><?php esc_html_e( 'Buttons', 'generateblocks' ); ?></h3> |
| 253 | <p><?php esc_html_e( 'Drive conversions with beautiful buttons.', 'generateblocks' ); ?></p> |
| 254 | |
| 255 | <div class="gblocks-block-learn-more"> |
| 256 | <a class="button" href="https://docs.generateblocks.com/collection/buttons/" target="_blank" rel="noreferrer noopener"><?php esc_html_e( 'Buttons Documentation', 'generateblocks' ); ?></a> |
| 257 | </div> |
| 258 | </div> |
| 259 | |
| 260 | <div class="gblocks-block"> |
| 261 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" height="20" width="20" className="gblocks-block-icon"> |
| 262 | <path d="M22.8 5.2h-7.4c-.2 0-.3-.1-.3-.3V3.7c0-.2.1-.3.3-.3h7.4c.2 0 .3.1.3.3v1.2c0 .2-.1.3-.3.3zm0 3.4h-7.4c-.2 0-.3-.1-.3-.3V7.1c0-.2.1-.3.3-.3h7.4c.2 0 .3.1.3.3v1.2c0 .2-.1.3-.3.3zm0-6.8h-7.4c-.2 0-.3-.1-.3-.3V.3c0-.2.1-.3.3-.3h7.4c.2 0 .3.1.3.3v1.2c0 .2-.1.3-.3.3zM8.6 20.6H1.2c-.2 0-.3-.1-.3-.3v-1.2c0-.2.1-.3.3-.3h7.4c.2 0 .3.1.3.3v1.2c-.1.2-.2.3-.3.3zm0 3.4H1.2c-.2 0-.3-.1-.3-.3v-1.2c0-.2.1-.3.3-.3h7.4c.2 0 .3.1.3.3v1.2c-.1.2-.2.3-.3.3zm0-6.8H1.2c-.2 0-.3-.1-.3-.3v-1.2c0-.2.1-.3.3-.3h7.4c.2 0 .3.1.3.3v1.2c-.1.1-.2.3-.3.3z" /> |
| 263 | <path d="M17.7 24c-1.7 0-3.3-.7-4.4-1.8-2.4-2.4-2.3-6.3-2.2-10.2.1-4.3.2-8.4-3-9.8-1.5-.7-3.2-.5-4.4.4-1.2.8-1.9 2.1-1.9 3.5 0 .8.2 1.6.5 2.3.9 1.7 2.5 2.5 5.6 2.7.2 0 .3.1.3.3l-.1 1.2c0 .2-.1.3-.3.3-2-.1-4.4-.5-6-2.2-1.3-1.3-2-3.1-1.8-5 .2-1.9 1.1-3.5 2.7-4.6C4.4-.1 6.7-.3 8.8.5c4.4 1.8 4.2 7 4.1 11.5-.1 3.5-.2 7.1 1.6 8.9.9.9 2.2 1.4 3.6 1.3 1.3-.1 2.5-.8 3.3-1.9.9-1.2 1-2.9.4-4.4-.8-1.9-2.5-2.8-5.8-3-.2 0-.3-.1-.3-.3l.1-1.2c0-.2.1-.3.3-.3 2.7.2 6 .8 7.3 4.1.9 2 .6 4.4-.6 6.1-1.1 1.5-2.8 2.5-4.6 2.7h-.5z" /> |
| 264 | </svg> |
| 265 | |
| 266 | <h3><?php esc_html_e( 'Query Loop', 'generateblocks' ); ?></h3> |
| 267 | <p><?php esc_html_e( 'Build a list of posts from any post type using advanced query parameters.', 'generateblocks' ); ?></p> |
| 268 | |
| 269 | <div class="gblocks-block-learn-more"> |
| 270 | <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> |
| 271 | </div> |
| 272 | </div> |
| 273 | |
| 274 | <div class="gblocks-block"> |
| 275 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" height="20" width="20" className="gblocks-block-icon"> |
| 276 | <path d="M16.4 11.9c-2.3 0-4.2-1.9-4.2-4.2s1.9-4.2 4.2-4.2 4.2 1.9 4.2 4.2-1.9 4.2-4.2 4.2zm0-6.7c-1.3 0-2.4 1.1-2.4 2.4s1.1 2.4 2.4 2.4c1.3 0 2.4-1.1 2.4-2.4s-1.1-2.4-2.4-2.4z" /> |
| 277 | <path d="M23.7 24H.3c-.2 0-.3-.1-.3-.3V.3C0 .1.1 0 .3 0h23.4c.2 0 .3.1.3.3v23.4c0 .2-.1.3-.3.3zM1.8 22.2h20.4V1.8H1.8v20.4z" /> |
| 278 | <path d="M22.3 23.6 8.4 11.7l-6.9 6.1-1.2-1.3 7.9-6.9c.1-.1.3-.1.4 0l15.1 13-1 1.1c-.1 0-.3 0-.4-.1z" /> |
| 279 | </svg> |
| 280 | |
| 281 | <h3><?php esc_html_e( 'Image', 'generateblocks' ); ?></h3> |
| 282 | <p><?php esc_html_e( 'Add images to your content to make a visual statement.', 'generateblocks' ); ?></p> |
| 283 | |
| 284 | <div class="gblocks-block-learn-more"> |
| 285 | <a class="button" href="https://docs.generateblocks.com/collection/image/" target="_blank" rel="noreferrer noopener"><?php esc_html_e( 'Image Documentation', 'generateblocks' ); ?></a> |
| 286 | </div> |
| 287 | </div> |
| 288 | </div> |
| 289 | |
| 290 | <div class="gblocks-generatepress"> |
| 291 | <div class="gblocks-inside-generatepress"> |
| 292 | <div class="gblocks-generatepress-content"> |
| 293 | <img width="300" src="<?php echo esc_url( GENERATEBLOCKS_DIR_URL ) . 'assets/images/generatepress.svg'; ?>" alt="" /> |
| 294 | <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> |
| 295 | <div class="stats"> |
| 296 | <div class="downloads"> |
| 297 | <strong>4,000,000+</strong><br> <?php esc_html_e( 'Downloads', 'generateblocks' ); ?> |
| 298 | </div> |
| 299 | |
| 300 | <div class="stars"> |
| 301 | <strong>1000+</strong><br> |
| 302 | <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"> |
| 303 | </div> |
| 304 | |
| 305 | <div class="active-websites"> |
| 306 | <strong>400,000+</strong><br> <?php esc_html_e( 'Active websites', 'generateblocks' ); ?> |
| 307 | </div> |
| 308 | |
| 309 | <div class="active-websites"> |
| 310 | <strong>90,000+</strong><br> <?php esc_html_e( 'Happy customers', 'generateblocks' ); ?> |
| 311 | </div> |
| 312 | </div> |
| 313 | <a class="gblocks-button" href="https://generatepress.com" target="_blank" rel="noreferrer noopener"><?php esc_html_e( 'Learn more', 'generateblocks' ); ?></a> |
| 314 | </div> |
| 315 | |
| 316 | <div class="gblocks-generatepress-image"> |
| 317 | <img width="450" src="<?php echo esc_url( GENERATEBLOCKS_DIR_URL ) . 'assets/images/generatepress-sites.png'; ?>" alt="" /> |
| 318 | </div> |
| 319 | </div> |
| 320 | </div> |
| 321 | </div> |
| 322 | </div> |
| 323 | <?php |
| 324 | } |
| 325 | |
| 326 | add_action( 'admin_init', 'generateblocks_dashboard_redirect' ); |
| 327 | /** |
| 328 | * Redirect to the Dashboard page on single plugin activation. |
| 329 | * |
| 330 | * @since 0.1 |
| 331 | */ |
| 332 | function generateblocks_dashboard_redirect() { |
| 333 | $do_redirect = apply_filters( 'generateblocks_do_activation_redirect', get_option( 'generateblocks_do_activation_redirect', false ) ); |
| 334 | |
| 335 | if ( $do_redirect ) { |
| 336 | delete_option( 'generateblocks_do_activation_redirect' ); |
| 337 | wp_safe_redirect( esc_url( admin_url( 'admin.php?page=generateblocks' ) ) ); |
| 338 | exit; |
| 339 | } |
| 340 | } |
| 341 |