• Resolved erichsparks

    (@erichsparks)


    Tried numerous different methods of inserting the author image into a blog template including the default from FAQ and none of them work.

    Here’s the code as it is now (copied most of it from another support thread which says it’s working (and updated a missing bit)).

    <?php if ( has_post_thumbnail() ) { ?>
                        <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
                            <?php the_post_thumbnail('blog-thumbnail', array('class' => 'blog-thumbnail'));  ?>
                        </a>
                   <?php } elseif ("" != get_the_author_meta('author_profile_picture')) {  ?>
                        <img src="<?php get_author_image_url(); ?>" alt="A Picture of $name" class="blog-thumbnail"/>';
                    <?php } else { ?>
                            <div class="post-excerpt"><?php the_excerpt(); ?></div>
                    <?php } ?>

    Can send a link via email

    https://www.ads-software.com/plugins/easy-author-image/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Lawsonry

    (@lawsonry)

    Hi,

    The function get_author_image_url() returns the value as a string, so if you want to include it in your code like that you need to change this:

    <img src="<?php get_author_image_url(); ?>" alt="A Picture of $name" class="blog-thumbnail"/>';

    to this:

    <img src="<?php echo get_author_image_url(); ?>" alt="A Picture of $name" class="blog-thumbnail"/>';

    Note that I added the “echo” in there because get_author_image_url() returns a value (it does not echo it on its own).

    – Jesse

    Thread Starter erichsparks

    (@erichsparks)

    Jesse,
    As I had mentioned before, I tried it numerous different ways. Including echoing it. The code I posted was an example of where I left off. Nothing seems to work.

    Plugin Author Lawsonry

    (@lawsonry)

    Hi Erich,

    I saw your dropboxed code and think it would be best if you try editing out a lot of that multiple hook-ness and just see if you can display the avatars. If they’re working on other pages but not on that one, I don’t see how that’s a (pardon the pun) function of the plugin.

    If you cut out all the stuff around your call to the get avatar function and just call the wordpress loop correctly, the avatars display just fine. The problem, I think, is that the loop is not reset properly, the function is called outside the scope of the if/else block, or something has happened to your loop variables (again, outside scope).

    Either way, the plugin code has been tested and works; the problem lies in your utilization of multiple hook patterns in WordPress.

    – Jesse

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘img src is blank’ is closed to new replies.