Forum

Thread tagged as: Question, Runway, Blog

Filter Blog Posts by Author

Is there a way to do a perch_blog_custom to display blog posts only by a certain author?

Leigh C

Leigh C 0 points

  • 3 years ago

You can get all the posts by Author...

https://docs.grabaperch.com/functions/blog/perch-blog-author/

Here are all the Blog Functions: https://docs.grabaperch.com/functions/blog/

Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hello Leigh,

Yes, you can use the author option which takes the value of author slug:

perch_blog_custom([
    'author' => 'john-silver',
]);

You'd often get the author slug from the URL. For example, if your URL is /blog?author=john-silver:

perch_blog_custom([
    'author' => perch_get('author'),
]);
Leigh C

Leigh C 0 points

Thanks Hussein! That worked.