Add new user and user bio at same time
Add new user and user bio at same time
Add new user and user bio at same time
From the code you have posted there, it doesn’t look like, at any time, you’re are hooking the function on to save_post outside of your function. function change_pos_auth($post_id){ if ( ! wp_is_post_revision( $post_id ) ){ // unhook this function so it doesn’t loop infinitely remove_action(‘save_post’,’change_pos_auth’); if ( isset($_GET[‘auth_id’]) ) { $args = array(‘ID’=>$post_id,’post_author’=>$_GET[‘auth_id’]); // update … Read more
URLs to user page is broken
The most efficient means would be to query directly via wpdb: $author_ids = $wpdb->get_col( ” SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_type=”job” AND post_status=”publish” ” );
add_shortcode(‘userpro_author_link’, ‘wpse_152910’); function wpse_152910( $attr ){ if( ! is_singular() ) return ”; $post = get_post(); global $userpro; $userpro->permalink( $post->post_author ); } You will be using [userpro_author_link] on your post content to display this.
Show the online status of the current post’s author
You need to use WP_Query. get_posts will only get you post =) <?php $user_id = get_current_user_id(); echo $user_id; $args=array( ‘post_type’ => ‘page’, ‘post_status’ => ‘published’, ‘posts_per_page’ => 1, ‘author’ => $user_id ); $wp_query = new WP_Query($args); while ( have_posts() ) : the_post(); the_title(); endwhile; ?> Tested, and it is working
One possible solution could be this – if ( empty( $social_icons_fields ) ){ $icons .= ‘<style type=”text/css”> .socials-icons{display: none;} </style>’; //assuming that the div which has class ‘socials-icons’ is the div which supposed to be not shown return $icons; }
How to add authors contact info to author metabox in post editor?
Figured it out for anyone who wants to know: function update_school( $post_id ) { $post_author_id = get_post_field( ‘post_author’, $post_id ); // get the post author ID $school_name = get_the_author_meta( ‘school2’, $post_author_id ); // from the post author ID, get the author meta $term = term_exists( $school_name, ‘school’); wp_set_post_terms( $post_id, $term, ‘school’ ); } // run … Read more