Author Link Not Displaying

You have to use setup_postdata function if you want to use the_author_link with custom loop. Do it like this: <h2 class=”sidebarheaders”>Random Posts By You </h2> <br/> <?php $rand_posts = get_posts( array( ‘numberposts’ => 5, ‘orderby’ => ‘date’ ) ); foreach( $rand_posts as $post ) : setup_postdata( $post ); ?><li><a href=”https://wordpress.stackexchange.com/questions/89309/<?php the_permalink(); ?>”><?php the_title(); ?></a></li> Written … Read more

Author.php display profile for all types of users

You can try to catch the 404 template and redirect it to the author template which will usee the same template for all users even if they are subscribers (or any other which have zero posts) something like this: function no_404_for_all_users($template) { global $wp_query; if( !is_author() && get_query_var(‘author’) && (0 == $wp_query->posts->post) ) { return … Read more

if else for custom $curauth-> field

A combination of get_queried_object_id to fetch the current user ID and get_user_meta to retrieve the banner should do the trick. <?php // somewhere in your theme’s author.php if ($img = get_user_meta(get_queried_object_id(), ‘user_banner’, true)) { // they uploaded an image, use it } else { // they did not upload the image, show the default }

Calling a custom profile field only it it exists

On an “author” page you can get a lot of the information you need with get_queried_object and additional information with get_user_meta. What you want (sounds like) should be in that second chunk of information.That is… $author = $wp_query->get_queried_object(); $ameta = get_user_meta($author->ID); var_dump($author,$ameta); // debugging if(!empty($ameta[‘facebook’])) { var_dump($ameta[‘yim’]); // debugging } // and so one for … Read more

Show infos only to the author in the author.php

You can check who the current user is and whether they have the same ID as the user that is being viewed. global $current_user wp_get_current_user(); if(the_author_meta(‘ID’) === $current_user->ID) : // Add your code here… endif; See these Codex pages for more information – wp_get_current_user() the_author_meta()

Author template – separate custom post type by custom taxonomy term for $curauth

Got the answer, encase anyone else needs it, here it is. <?php $currauthor_id = get_the_author_meta(‘ID’); $terms = get_terms(‘your_taxonomy’, array( ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘hide_empty’ => 1, ) ); foreach ( $terms as $term ) { $myquery = new WP_Query( array( ‘author’ => $currauthor_id, ‘post_type’ => ‘post_type_name’, ‘your_taxonomy’ => $term->slug, ‘posts_per_page’ = > -1, … Read more

Php markup question: php/html within conditional bit

you code may look like this <?php global $wp_query; $thepostid = $wp_query->post->ID; $postdata = get_post($thePostid, ARRAY_A); $authorid = $postdata[‘post_author’]; if ($authorid==1) { echo ‘Show nothing’; } else { ?> <div id=”author-bio”> <h3>About The Author</h3> <?php echo get_avatar( get_the_author_id() , 80 ); ?> <h4><?php the_author_posts_link(); ?></h4> <div class=”desc”><?php the_author_meta(‘description’); ?> </div> </div> <?php } ?>

Archives and category of authors

You can make specific pages (like landing pages) and call a specific header (or footer) template (i.e. header-authorPaul.php) by calling get_header ( “authorPaul” ); and then verifying that the author has post(s). Show the last one(s) if any. The same goes for archives.

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