Forums

[resolved] simple query_posts problem (3 posts)

  1. jmhagerman
    Member
    Posted 2 years ago #

    All I am trying to do is pass the author ID variable to a query_posts statement so that I can display the last 5 posts by the same author of the existing post but in a different category.

    Here is what I have tried:
    <?php query_posts('show_posts=5&author=post_author->ID&category_name=deals'); ?>

    This obviously isn't working so my question is how do I pass the post_author ID to the 'author' variable?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Try:

    <?php query_posts('posts_per_page=5&author=' .$post->post_author' . '&category_name=deals'); ?>

  3. jmhagerman
    Member
    Posted 2 years ago #

    esmi,

    That was the ticket! With one exception which I am sure was just a typo - needed to remove the ' after post_author.

    Thanks for your help! I knew it had to be simple...

Topic Closed

This topic has been closed to new replies.

About this Topic