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.

I was wondering if anyone can help me out. I am looking to remove the_content part of the loop on my author pages only. So basically, I just want a list of the author posts with only the title and meta instead of the full post.

When I went to the author.php file, I found this, which I believe is the code that is generating the posts on the Author Pages.

/* Run the loop for the author archive page to output the authors posts
 * If you want to overload this in a child theme then include a file
 * called loop-author.php and that will be used instead.
 */
     get_template_part( 'loop', 'author' );

I'm pretty new at this, so please bare with me.

My question is, how I do I remove the content from the loop for only the Author pages. I wouldn't think that I should remove the function that generates the content from the loop.php file because that would remove it from all posts on my site.

The comments above say, If I want to overload this in a child theme, the include a file called loop-author.php. Can I simply copy all the code from the loop.php file into a new loop-author file, remove the function that generates content from there? Would i have to change any of the parameters in the get_template_part() function?

Again, really new at doing this, so any advice would be greatly appreciated. Thanks a lot.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

If your Parent Theme, has a template file loop-author.php, copy it to your Child Theme; otherwise, copy your Parent Theme's loop.php template file to your Child Theme, and rename it as loop-author.php.

Now, modify your Child Theme's loop-author.php template file, in whatever way you wish.

You don't need to make any other changes, either to the Parent Theme or to your Child Theme. The Parent Theme already accounts for a Child Theme's use of loop-author.php, based on its call to get_template_part( 'loop', 'author' );.

The way such a call works is this: WordPress will look for files in the following order, until it finds one that exists:

  1. Child Theme loop-author.php
  2. Parent Theme loop-author.php
  3. Child Theme loop.php
  4. Parent Theme loop.php

Thus, you see the power and flexibility of get_template_part()!

share|improve this answer
    
Thanks a lot, I really appreciate the fast response. –  kdub Jun 29 '11 at 13:31

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.