100% , options.php , esc_attr; , , , , 100%, , API- Wordpress ?;
function add_global_custom_options(){
add_options_page(
'Sort Registrar List',
'Sort Registrar List',
'manage_options',
'order_by_options',
'global_custom_options'
);
add_action('admin_init', 'register_new_options');
}
add_action('admin_menu', 'add_global_custom_options');
function register_new_options(){
register_setting( 'global_custom_option', 'register_new_option_random' );
register_setting( 'global_custom_option', 'register_new_option_category' );
register_setting( 'global_custom_option', 'register_new_option_menu_order' );
}
add_action('admin_init', 'register_new_option');
function global_custom_options(){
$options = array (
'random' => array(
'post_type' => 'download',
'posts_per_page' => -1,
'orderby' => 'rand'
),
'category' => array(
'post_type' => 'download',
'posts_per_page' => -1,
'orderby' => 'ASC'
),
'menu_order' => array(
'post_type' => 'download',
'posts_per_page' => -1,
'orderby' => 'DESC'
)
);
?>
<div class="wrap">
<h2>Sort Registrar List</h2>
<form method="post" action="options.php">
<?php settings_fields( 'global_custom_option' ); ?>
<?php do_settings_sections( 'global_custom_option' ); ?>
<table class="form-table">
<tr valign="top">
<th scope="row">Display Randomly</th>
<td><input type="text" name="register_new_option_random" value="<?php echo esc_attr( get_option('register_new_option_random') ); ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">Display by Category:</th>
<td><input type="text" name="register_new_option_category" value="<?php echo esc_attr( get_option('register_new_option_category') ); ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">Display By Order:</th>
<td><input type="text" name="register_new_option_menu_order" value="<?php echo esc_attr( get_option('register_new_option_menu_order') ); ?>" /></td>
</tr>
</table>
<?php submit_button(); ?>
</form>
</div>
<?php
}