Conversation
|
Also– while working on these changes and thinking through how this works, I think it might be better if you enqueue a localized script with all the staff post data once which the JS could reference to pull post information from instead of using all these data attributes on each It would reduce the redundancy by only having one data set to reference. Just add one data attribute on each For example: Staffer_Public::enqueue_scripts() $profiles = array(
'123' => array(
'id' => 123,
'slug' => 'john-doe',
'name' => 'John Doe',
// etc
),
'124' => array(
'id' => 124,
'slug' => 'john-doe',
'name' => 'John Doe',
// etc
),
);
$data = array(
'plugin_path' => plugin_dir_url( __FILE__ ),
'profiles' => $profiles,
);
wp_localize_script( $this->plugin_name, 'cwStaffer', $data );public/js/staffer-scripts.js $('a.cw-launch-staffer-modal').on('click', function(e){
var id = $(this).attr('data-staff-id');
var profile = cwStaffer.profiles[id];
// etc
});This might help clean up some redundancies and could eliminate the need for a hidden Note: this is untested code, but hopefully you get the idea. |
|
I'd love to see this pull request included in a new release of the plugin on wordpress.org – please let me know if you'll be able to include this soon. Thanks! |
|
+1 on getting this PR merged. |
I've included fixes for the following issues:
The WP audio shortcode in the post content still does not function in the popup, but does work if you load the page with the staff URI query string. I believe this is because the WordPress script can't run on the post content while it's hidden.
This pull request is in response to issue #12