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
<select name="less_tedious"> | |
<?php foreach( $options as $value => $label ) : ?> | |
<option value="<?php echo $value; ?>" <?php selected( $value, $current_value ); ?>"><?php echo $label; ?></option> | |
<?php endforeach; ?> | |
</select> |
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
/** | |
* You've probably done this before. I know I have. | |
*/ | |
var text = $( '#myid .select a > element' ).text(); | |
newtext = doSomeStuff( text ); | |
$( '#myid .select a > element' ).text( newtext ); | |
$( '#myid .select a > element' ).addClass( 'someClass' ); | |
$( '#myid .select a > element' ).fadeIn(); | |
/** |
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
/** | |
* You can hook directly into the `load-{page}` hook for a sub-page with | |
* an action like this. | |
*/ | |
add_action( 'load-myplugin-parent_page_myplugin-subpage', 'enqueue_myplugin_assets' ); | |
/** | |
* Or you can hook into `admin_enqueue_scripts` and check the current | |
* screen to see if we're on the right page. | |
*/ |
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
/** | |
* Use the `$admin_page_hook[ $page_slug ]` in the `load-{page}` hook | |
*/ | |
global $admin_page_hooks; | |
if ( !empty( $admin_page_hooks['myplugin-parent'] ) ) { | |
add_action( 'load-' . $admin_page_hooks['myplugin-parent'] . '_page_myplugin-subpage', 'enqueue_myplugin_assets' ); | |
} | |
/** | |
* Or add `$admin_page_hook[ $page_slug ]` when checking the current |
OlderNewer