Support » Plugins » get_the_author() tag not working in user-added function

  • Resolved tracyberna


    I’m working on a new version of a blog that was set up by somebody else (and who is off on maternity leave now and hard to reach quickly). The blog is scheduled to launch tomorrow and what I thought was a no-brainer edit isn’t working.

    The previous programmer developed a “display_author()” function. Previously under the subdomain “,” it worked like this:

    Set parameters

    function display_author() {
    	$author = get_the_author();
    	$imgdir = get_bloginfo('template_directory') . '/images/';

    Gather data

    if($author == 'water') {
    		$icon = 'icon_claire.jpg';
    		$title = 'Claire Dworsky, Water Quality Project Winner';
    	} else if($author == 'seti') {
    		$icon = 'icon_kamau.jpg';
    		$title = 'Kamau Hamilton, SETI Project Winner';

    Then display the results

    if($author == 'admin') {
              $display = '';
            } else {
    	  $display = '<div class="author">' . "\n";
              $display .= '<img src="' . $imgdir . $icon . '" />' . "\n";
    	  $display .= '<h3>' . $title . '</h3>' . "\n";
              $display .= '</div>' . "\n";
    	echo $display;

    The new blog resides under “”. I switched out author names (each login name and the nickname are identical), icon files and titles, and now the blog can’t find the info and outputs no code (except most of the URL to pull up the pictures, all the way up to the filename which isn’t included.)

    $imgdir = get_bloginfo('template_directory') . '/images/'; seems to be finding the right directory, and as far as I can tell *all* I switched out were usernames and file names. WHAT on earth is wrong here?

    If you need more code or links, please let me know, but I think what I’ve put should be what you need (?)

  • The topic ‘get_the_author() tag not working in user-added function’ is closed to new replies.