Make WordPress Core


Ignore:
Timestamp:
10/18/2017 10:03:39 AM (7 years ago)
Author:
pento
Message:

Dashboard: Introduce a "Try Gutenberg" callout.

To encourage more people to try Gutenberg, this new Dashboard box allows site users to easily install and try out Gutenberg.

Props pento, melchoyce, joen, karmatosed.
Fixes #41316.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/dashboard.php

    r41699 r41895  
    16201620    <?php
    16211621}
     1622
     1623/**
     1624 * Displays a Try Gutenberg Panel, to introduce people to Gutenberg
     1625 *
     1626 * @since 4.9.0
     1627 */
     1628function wp_try_gutenberg_panel() {
     1629    $plugins = get_plugins();
     1630    $action = $url = $classes = '';
     1631
     1632    if ( current_user_can( 'install_plugins' ) && empty( $plugins['gutenberg/gutenberg.php'] ) ) {
     1633        $action = __( 'Install Today' );
     1634        $url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=gutenberg' ), 'install-plugin_gutenberg' );
     1635        $classes = ' install-now';
     1636    } else if ( current_user_can( 'install_plugins' ) && is_plugin_inactive( 'gutenberg/gutenberg.php' ) ) {
     1637        $action = __( 'Activate Today' );
     1638        $url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=gutenberg/gutenberg.php&from=try-gutenberg' ), 'activate-plugin_gutenberg/gutenberg.php' );
     1639        $classes = ' activate-now';
     1640    } else if ( current_user_can( 'edit_posts' ) && is_plugin_active( 'gutenberg/gutenberg.php' ) ) {
     1641        $action = __( 'Try Today' );
     1642        $url = admin_url( 'admin.php?page=gutenberg-demo' );
     1643    }
     1644
     1645    ?>
     1646    <div class="try-gutenberg-panel-content plugin-card-gutenberg">
     1647        <div class="try-gutenberg-panel-column-container">
     1648            <div class="try-gutenberg-panel-column try-gutenberg-panel-image-column">
     1649                <img src="https://s.w.org/images/core/gutenberg-screenshot.gif?<?php echo date( 'Ymd' ); ?>" alt="<?php esc_attr_e( 'Gutenberg animated preview' ); ?>" />
     1650            </div>
     1651            <h2><?php _e( 'Try the new editing experience' ); ?></h2>
     1652            <div class="try-gutenberg-panel-column">
     1653                <p class="about-description"><?php _e( 'WordPress is working on a better way to control your content. How about giving it a try early?' ); ?></p>
     1654                <?php if ( $action ) { ?>
     1655                    <p><a class="button button-primary button-hero<?php echo $classes; ?>" href="<?php echo esc_url( $url ); ?>"><?php echo $action; ?></a></p>
     1656                <?php } ?>
     1657            </div>
     1658            <div class="try-gutenberg-panel-column try-gutenberg-panel-last">
     1659                <h3><?php _e( 'Want to get involved?' ); ?></h3>
     1660                <ul>
     1661                    <li><?php printf( __( 'Learn more about the project <a href="%s">codenamed Gutenberg</a>.' ), 'https://wordpress.org/gutenberg/' ); ?></li>
     1662                    <li><?php printf( __( 'Help <a href="%1$s">with testing</a>, or contribute on the <a href="%2$s">GitHub repository</a>.' ), '', 'https://github.com/WordPress/gutenberg/' ); ?></li>
     1663                </ul>
     1664            </div>
     1665        </div>
     1666    </div>
     1667    <?php
     1668}
Note: See TracChangeset for help on using the changeset viewer.