WordPress.org

Support

Support » Themes and Templates » Filter post list with a custom field.

Filter post list with a custom field.

  • Ok folks, I’ll be simple to get a fast response =)

    I have a custom field called “status”, how to make a query to only show posts with “status=1”?

    I know that c2c_get_custom(‘custom_file_name’) return the value of the custom field, but I don’t know how to put that inside the query_posts like for example:

    <?php query_posts(‘showposts=5’); ?>

    EDIT:

    I’m currently trying to do something like this:

    while(have_posts()) {
    the_post();
    if (c2c_get_custom(‘status’) == “1”) {
    // display post
    }

    But I was wondering if there is any other better way to do that.

    EDIT: Please, some moderator change this topic to the right area, sorry for that. I guess its “plugins/hacks”.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Filter post list with a custom field.’ is closed to new replies.