Making WordPress.org


Ignore:
Timestamp:
02/03/2023 06:41:44 AM (2 years ago)
Author:
coffee2code
Message:

Photo Directory: Facilitate photo attribution with copy-to-clipboard functionality for Rich Text, HTML, and plain text suggestions.

Inspired by Openverse's implementation.

Props pollyplummer, Otto42 topher1kenobe, coffee2code.
Fixes #6097.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-photos/functions.php

    r12306 r12385  
    103103    wp_register_script( 'grofiles-cards', false );
    104104    wp_enqueue_script( 'grofiles-cards' );
     105
     106    if ( is_singular( get_photo_post_type() ) ) {
     107        wp_enqueue_script( 'wporg-photos-attribution', get_stylesheet_directory_uri() . '/js/attribution.js', [], filemtime( __DIR__ . '/js/attribution.js' ), true );
     108        wp_localize_script(
     109            'wporg-photos-attribution',
     110            'PhotoDir',
     111            [
     112                'copied_text'            => __( 'Copied!', 'wporg-photos' ),
     113                'copy_to_clipboard_text' => __( 'Copy to clipboard', 'wporg-photos' ),
     114            ]
     115        );
     116    }
    105117}
    106118add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\scripts' );
Note: See TracChangeset for help on using the changeset viewer.