• Resolved jmhagerman

    (@jmhagerman)


    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?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try:

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

    Thread Starter jmhagerman

    (@jmhagerman)

    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…

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘simple query_posts problem’ is closed to new replies.