Last active
August 29, 2015 14:16
-
-
Save isotrope/802c4df7f8dd99c5d5f2 to your computer and use it in GitHub Desktop.
Change the label for Taxonomy edit screens. (Instead of "Name")
This file contains hidden or 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
function iso_enqueue_my_awesome_admin_scripts( $hook ) { | |
// First argument is simply to give it a "name". | |
wp_enqueue_script( 'iso-custom-admin-scripts', get_template_directory_uri() . '/iso-admin-scripts.js', array('jquery') ); | |
} | |
add_action( 'admin_enqueue_scripts', 'iso_enqueue_my_awesome_admin_scripts' ); |
This file contains hidden or 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
(function ($) { | |
function isoReplaceTagName(taxonomySlug, newLabel) { | |
// The Tag edit screen has a body class of taxonomy-[taxonomy slug] | |
var $taxEditScreen = $('.taxonomy-' + taxonomySlug); | |
// No use in going on if we're not on that screen | |
if ($taxEditScreen.length > 0) { | |
var $tagNameLabel = $taxEditScreen.find('label[for="tag-name"]'); | |
// Just in case... let's make sure the page actually has the label we want to change. | |
if ($tagNameLabel.length > 0) { | |
$tagNameLabel.text(newLabel); | |
} | |
} | |
} | |
$(document).ready(function () { | |
// Release the Krakken! | |
isoReplaceTagName('orders', 'Order ID'); | |
}); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment