Making WordPress.org


Ignore:
Timestamp:
12/08/2023 05:58:26 AM (3 years ago)
Author:
tellyworth
Message:

Plugin directory: add committer button to enable previews

This adds a button to the Advanced view that will allow a plugin committer to enable or disable the Live Preview button for public users.

A valid blueprint.json file must be present in the plugin's assets/blueprints/ folder in its svn repo.

See #7251.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-single.php

    r12999 r13040  
    4242                                <a class="plugin-download button download-button button-large" href="<?php echo esc_url( Template::download_link() ); ?>"><?php esc_html_e( 'Download', 'wporg-plugins' ); ?></a>
    4343                        <?php endif; ?>
    44                         <?php if ( current_user_can( 'plugin_admin_edit', $post ) && Template::is_preview_available() ) : ?>
     44                        <?php if ( Template::is_preview_available() ) : ?>
     45                                <a class="plugin-preview button download-button button-large" target="_blank" href="<?php echo esc_attr( add_query_arg( array( 'preview' => 1 ), get_the_permalink() ) ); ?>"><?php esc_html_e( 'Live Preview', 'wporg-plugins' ); ?></a>
     46                        <?php elseif ( current_user_can( 'plugin_admin_edit', $post ) && Template::preview_link() ) : ?>
    4547                                <a class="plugin-preview button download-button button-large" target="_blank" href="<?php echo esc_attr( add_query_arg( array( 'preview' => 1 ), get_the_permalink() ) ); ?>"><?php esc_html_e( 'Test Preview', 'wporg-plugins' ); ?></a>
    4648                        <?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.