Function to add custom HTML into head in custom post-type list page

If its okey you can hook into admin_notices. Like this: Change post_type to the real post_type name.. I assumed it would be “program”. function wpse_76471_add_html() { global $pagenow ,$post; if( $post->post_type == ‘program’ && $pagenow == ‘edit.php’ ) { $output=”<div class=”my-div”>”; $output .= ‘<h2>’. __(‘My custom content (HTML/PHP)’, ‘program’) .'</h2>’; $output .= ‘</div>’; echo $output; … Read more

How to include stylesheet in custom admin using parent_slug

Don’t confuse menu structure with page/URL structure. Each one of your pages may have a different hook. Do this: function my_enqueue($hook) { echo $hook; } add_action( ‘admin_enqueue_scripts’, ‘my_enqueue’ ); Load your pages and write down the hook names. There may be other ways to do this too, like the admin-print-scripts-$hook_suffix hooks. Look in wp-admin/admin-header.php to … Read more

How to show a custom notification to a specific user?

You can show admin notices via the admin_notices action. You can display it for a specific user by checking the contents of the global $current_user: function wpa80367_admin_notice() { global $current_user; if ( ‘someusername’ == $current_user->user_login ): echo ‘<div class=”updated”><p>’; echo ‘This is an admin notice just for you, someusername.’; echo ‘</p></div>’; endif; } add_action( ‘admin_notices’, … Read more

Is there a hook between clicking on “Add new” and the edit screen of a new post?

This plugin does the same thing as what you are looking for: http://wordpress.org/extend/plugins/magic-action-box It has a custom post type called action-box but has different types of action boxes that you can select when you create a new action box. The code you want is found inside the plugin’s directory lib/classes/ProsulumMabAdmin.php. Look for the method add_actions() … Read more

Adding a ‘style=’ bit to image_send_to_editor output

I can’t find the proper hook, but there is alternative solution: to add style=”float:right” to all images in content, which have class=”alignright”: add_filter(‘the_content’, ‘my_add_image_float_right’); function my_add_image_float_right($content) { $pattern = ‘@(<img.+)(alignright)(.*)(/>)@Ui’; $replacement=”$1$2$3 style=”float:right” />”; $content = preg_replace($pattern, $replacement, $content); return $content; }

“sufficient permissions” error for admin after duplicating WP database to new install

So you’ve duplicated the tables in the DB, with the new set having the dev_ prefix? In that case, the problem is probably that you have not updated the fields within the duplicated tables that inherit that prefix. For instance, dev_usermeta will now have a meta_key called wp_capabilities. This needs to be dev_capabilities. Also, dev_options … Read more

How do I create a post_id column, for admin posts list?

You haven’t set $post_id so there is no reason is should display. If you have debugging enabled as you should when you are working, you would have spotted the error immediately. What you need to do is: add_action( ‘manage_posts_custom_column’, ‘populate_columns’ ); function populate_columns( $column ) { global $post; if ($column == ‘id’){ echo $post->ID; } … Read more

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