Changeset 989729
- Timestamp:
- 09/14/2014 09:34:32 PM (12 years ago)
- Location:
- lookbook-embed/trunk
- Files:
-
- 2 edited
-
lookbook-embed.php (modified) (5 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lookbook-embed/trunk/lookbook-embed.php
r989720 r989729 2 2 /** 3 3 * Plugin Name: LOOKBOOK Embed 4 * Version: 0.1. 14 * Version: 0.1.2 5 5 * Description: Just add LOOKBOOK links into your posts and the plugin will add the HYPE button for you. 6 6 * Author: Sören Müller … … 9 9 */ 10 10 11 11 12 12 wp_embed_register_handler( 'lookbook', "/https?:\/\/lookbook.nu\/look\/(\d+)-[a-zA-Z-\._~:\/\?#\[\]@!\$&'()*\+,;=]+/", 'wp_embed_handler_lookbook' ); 13 13 14 14 function wp_embed_handler_lookbook( $matches, $attr, $url, $rawattr ) { 15 15 16 16 $look_id = esc_attr($matches[1]); 17 17 18 18 $embed = '<!--BEGIN HYPE WIDGET-->'; 19 19 $embed .= sprintf( '<div id="hype_container_%s">Loading...</div>', $look_id); 20 20 $embed .= sprintf('<script>var lookbook_ids = lookbook_ids || []; lookbook_ids.push(%s)</script>', $look_id); 21 21 $embed .= '<!--END HYPE WIDGET-->'; 22 23 22 23 24 24 return apply_filters( 'embed_lookbook', $embed, $matches, $attr, $url, $rawattr ); 25 25 } … … 27 27 28 28 /*add_action( 'wp_enqueue_scripts', 'lookbook_script' ); 29 29 30 30 function lookbook_script() { 31 31 wp_enqueue_script( 'lookbook', '//lookbook.nu/look/widget/6456764.js?include=hype&size=medium&style=button&align=center', array(), null, true ); … … 33 33 34 34 function display_lookbook_widgets() { 35 echo '<script> 36 if (jQuery) { 37 $LB = jQuery; 38 } 35 echo '<script> 39 36 if (typeof lookbook_ids != "undefined"){ 37 if (jQuery) { 38 $LB = jQuery; 39 } 40 40 jQuery.each(lookbook_ids, function( index, value ) { 41 41 jQuery.getScript( "//lookbook.nu/look/widget/" + value + ".js?include=hype&size=medium&style=button&align=center" ) … … 48 48 } 49 49 add_action('wp_footer', 'display_lookbook_widgets'); 50 51 52 -
lookbook-embed/trunk/readme.txt
r989722 r989729 23 23 24 24 == Changelog == 25 = 0.1.2 = 26 * Deleted unnecessary variable declaration 25 27 = 0.1.1 = 26 28 * Fixed error when no hype button found
Note: See TracChangeset
for help on using the changeset viewer.