Variable undefined but it is defined

Your problem is totally related with pure PHP, not WordPress. You must understand that includes DO NOT break the variable scope. So, the $curauth is only life in author_list.php file and, more specifically, only life inside the foreach($author_ids as $author) loop of that file. In your page template you could use the_author_meta() to get the … Read more

How to change the post author when the post is published?

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

How to get latest page (not post) of User and display the content

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

Sticky post of current viewing author?

I find what was missing ($wp_query->queried_object_id;), here is answer: $current_browsing_author = $wp_query->queried_object_id; // Get current browsing author $sticky = get_option( ‘sticky_posts’ ); rsort( $sticky ); $sticky = array_slice( $sticky, 0, 5000 ); query_posts( array( ‘post__in’ => $sticky, ‘author’ => $author, ‘orderby’ => ‘rand’, ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 5, ‘caller_get_posts’=> 5 ) … Read more

WordPress author box

I’m using Gameleon theme. Single.php code line between 224-261: <?php wp_link_pages( array( ‘before’ => ‘<div class=”pagination”>’ . __( ‘Pages:’, ‘gameleon’ ), ‘after’ => ‘</div>’ ) ); ?> <div class=”clearfix”></div> </div><?php // end of .post-entry / ?> </div><?php // end of #post-the_ID(); / ?> </div><?php // end of td-wrap-content / ?> </div><?php // end of td-content-inner … Read more

How to remove author from Social sharing links?

I took a look at your article in the Facebook Debugger and it looks like it is still pulling in this meta tag <meta name=”author” content=”terrance” />. I’m assuming you deleted that from your site’s <head> already as I am not seeing it in the source code for that article. Have you “fetched a new … Read more

Creating a button from data from Author meta

You just created an empty link, it has correct link but no inner text: echo ‘<a href=”‘ . esc_url( the_author_meta(‘snapchat_profile’)) . ‘”>Follow on Snapchat</a>’; And since you already stored the link in $snapchat_profile variable, no need to call the the_author_meta(‘snapchat_profile’) function once again (it will only reduce in a few bits of extra memory usage … Read more

Open the_author_link() in a new window

Yes, you have to get the url by user’s meta: <?php if ( get_the_author_meta(‘url’) ) { // Author has website url $author_url = get_the_author_meta(‘url’); } else { // Author doesn’t have website url, so get Author Posts Page $author_url = get_author_posts_url( get_the_author_meta(‘ID’) ); } ?> <a href=”https://wordpress.stackexchange.com/questions/273597/<?php echo $author_url; ?>” target=”_blank”>Author’s website</a>