Created
February 20, 2015 21:32
-
-
Save joeyblake/519673dec628784f689e to your computer and use it in GitHub Desktop.
Mapping Multiple authors on a WordPress data import browser snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery('select[name*="user_map"]').each(function(idx, el){ | |
var $select = jQuery(el), | |
$parent = jQuery(el).parent().parent(), | |
$strong = $parent.find('strong'), | |
name = $strong.text().split(' (')[0].trim(), | |
val = $select.find('option').filter(function () { return jQuery(this).html() == name; }).val(); | |
if ( val !== undefined ) { | |
$select.val(val); | |
} else { | |
$parent.css('background', '#ffcc33'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment