Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Center area post/pages (http://forum.bytesforall.com/forumdisplay.php?f=32)
-   -   [SOLVED] Post Avatar (http://forum.bytesforall.com/showthread.php?t=13828)

Webmason Apr 18, 2011 10:46 AM

[SOLVED] Post Avatar
 
Hello,

I have added the following code inside the center column loop and it has the desired effect.
Code:

<?php echo get_avatar( get_the_author_email(), '32' ); ?>
But I just want this avatar to show up on posts, not pages. Right now it comes up on both. Can this be done?

Thanks!
Tom

juggledad Apr 18, 2011 12:22 PM

you should try adding a test to see if you are on a 'page' page
HTML Code:

<?php if (!is_page() {echo get_avatar( get_the_author_email(), '32' );} ?>

Webmason Apr 18, 2011 12:27 PM

I thought it would be something like that, but for some reason when I add that, the pages (inside the loop) just don't show anything. :(

Any thoughts?

juggledad Apr 18, 2011 12:29 PM

where are you putting in in the looP?
Export your Ataualpa settings and attach to a reply

Webmason Apr 18, 2011 12:32 PM

1 Attachment(s)
Here you go...

juggledad Apr 18, 2011 01:29 PM

I don't see that code in the loop? where is it?

Webmason Apr 18, 2011 01:46 PM

1 Attachment(s)
It's in the center column, "tje Loop" near the top.

I attached a screen cap

juggledad Apr 18, 2011 02:01 PM

are you sure you didn't type a parentheses ')' instead of squiggly bracket '}'?

send me the export with the if statement in it.

Webmason Apr 18, 2011 02:07 PM

1 Attachment(s)
ok - thanks for your time btw!

juggledad Apr 18, 2011 02:23 PM

my mistake, i left out the closing ')' in the conditional, so instead of
HTML Code:

<?php if (!is_page() {echo get_avatar( get_the_author_email(), '32' );} ?>
it should be
HTML Code:

<?php if (!is_page()) {echo get_avatar( get_the_author_email(), '32' );} ?>
With the closing parentheses missing, everything after that became part of the IF condition. No wonder it didn't work.

Funny thing, I was just talking to Lmilesw this morning and said keeping track of your open/close parentheses is a place you always trip over.

Webmason Apr 18, 2011 02:34 PM

Yeah!!!! You made my day! Thanks JD! Time for another donation!


All times are GMT -6. The time now is 09:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.