The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Grouping Posts By a Meta Field in WordPress

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #35043

    I have created a custom post type in WordPress, and one of the fields is brewing company. I would like to be able to arrange the post by that field.

    Something like this:

    Brewing Company – Country
    Beer Name, Beer Type

    All of the fields are working properly, but I can’t figure out how to create the correct loop. Here is my loop section for my beers page.


    ID, 'Query', true )); ?>

      ID, 'brewing_company', true); ?> - ID, 'brewing_country', true);?>

    • , ID,'beer_style', true); ?>

    '' ) ); ?>
    ', '' ); ?>

    The Query parameter comes from another meta value on the beers page. That is equal to post_type=beer&showposts=100&order_by=get_post_meta($post->ID, ‘brewing_company’, true).

    Any help would be greatly appreciated. You can see my current progress at

Viewing 1 post (of 1 total)
  • The forum ‘Back End’ is closed to new topics and replies.