WordPress.org

Ready to get started?Download WordPress

Forums

Content Types
[resolved] WP_Query and custom fields? (3 posts)

  1. Drivetrain
    Member
    Posted 3 years ago #

    Is there a way to specify custom content type fields in the arguments passed to WP_Query() aka query_posts()? E.g:

    $args = array( 'post_type' => 'asset', 'posts_per_page' => -1 );
    $loop = new WP_Query( $args );
    etc.

    I'd like to be able to use custom fields in WHERE and ORDER BY clauses without writing custom SQL directly. Thanks!

    http://wordpress.org/extend/plugins/content-types-wordpress-plugin/

  2. iambriansreed
    Member
    Plugin Author

    Posted 3 years ago #

    I am doing that on my site.

    I have a content type called projects and I created a loop of that content type on the projects page template:
    http://scottreeddesign.com/projects

    The post_type is the slug of your singular name.
    Does that make sense?

  3. iambriansreed
    Member
    Plugin Author

    Posted 3 years ago #

    The next version will allow you to see the content types slug and define it when creating the content type.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic