New answers tagged

1

In author.php: <?php get_template_part('custom-author-file'); Alternatively, rename your custom-author-file.php to author.php. The URL being used in this case isn't relevant, as a template doesn't determine the URL used, it's the other way around. However, I suspect there is more to your question you haven't explained


1

Solved I've solved the problem and I'm going to share the code I used, so other developers that have this issue too can cope with it. The get_pages()-function accepts the "hierarchical" argument. By default it's set to 1 (true), which means, that Wordpress searches the pages in hierarchical order to find the other parameters. If - as in my case - you ...


-1

In your case this could work: <?php $user_info = get_userdata($recent["post_author"]); echo $user_info->user_login; ?>


0

You could do this with a simple script. IMPORTANT! - Backup your database before doing this & attempt at your own risk. Create a file called changeauthorcat.php in your main WordPress folder. <?php include( 'wp-config.php' ); global $wpdb; // Author username $username = 'exampleuser'; // New category slug $newCatSlug = 'examplecategory'; // find ...


0

You can get author posts id's ids =[] ids = SELECT id FROM `wp_posts` WHERE `post_author`=1 and then you can loop result new_category_id = 999 old_category_id = 111 for id in ids: UPDATE `wp_term_relationships` SET `term_taxonomy_id`=new_id WHERE `object_id`=id AND `term_taxonomy_id`=old_category_id or wp_set_post_categories( $post_ID, ...


1

You're doing something like this tutorial on categorizing wordpress users, correct? I think you should do your filtering in your theme files, not on a hook. Just add an if statement to your template file (probably author.php) that tests if your custom fields aren't empty strings, and then do whatever (404, redirect elsewhere, throw a notice...) Unless you ...


0

Use WordPress' built-in wp_dropdown_users with an advanced query as discussed in http://stackoverflow.com/questions/34142789/change-wp-dropdown-users-filter-by-user-role


1

If I get it right you are storing this data in user meta. WP_Query would have no remote idea how to retrieve that, since it's only aware of post meta. The two are completely separate and there is no native way to involve one in queries for another. Likely you will have to do this in a two step process: Use get_users() to retrieve IDs for all authors of ...


3

You can use the exact same filter in your template files. If you do need it in functions.php for any reason (maybe you have some additional processing) then you can use your own custom filter. functions.php: function my_custom_authorpage_title( $title ) { // process ... return apply_filters( 'my_title', $title ); } add_filter( 'wpseo_title', ...


3

Basically, when you want get posts, you should think about WP_Query. It's already in the docs for your question. You can get posts by an author like this $query = new WP_Query( array( 'author' => AUTHOR_ID, 'posts_per_page' => 5 ) ); You can even get posts by more than one author, like this $query = new WP_Query( array( 'author__in' ...


0

Just in case someone got here looking for how to also add a Guest Description, here is my full implementation. If follows the same logic as the other answers, I just added a get_the_author_description filter and a function to overwrite the author Bio info (description). As the other solutions above, you pass it as a custom field (see image attached). ...



Top 50 recent answers are included