accessing wp.media api from a tinymce plugin

I’m trying to create a tinymce plugin that generates a shortcode containing two image ids: [image-fade old= »xx » new= »yy »] I would like to let users select images directly from the media selector frame, but haven’t figured out how to do this. I am able to allow the users to enter the ID in an alert box, but can’t do better than that. This is what I have so far: ( function() { var open_media_window = function () { var first={}; var window = wp.media({ title: ‘Insert a media’, library: {type: ‘image’},…

Web Design Weekly #224

Headlines The New Web Typography Robin Rendle looks into how we should go about making rules for typesetting on the web. A well thought out post that is a great read. (robinrendle.com) The current state of modular CSS (medium.com) ​Get multiple job offers from top companies with 1 application ​Web developers are in demand, so shouldn’t companies apply to you? On Hired, that’s exactly how it works. Get 5+ job offers from companies like Uber, Square, and Facebook with 1 application. Join Hired today and get a $1,000 bonus when…

Web Design Weekly #223

Headlines The future of loading CSS Jake Archibald explains the major changes that are coming to Chrome in regards to the way normal stylesheets are loaded in a HTTP/2 world. (jakearchibald.com) Designers shouldn’t code. They should study business (medium.com) Daily Deals for Web Professionals MightyDeals is a daily deal website that offers massive discounts for web and creative professionals. Generally, our customers can save from 50% to 90% off on fonts, ebooks, icons, templates and much more. (mightydeals.com) Articles Getting Ready For HTTP/2 Rachel Andrew looks at the basics of…

ACF Relationship – Get Parent’s Post Object

I’ve a few post that have ACF relationship field set up : – Post A – Post A1 – Post A2 – Post A3 Post A have a relationship that link to : Post A1,A2 & A3… Post A1,A2,A3 have their own post templates, But inside the post templates, can I manage to get Post A’s Title? Because I don’t want hardcoded Post A’s title on Post A1,A2,A3’s fields. I’d tried this solution, but seems can’t retrieve parent A’s post object… Below is my custom field settings on Post A‘s…

Web Design Weekly #222

Headlines Automatically art-directed responsive images Eric Portis explains how you can automatically art direct responsive images by simply passing a few parameters to the Cloudinary API. I personally haven’t had a chance to have a play with the API but it does look mighty fine. Whilst we are on the topic of responsive images, Vitaly Friedman over on Smashing Magazine explored the landscape a little with a solid post which is also worth a read. (cloudinary.com) Frontend database performance – Case study Nolan Lawson built a webapp with a rich, interactive experience…

Sharing Header Components Across Multisite

I have a multi-site platform and I’m trying to share the menu that I have in main with other sites that are located in different folders. This is the PHP tag in the main that pulls the menu which I also need in the header of other: <?php dokan_header_user_menu(); ?> I tried using it as it is in the header of /site2, and it didn’t work. I also tried this: <?php include $_SERVER[‘DOCUMENT_ROOT’]. »site.com/wp-content/themes/dokan/header.php »; ?> still no luck. Any tips will greatly be appreciated. Cheers! Source: https://wordpress.stackexchange.com/feeds

Images not displayed when moving site to local

I set up a local environment to customize a friend’s WP blog. However almost none of the images are being displayed. The remote site’s URL is http://sitename.com and my local virtual host is http://sitename.dev. I have found a couple different cases when the images are not displayed: The src URL looks like this: http://i1.wp.com/sitename.com/wp-content/uploads/xxxxxx and opening this link on the browser shows the image correctly. However there’s a srcset attribute with the URL http://i1.wp.com/sitename.dev/wp-content/uploads/xxxxxx and that causes a 504 HTML error because obviously there is no http://i1.wp.com/sitename.dev. The other case…

Web Design Weekly #221

Headlines Making A Service Worker Lyza Gardner explains what service workers are and how to go about creating your own. She has even created a nice example file to help get the ball rolling quicker. (smashingmagazine.com) HTTP/2 is here, now let’s make it easy (thedotpost.com) Responsive Email Designer App Creating responsive emails is a huge plus for individuals and companies today. With more than 50% of emails initially being opened and read on smartphones and tablets, a solid responsive design is pretty much a necessity. Check it out today. (mightydeals.com)…

switch_to_blog() and wp_nav_menu() not functioning properly

I have an MU plugin active on the network with this small function to query menu 4 from the main site in my network. On the main site in the network (1) things work as expected. On the sub sites in the network (2,3,4) no menu gets displayed (since I have the fallback set to false, and no menu is found). I’m wondering if I’m doing something wrong here, or if something larger is going wrong. /** * Multisite menu */ function wp_multisite_nav_menu() { global $blog_id; $args = array( ‘menu’…