• Resolved Kevin Kwok

    (@queesy)


    scenario: a site with multiple authors. I click into a page about this author, and i want to see a list of categories this author has wrote in.

    how do i do this? im pretty stumped here. also how do i link to those categories?

Viewing 4 replies - 31 through 34 (of 34 total)
  • Hi Barry,

    It may not be immediately obvious, but i’ve spotted your problem.. just here..

    query_posts('cat=6&author=$curauth');

    You can’t use variables inside single quotes, they get treated as literal values.

    The alternatives
    Concatate the string:

    query_posts('cat=6&author=' . $curauth);

    Switch to double quotes so you can use variables:

    query_posts("cat=6&author=$curauth");

    First method will be faster … but you’ll not likely notice the difference. Use whichever suits you, they’ll both essentially do the same..

    Hope that helps.. ??

    Hi t31os_,

    I was hoping you’d reply!

    Actually I figured it out. I ended up going with this:

    query_posts('cat=6&author=$curauth->ID')

    Also I found this “in the woods” article valuable when I was putting this project together.

    thanks much!

    Update:

    My solution did not work after all.

    t310s’s first approach threw an error

    So what worked for me was his second suggestion, using double quotes.

    Thanks again

    Barry

    Hi,

    I am looking to do something along the same lines are the people here also.

    In my sidebar I have author links listed as my headings.
    When someone clicks the link to go to the author page, I’d like a listing to be displayed under there name in the sidebar with all the categories they’ve posted in.

    I am not sure how to get that author specific category listing.

Viewing 4 replies - 31 through 34 (of 34 total)
  • The topic ‘How do I….list categories an author has wrote in on author.php’ is closed to new replies.