Adding scripts to admin page in my theme

Use add_action(‘admin_enqueue_scripts’, ‘pb_admin_style’); and as the manual states, the admin_enqueue_scripts can also be used to target a specific admin page. Use this to only select the admin page you want. function pb_admin_style($hook) { if( ‘edit.php’ != $hook ) return; wp_enqueue_script( ‘my_custom_script’, plugins_url(‘/myscript.js’, __FILE__) ); } add_action( ‘admin_enqueue_scripts’, ‘pb_admin_style’ );

Text snippets shared across posts

It sounds like you do want a custom post type, you just want to set the public argument to false. The register_post_type() has lots of arguments that will let you do everything you probably want. Along with public, you’ll probably set has_archive to false. Setting show_ui to true will allow you to manage the posts … Read more

Re-ordering Admin Submenu Sections

Yes there is, but I cannot find a simpler way… Here, we are changing the Media submenu and inverting Add new and Library. add_filter( ‘custom_menu_order’, ‘wpse_73006_submenu_order’ ); function wpse_73006_submenu_order( $menu_ord ) { global $submenu; // Enable the next line to inspect the $submenu values // echo ‘<pre>’.print_r($submenu,true).'</pre>’; $arr = array(); $arr[] = $submenu[‘upload.php’][10]; $arr[] = … Read more

How to find out if an wp-admin action edited a file?

The system redirects after an update with updated=true. You could check for that GET parameter on the load-theme-editor.php hook, something like: add_action( ‘load-theme-editor.php’, function() { if (isset($_GET[‘updated’]) && true == $_GET[‘updated’]) { // clear the cache } } ); I looked for more specific hooks and couldn’t find any, by the way.

changing body background color for custom post type in admin backend

Easy and your css to overwrite the default style like this add_action(‘admin_print_styles’, ‘auctions_admin_print_styles_332’); function auctions_admin_print_styles_332(){ if ((isset($_GET[‘post_type’]) && $_GET[‘post_type’] == ‘auctions’) || (isset($post_type) && $post_type == ‘auctions’)){ //include your css file using wp_enqueue_style() somthing like wp_enqueue_style( ‘handle name’, plugins_url(‘/style.css’, __FILE__), array(), ‘1.0’ ); // or a more hackish way would be to echo out the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)