Calculate and save an average in a meta

You can accomplish this via the save_post action: add_action( ‘save_post’, ‘wpa78558_save_average_meta’, 100 ); function wpa78558_save_average_meta( $post_id ) { if ( !wp_is_post_revision( $post_id ) ) { $graphics = get_field(‘graphics’, $post_id); $gameplay = get_field(‘game-play’, $post_id); $life = get_field(‘life’, $post_id); $sound = get_field(‘sound’, $post_id); $overall = $graphics + $gameplay + $life + $sound; $overall = $overall / 4; … Read more

Custom Div with links on Admin Bar

I think you need to use “global $current_user;” in your function to get the details of $current_user and global $wp_admin_bar; for admin bar. This is how I managed to get the role of the current user and change the URL from admin depending on role (It doesn’t solve your issue, but maybe you find it … Read more

Reference external file as a function

You can’t. Create a function that loads that file: function load_admin_page_file() { require ‘admin-members.php’; } Then use that function name as callback argument. In PHP 5.3 you can use a lambda: add_menu_page( ‘Members’, ‘Members’, ‘manage_options’, ‘members’, function() { require ‘admin-members.php’; } );

Link to all posts page?

Your 2nd example omits the leading / in the URL — does /wp-admin/edit.php work? Also, you’re wiser to use admin_url(), since it’s possible to change the Admin URL to something other than /wp-admin. Instead of <a href=”https://wordpress.stackexchange.com/wp-admin/edit.php”>, use <a href=”https://wordpress.stackexchange.com/questions/103685/<?php echo( admin_url(“edit.php’ ) ); ?>”>. It’s more complicated, but much safer.