Make WordPress Core


Ignore:
Timestamp:
11/18/2015 08:50:53 PM (10 years ago)
Author:
DrewAPicture
Message:

Embeds: Introduce print_embed_comments_button(), print_embed_sharing_button(), and print_embed_sharing_dialog(), which respectively output the comments button, sharing buttons, and sharing dialog elements in the embed template.

This change hooks these new output functions to existing hooks in the embed template, allowing for more straightforward display control of these elements.

Leaves the embed header and footer intact pending further modularization in a future release.

Props juliobox, swissspidy, DrewAPicture.
See #34561.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/embed-template.php

    r35578 r35689  
    150150                    do_action( 'embed_content_meta');
    151151                    ?>
    152                     <?php if ( get_comments_number() || comments_open() ) : ?>
    153                         <div class="wp-embed-comments">
    154                             <a href="<?php comments_link(); ?>" target="_top">
    155                                 <span class="dashicons dashicons-admin-comments"></span>
    156                                 <?php
    157                                 printf(
    158                                     _n(
    159                                         '%s <span class="screen-reader-text">Comment</span>',
    160                                         '%s <span class="screen-reader-text">Comments</span>',
    161                                         get_comments_number()
    162                                     ),
    163                                     number_format_i18n( get_comments_number() )
    164                                 );
    165                                 ?>
    166                             </a>
    167                         </div>
    168                     <?php endif; ?>
    169                     <div class="wp-embed-share">
    170                         <button type="button" class="wp-embed-share-dialog-open" aria-label="<?php esc_attr_e( 'Open sharing dialog' ); ?>">
    171                             <span class="dashicons dashicons-share"></span>
    172                         </button>
    173                     </div>
    174                 </div>
    175             </div>
    176             <div class="wp-embed-share-dialog hidden" role="dialog" aria-label="<?php esc_attr_e( 'Sharing options' ); ?>">
    177                 <div class="wp-embed-share-dialog-content">
    178                     <div class="wp-embed-share-dialog-text">
    179                         <ul class="wp-embed-share-tabs" role="tablist">
    180                             <li class="wp-embed-share-tab-button wp-embed-share-tab-button-wordpress" role="presentation">
    181                                 <button type="button" role="tab" aria-controls="wp-embed-share-tab-wordpress" aria-selected="true" tabindex="0"><?php esc_html_e( 'WordPress Embed' ); ?></button>
    182                             </li>
    183                             <li class="wp-embed-share-tab-button wp-embed-share-tab-button-html" role="presentation">
    184                                 <button type="button" role="tab" aria-controls="wp-embed-share-tab-html" aria-selected="false" tabindex="-1"><?php esc_html_e( 'HTML Embed' ); ?></button>
    185                             </li>
    186                         </ul>
    187                         <div id="wp-embed-share-tab-wordpress" class="wp-embed-share-tab" role="tabpanel" aria-hidden="false">
    188                             <input type="text" value="<?php the_permalink(); ?>" class="wp-embed-share-input" aria-describedby="wp-embed-share-description-wordpress" tabindex="0" readonly />
    189 
    190                             <p class="wp-embed-share-description" id="wp-embed-share-description-wordpress">
    191                                 <?php _e( 'Copy and paste this URL into your WordPress site to embed' ); ?>
    192                             </p>
    193                         </div>
    194                         <div id="wp-embed-share-tab-html" class="wp-embed-share-tab" role="tabpanel" aria-hidden="true">
    195                             <textarea class="wp-embed-share-input" aria-describedby="wp-embed-share-description-html" tabindex="0" readonly><?php echo esc_textarea( get_post_embed_html( 600, 400 ) ); ?></textarea>
    196 
    197                             <p class="wp-embed-share-description" id="wp-embed-share-description-html">
    198                                 <?php _e( 'Copy and paste this code into your site to embed' ); ?>
    199                             </p>
    200                         </div>
    201                     </div>
    202 
    203                     <button type="button" class="wp-embed-share-dialog-close" aria-label="<?php esc_attr_e( 'Close sharing dialog' ); ?>">
    204                         <span class="dashicons dashicons-no"></span>
    205                     </button>
    206152                </div>
    207153            </div>
Note: See TracChangeset for help on using the changeset viewer.