Title: Php code isn&#039;t working
Last modified: August 20, 2016

---

# Php code isn't working

 *  [posthawk](https://wordpress.org/support/users/posthawk/)
 * (@posthawk)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-code-isnt-working/)
 * im trying to get the author of a post’s avator image clickable, with the website
   link as the link. this will be in the sidebar
 * the user url works but the avatar doesnt display, it just displays a broken picture
   link image
 * `<a href="<?php the_author_meta( 'user_url' ); ?>"><img class="alignnone" title
   ="<?php the_author_meta( 'display_name' ); ?>’s Website" alt="Author Webite Link"
   src="<?php echo get_avatar( get_the_author_meta('ID'), 32 ); ?>"> </a>`
 * any advice would help

Viewing 14 replies - 1 through 14 (of 14 total)

 *  [Andrew Bartel](https://wordpress.org/support/users/andrew-bartel/)
 * (@andrew-bartel)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-code-isnt-working/#post-3363913)
 * Might be typo in the get_avatar() function.
 *     ```
       <a href="<?php the_author_meta( 'user_url' ); ?>">
       <img class="alignnone" title="<?php the_author_meta( 'display_name' ); ?>’s Website" alt="Author Webite Link" src="<?php echo get_avatar( get_the_author_meta('ID',32) ); ?>">
       </a>
       ```
   
 * With 32 being the id of the current author.
 *  Thread Starter [posthawk](https://wordpress.org/support/users/posthawk/)
 * (@posthawk)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-code-isnt-working/#post-3363914)
 * 32 is the size of the image, changing it does work on changing the size of the
   boken image.
 *  [Andrew Bartel](https://wordpress.org/support/users/andrew-bartel/)
 * (@andrew-bartel)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-code-isnt-working/#post-3363915)
 * Just 32 can never be a valid image size as far as I know.
 * Maybe `array(32,32)`
 *  Thread Starter [posthawk](https://wordpress.org/support/users/posthawk/)
 * (@posthawk)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-code-isnt-working/#post-3363921)
 * it assumes square, if i insert just
 * `<?php echo get_avatar( get_the_author_meta('ID',32) ); ?>`
 * i do get the image just fine so i know it works
 *  [Andrew Bartel](https://wordpress.org/support/users/andrew-bartel/)
 * (@andrew-bartel)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-code-isnt-working/#post-3363924)
 * Ok, I actually went and looked at get_avatar(). It returns a complete image tag,
   not just the src.
 *     ```
       <a href="<?php the_author_meta( 'user_url' ); ?>"><?php echo get_avatar( get_the_author_meta('ID',32) ); ?></a>
       ```
   
 *  Thread Starter [posthawk](https://wordpress.org/support/users/posthawk/)
 * (@posthawk)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-code-isnt-working/#post-3363926)
 * thanks for that format, but this code is what works on my site
 * > `<a href="<?php the_author_meta( 'user_url' ); ?>"><?php echo get_avatar( get_the_author_meta('
   > ID'), 32); ?></a>`
 * i havent tried yet to center or ad title, ill let you know how that works
 *  Thread Starter [posthawk](https://wordpress.org/support/users/posthawk/)
 * (@posthawk)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-code-isnt-working/#post-3363927)
 * is there a way to center it and add a tittle? i’ve tried a few different ways
   and am now quite sure, like do i center the whole thing or just the image?
 *  Thread Starter [posthawk](https://wordpress.org/support/users/posthawk/)
 * (@posthawk)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-code-isnt-working/#post-3363928)
 * well i got it to align right with this code
 * > `<a class="alignright" title="<?php the_author_meta( 'display_name' ); ?>’s
   > Website" alt="Author Webite Link"<a href="<?php the_author_meta( 'user_url');?
   > >"><?php echo get_avatar( get_the_author_meta('ID'), 150); ?></a></a>`
 * but it wont center, even with class=”aligncenter”
 *  [animacia](https://wordpress.org/support/users/animacia/)
 * (@animacia)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-code-isnt-working/#post-3363934)
 * big problem here!!
    so I messed with the code and I shouldn’t have and now it’s
   messes up. Please help. it’s Page Template page.php this is the error i get from
   those non-working pages
 * Parse error: syntax error, unexpected T_ENDIF in /homepages/42/d444256732/htdocs/
   wp-content/themes/sight/page.php on line 14
 * and this is all the code from that page
    Please help. super grateful in advance!
 * <?php get_header(); ?>
 *  <?php if ( have_posts() ) : ?>
    <?php while ( have_posts() ) : the_post(); ?
   >
 *  <div class=”entry”>
    <div <?php post_class(‘single clear’); ?> id=”post_<?php
   the_ID(); ?>”> <div class=”post-meta”> <h1><?php the_title(); ?></h1> by <span
   class=”post-author”>” title=”Posts by <?php the_author(); ?>”><?php the_author();?
   ></span> on <span class=”post-date”><?php the_time(__(‘M j, Y’)) ?></span> • 
   <span><?php the_time() ?></span> <?php edit_post_link( __( ‘Edit entry’), ‘• ‘);?
   > <?php if ( comments_open() ) : ?> [<?php comments_number(__(‘No Comments’), __(‘1 Comment’), __(‘% Comments’), ”, __(‘Comments Closed’) ); ?>](https://wordpress.org/support/topic/php-code-isnt-working/?output_format=md#comments)
   <? php endif; ?> </div> <div class=”post-content”><?php the_content(); ?></div
   > <div class=”post-footer”><?php the_tags(__(‘**Tags: **‘), ‘, ‘); ?></div> </
   div> </div>
 *  <?php endwhile; ?>
    <?php endif; ?>
 * <?php get_footer(); ?>
 *  Thread Starter [posthawk](https://wordpress.org/support/users/posthawk/)
 * (@posthawk)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-code-isnt-working/#post-3363935)
 * dont know why you posted that here.
 * > `<?php comments_number(__(‘No Comments’), __(‘1 Comment’), __(‘% Comments’),”,
   > __(‘Comments Closed’) ); ?>
   >  <strong><? php endif; ?></strong>`
 * that end if has something wrong with it, or it shouldnt be there
 *  [animacia](https://wordpress.org/support/users/animacia/)
 * (@animacia)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-code-isnt-working/#post-3363936)
 * i think i just realized im not supposed to be here but post my own issue.. sorry
   to barge in. first time in support here. I apologize.
 *  Thread Starter [posthawk](https://wordpress.org/support/users/posthawk/)
 * (@posthawk)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-code-isnt-working/#post-3363937)
 * i assume it’s because there is no else
 *  [animacia](https://wordpress.org/support/users/animacia/)
 * (@animacia)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-code-isnt-working/#post-3363938)
 * thank you. i fixed it 🙂
 *  Thread Starter [posthawk](https://wordpress.org/support/users/posthawk/)
 * (@posthawk)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-code-isnt-working/#post-3363941)
 * yep, next time just add a new topic at the top of the previous screen

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Php code isn't working’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 14 replies
 * 3 participants
 * Last reply from: [posthawk](https://wordpress.org/support/users/posthawk/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/php-code-isnt-working/#post-3363941)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
