Add a jQuery snippet for sepcific user role

You should be able to use the admin_enqueue_scripts hook to load your snippet on the edit page as seen in this example from the codex function my_enqueue($hook) { if ( ‘edit.php’ != $hook ) { return; } wp_enqueue_script( ‘my_custom_script’, get_template_directory_uri() . ‘/myscript.js’ ); } add_action( ‘admin_enqueue_scripts’, ‘my_enqueue’ );

Display Graphs in Admin Pages

Some days ago I also searched for that thing, but haven’t got any suitable option. I used a third party library for showing my graphs and charts. So firstly I’ll suggest you to visit those two directories wp-includes/js/ and wp-admin/js/ Those are the JavaScript libraries included with WordPress by default. If you find nothing to … Read more

Form submit in admin does not set is_admin() true

Ok, here is what I found out to solve the issue: First of all, the form should be posted to admin-post.php 2nd, there should be a hidden variable “action” so the form should be like: <form method=”post” action=”<?php echo esc_url( admin_url(‘admin-post.php’) ); ?>”> <input type=”hidden” name=”action” value=”my_settings_save”> …. </form> Now the is_admin() is true and … Read more

Populate Dropdwon with DIR files, save value and keep it “selected”

You need to add a ‘selected’ value to the option output, so that the html displays the value that’s saved in the psg_settings. Something like this: function psg_dyn_select_1_render ( ) { $options = get_option( ‘psg_settings’ ); $files = glob( plugin_dir_path( __FILE__ ) . “assets/images/*” ); ?> <select name=”psg_settings[psg_dyn_select_1]”> <?php foreach ($files as $filename){ $filename = … Read more

Wp-admin page not found following copy of site

I’ve never used wp-clone so i’ll try to help based on what i see. D id you change the site url and wordpress? When i load your site, css isn’t loading either which generally means you haven’t done that yet. First make sure that your wp-config that you’ve got the right database. You need to … Read more

exclude ID on avatar

Should help, if user isn’t admin show avatar, if user is admin hide avatar. <?php if(!is_admin()) { ?> <div class=”single-post-about-author”> <div class=”author-avatar-w”><?php echo get_avatar(get_the_author_meta( ‘ID’ )); ?> </div> <?php } ?> <div class=”author-details”> <h3 class=”author-name”><?php the_author_meta( ‘display_name’ ); ?></h3> </div>

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