• Resolved soriya

    (@soriya)


    Hi! I’m currently working to modify a theme and have to allow poster’s avatar only on the front page and it’s post. Basically, i have a bunch of categories and want it to only show on certain categories, or just the front page and it’s post.

    I showed it using this code in my theme index file:

    <?php echo get_avatar( get_the_author_email(), ’60’ ); ?>

    is there a way to modify this so that it will only appear when viewing a certain category, and only on the front page and it’s own post?

    I am thinking of something along the line of:

    if (is_category(‘CATEGORY ID’)) {

    the code can either be put in the file’s itself or the function if possible. I don’t have any experiences with php, so i am not able to do this. Thank ahead for helping!

    when i played around, I’ve tried

    <?php if (is_category(‘4,5,6′)) {echo get_avatar( get_the_author_email(), ’60’; ?>} ?>

    but I don’t think it work. I would still see the author’s avatar in a different category post. However, it does disappear from the front page and category posts list (when i click on a certain category).

    what i want is for it to appear only on a certain category, even on the front page. ex: on front page and category page (when you see posts list), show only when it’s a post that belongs to it’s category

Viewing 1 replies (of 1 total)
  • Thread Starter soriya

    (@soriya)

    I found the solution, lol. and it was more simple than i thought. ^^

    the problem was that my theme only use index.php to do the posts query when i view a certain tag or category. therefore, all i did was copy and paste the index.php and renamed it to category.php and tag.php. then i go in and modify the layout. that’s it. it’s now working like a charm.

    thank you, WordPress Docs!

Viewing 1 replies (of 1 total)
  • The topic ‘Hiding avatar from everywhere except the front page and it's post’ is closed to new replies.