How to set CORS header?

I have been accessing media images in a Ruby on Rails application via ajax from wordpress 4.2.4. I am getting following error while accessing the image via ajax. XMLHttpRequest cannot load http://myblog/wp-content/uploads/2015/11/test.jpeg. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://stage.mysite.com’ is therefore not allowed access. I tried WP-CORS plugin and set * … Read more

Audio Playlist : How to bind events for “track change”, “track end”?

I’m customizing native WordPress playlist echo do_shortcode(”); I’d like to bind events to detect “track change” and “track end” and do something when those events fired. So, I checked wp-playlist.js. I see some events but I have no idea how to bind it on a separate js file (jquery) events : { ‘click .wp-playlist-item’ : … Read more

Why are image thumbnails cropped proportionally (not per dimensions)?

For some reason WordPress is ignoring my thumbnail sizes and keeping thumbnails cropped proportionately instead of specific dimensions. Here is what I have in functions.php: add_image_size( ‘main-thumbnail’, 728, 410, true ); and in content.php: <div class=”thumbnail”> <a href=”https://wordpress.stackexchange.com/questions/229322/<?php the_permalink(); ?>”> <?php the_post_thumbnail( ‘main-thumbnail’ ); ?> </a> </div> I added these two things and regenerated my … Read more

Add control in image detail panel

I am trying to add a checkbox control in the image details popup (when editing image in a post). I have added the following code in my template function.php but I can’t manage to display the checkbox in the popup. What am I missing? function bluesolutions_customize_register($wp_customize) { $wp_customize->add_section(‘bluesolutions_use_lighbox_section’, array( ‘title’ => __(‘Lightbox’, ‘mytheme’), ‘description’ => … Read more

Allowing for multiple template views on the Gallery Settings page when using the Visual Editor

I’m trying to extend this answer by making it possible to switch shortcode attributes from the UI and alter the gallery markup based on those attributes. In this case, if owl is set to true then an Owl Carousel would render in the gallery’s place – which is does. But like any shortcode you have … Read more