admin_url( 'admin-ajax.php' ), 'template_directory' => get_bloginfo( 'template_directory' ) )); } public static function shortcode_author_profile ( $atts ) { global $post; // Scrub user id $user_id = isset( $atts['id'] ) ? $atts['id'] : $post->post_author; $user = get_user_by( 'id', $user_id ); $meta = get_user_meta( $user_id, '' ); // Start output buffering ob_start(); ?>
post_type == 'post' ) || in_array( $post->post_type, $post_types ) ) return $content .= do_shortcode('[author-profile]'); return $content; } public static function admin_menu () { // Add menu page which allows the user to specify which post types to work with add_options_page( 'Author Profile Plus', 'Author Profile Plus', 'manage_options', 'author-profile-plus', array( __CLASS__, '_options_page' ) ); } public static function user_profile_fields ( $user ) { ?> Post Navigator) public static function _options_page () { // Process form submission if there is one if( !empty( $_POST ) ) update_option( 'app_post_types', $_POST['post_types'] ); // Get all post types and filter by what the user has selected // Fallback to "post" and "page" types if no selection has been made yet $_post_types = get_post_types(); $post_types = get_option( 'app_post_types' ); if( empty( $post_types ) || !is_array( $post_types ) ) $post_types = array( 'post' ); // Render options in-line with WordPress core styling echo '