How to add code to top of author page via plugin?
-
Hey There,
I’m currently coding a plugin that adds an author box to the top of the author archives page and a link below any other archives pages. I have been attaching my function to loop_start however this seems to also add the code inside my recent posts widget on the sidebar.
function custom_author_box_plugin() { global $post; $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); if (is_author()) { ?> <div>The Author Box code here</div> <?php } else if (is_archive() && (!is_author())) { ?> <div>Code for standard archives here.</div> <?php } } add_action('loop_start' , 'custom_author_box_plugin');
Can anyone guide me in the right direction for only showing the code in the relevant place rather than what I presume is another loop on the page inside a widget?
- The topic ‘How to add code to top of author page via plugin?’ is closed to new replies.