WordPress.org

Ready to get started?Download WordPress

Forums

how do i use the role of the author in wordpress loop and wp_query? (3 posts)

  1. Lenley
    Member
    Posted 4 years ago #

    How do i use the role of the author in wordpress loop and wp_query?

    I want to restrict (or include) authors on various wordpress pages (home and category pages) by the wp_role the author has.

    So, I need to know how to do this in both:
    1.) query posts (for homepage)
    2.) wp_query (for other pages)
    I would like to do this in the most efficient manner possible.

    e.g. On my homepage:
    a.) Restrict contributor posts from display.

    e.g. On my category pages:
    a.) Posts order by (Editors first, Authors second, Contributors last)

    I looked on the query post and wp_query and had no luck finding the way to do it.
    http://codex.wordpress.org/Template_Tags/query_posts#Author_Parameters

    Thanks

  2. Lenley
    Member
    Posted 4 years ago #

    So, basically I know it involves something like this:
    Sorry, I'm not familiar with php yet.

    foreach post in posts:
    (list) homepage_posts
    if post.author.role != contributor:
    homepage_posts.add(post)

    thanks anybody for help.

  3. Lenley
    Member
    Posted 4 years ago #

    Maye this is an advanced question?

Topic Closed

This topic has been closed to new replies.

About this Topic