Created
April 29, 2013 08:56
-
-
Save enru/5480485 to your computer and use it in GitHub Desktop.
spits out page/post slug on WordPress autosave/edit
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
| <?php | |
| /* | |
| Plugin Name: Ajaxtest | |
| Plugin URI: http://enru.co.uk/ | |
| Description: spits out page/post slug on autosave/edit | |
| Version: 0.1 | |
| Author: Neill Russell (@enru) | |
| Author URI: http://enru.co.uk/ | |
| */ | |
| add_action('init', function() { | |
| wp_enqueue_script( | |
| 'my-custom-script' // handle | |
| ,plugin_dir_url(__FILE__) . '/custom_script.js' // src | |
| ,array( 'jquery' ) // deps | |
| ,false // version | |
| ,true // in footer | |
| ); | |
| }); | |
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
| jQuery(function($) { | |
| makeSlugeditClickable = (function() { | |
| original_makeSlugeditClickable = makeSlugeditClickable; | |
| return function() { | |
| // this is your slug: | |
| var new_slug = $('#editable-post-name-full').html(); | |
| // do something with it | |
| console.log(new_slug); | |
| return original_makeSlugeditClickable() | |
| } | |
| })(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment