What is wrong with this code?

You are using get_post_type as variable instead of a function try: function themeperauthor_need_switch() { global $post; if ( get_post_type($post) == ‘weblogs’ ) { return get_the_author_meta(‘themeperauthor’, $user->ID); } return “”; }

Editing the loop for Author pages

If your Parent Theme, has a template file loop-author.php, copy it to your Child Theme; otherwise, copy your Parent Theme’s loop.php template file to your Child Theme, and rename it as loop-author.php. Now, modify your Child Theme’s loop-author.php template file, in whatever way you wish. You don’t need to make any other changes, either to … Read more

get the username of a user in his author page

Take a look at the codex page on author templates – Author Templates Especially the $curauth object. In order to display author information on your author page, edit your author template file – author.php so that it figures out which author is being viewed, and retrieves all the information about the author from the database … Read more

WordPress Author Page

Under the plugin’s settings SEO > Indexation, scroll down to Archive Settings and make sure ‘Disable the author archives’ isn’t checked.

Display Author role in archive or author page

$authordata is not available before the first post is set up (before the first the_post();). But all the data you need are already there on an author archive: in get_queried_object(). It is a WP_User Object on the author archive. print ‘<pre>’ . htmlspecialchars( print_r( get_queried_object(), TRUE ) ) . ‘</pre>’; Result: WP_User Object ( [data] … Read more

Custom Author Fields + Existing Taxonomy – Integrating the Two Dynamically?

Figured it out, for anyone who needs help with this I’m sure you can use with categories/tags as well (can also use with radio inputs and checked=”checked”: <tr> <th><label for=”sorority”><?php _e(‘Sorority is…’) ?></label></th> <td><?php $sorority = get_the_author_meta( ‘sorority’, $user->ID ); ?> <select name=”sorority” id=”sorority”> <?php $terms = get_terms(‘sorority’); foreach ( $terms as $term ) { … Read more

Replace Gravatar with img URL for avatars

Unless I have misunderstood your question to accomplish a custom gravatar to use in your theme add the code below to your functions.php or into a custom plugin. From there customize the title and the image you want to use. See screenshot below for the finished outcome. add_filter( ‘avatar_defaults’, ‘dev_designs_gravatar’ ); /** * Display a … Read more