Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Being new to word-press as well php i am struck at a point. I am trying to display author information along with his picture in the post and have successfully able to fetch all the data from gravatar.com and able to display it on the right hand side bar successfully.

Currently this box is coming through out the website, but my requirement is that it should only be displayed when reader is on the post detail page. As per my little knowledge of word-press, i kw that each post will going to relate to some category. How can i able to show the author box to only post detail page and hide it from all other places.Any help in this regard will be much helpful

just to edit i have added following code

<?php  $category_ids = remove_element(get_all_category_ids(),'274');
     if (in_category($category_ids)) { ?>

this code is not working but if i pass a single category id to in_category() function like

 <?php  
         if (in_category('8')) { ?>

if block is working fine.i am clueless what is going wrong Thanks in advance

share|improve this question
    
Have look at this plugin as it may save you a lot of coding wordpress.org/extend/plugins/author-avatars to show the Author info. Doesn't solve the single only problem. –  Pbearne Oct 13 '11 at 18:38
    
i saw that plugin before but i have to fetch a lot of information from the gravatar so can't use that plugin.Thanks for the suggestion an pointer –  Umesh Awasthi Oct 13 '11 at 19:19
add comment

1 Answer

up vote 0 down vote accepted

Where is your code for the author appearing (what files > category / post / single?)?

I would guess you have the author code within either a category or post template file, simply add the author code to the single template file (create single.php if you don't have one) and remove from the upper level files.

** To answer your question (based on comments below)

You would want to create a new sidebar template (sidebar-single.php) and pull that sidebar into your single.php

share|improve this answer
    
I have put the code in sidebar.php myself –  Umesh Awasthi Oct 13 '11 at 18:15
    
so you would want to create a new sidebar template (sidebar-single.php) and pull that sidebar into your single.php –  Devise Oct 13 '11 at 18:17
    
:Thanks for the help but being new can you help me to understand these lines "simply add the author code to the single template file (create single.php if you don't have one) and remove from the upper level files. " since i already have single.php in side my theme file –  Umesh Awasthi Oct 13 '11 at 18:22
    
paste the contents of your single.php & sidebar.php –  Devise Oct 13 '11 at 18:29
    
@Davis Thanks with your suggestion i am able to solve the problem i created a copy of sidebar.php and rename it as sidebar-single.php and in my single.php i did the following thing <?php get_sidebar('single'); ?> i hope i am followed the right approach? –  Umesh Awasthi Oct 13 '11 at 18:33
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.