Use another author.php if different multisite subsite?

This was the solution.. // different author template */ add_filter( ‘template_include’, ‘author_template’, 99 ); function author_template( $template ) { if( !is_main_site() and is_author( ) ) { $new_template = locate_template( array( ‘other-author.php’ ) ); if ( ” != $new_template ) { return $new_template ; } } return $template; }

WP authors page

You can add the code below to your theme’s function.php or in your own custom plugin… function custom_author_slug() { global $wp_rewrite; $new_slug = ‘people’; $wp_rewrite->author_base = $new_slug; } add_action(‘init’, ‘custom_author_slug’); After you do it go to your admin then to Settings > Permalinks and click “Save Changes” which will trigger a flush of the WordPress … Read more

When using the_author hook, how can I determine the PHP file that generates each call to `the_author()`?

You can determine the calling files using debug_backtrace in PHP, which will give you the backtrace of the functions called and the file called from. WP core provides wp_debug_backtrace_summary, which makes doing things like this easier. Using the condition stated in your question of being called from my_file.php you could do something like this: add_filter( … Read more

Programmatically allow a non-author to edit a post based custom meta field

Looking at current_user_can()‘s documentation, I see that it uses WP_User::has_cap(). So if your code (or the WP core code) uses something like current_user_can( ‘edit_post’, $post->ID ) to determine if the current user can edit the current post, you can use the user_has_cap filter (called in WP_User::has_cap()): add_filter( ‘user_has_cap’, ‘wpse360937_allow_manager’, 10, 4 ); function wpse360937_allow_manager( $allcaps, … Read more

Filter post by current 2 differents users id

Based on wordpress reference for WP_QUERY you can use author__in to filter by more than one author. It uses an array of user ids. Here is your code with the needed changes: function list_cpt_by_author_id(){ $user = get_current_user_id(); $authors_id = array(“1”, $user); $custom_terms = get_terms(‘custom-tax’); foreach($custom_terms as $custom_term) { wp_reset_query(); $args = array( ‘post_type’ => ‘artigos’, … Read more

Output author and description if description is not empty

<?php $authordesc = get_the_author_meta( ‘description’ ); if ( ! empty ( $authordesc ) ) { ?> <a href=”https://wordpress.stackexchange.com/questions/11203/<?php echo get_author_posts_url( get_the_author_meta(“id’ ) ); ?>”><?php the_author(); ?></a> <?php echo wpautop( $authordesc ); }

Custom Post Type and Labels

you can use: add_filter(‘gettext’,’custom_author_lable’); function custom_author_lable( $input ) { global $post_type; if( is_admin() && ‘your_post_type’ == $post_type ) if (‘Author’ == $input || ‘author’ == $input) return ‘Keynote Speaker’; return $input; } just replace your_post_type.

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