• Hey All,

    I am having this very random issue with the function call.

    I have a widget that I wrote that includes this function. I have it included in several dynamic sidebars but I am having a problem.

    On my “page” template, in the sidebar the images show up for each author but on my single-post template, there is no image.

    I’ve tried everything. I’ve deleted all code in the template and just left the sidebar code and still no photo. I’ve even tried to run the blog-home sidebar in the single template and still nothing.

    Is there something I am doing wrong? Below is the widget function code of my custom widget.

    Any help is appreciated!

    function widget($args, $instance) {
            extract($args);
    
            $title = empty($instance['title']) ? '' : $instance['title'];
    
            // Before widget
            echo $before_widget;
            $title = $instance['title'];
    
            global $post; ?>
    
            <div class="sb1">
            <h3><?php echo $title; ?></h3>
            <ul class="blogAuthor">
    
            <?php
            $author_array = array();
            $cat_posts = get_posts('post_type=blog&post_status=publish&posts_per_page=-1&orderby=author&order=ASC');
            foreach ($cat_posts as $cat_post) :
            if (!in_array($cat_post->post_author,$author_array)) {
            $author_array[] = $cat_post->post_author;
            }
            endforeach;
    
            foreach ($author_array as $author) :
            $auth = get_userdata($author)->display_name;
            $auth_link = get_userdata($author)->nickname;
            $auth_desc = get_userdata($author)->description;
            $auth_blog = get_userdata($author)->first_name;
            $auth_blog .= ' ';
            $auth_blog .= get_userdata($author)->last_name;
    
            ?>
    
            <li>
                <div class="abtAuthor">
                    <?php userphoto_the_author_photo(); ?>
    
                    <b><?php echo $auth_blog; ?></b>
                    <small><?php echo $auth_desc; ?></small>
                </div>
                <div class="readBlog">
                     <a href="<?php bloginfo('url'); ?>/author/<?php echo $auth_link;  ?>">Read Their Blog</a> <span class="gold">»</span>
                </div>
            </li>
    
    <?php endforeach; ?>
    
    </ul>
    </div>
    <?php  // After widget
            echo $after_widget;
    
            wp_reset_query();
        }

    http://wordpress.org/extend/plugins/user-photo/

  • The topic ‘[Plugin: User Photo] Photo not displaying on "single" page template’ is closed to new replies.