• If you try to filter by customfield_name/customfield_value and also have customfield_orderby set, nothing seems to be shown. One or the other works.

    Looking at your code you seem to have a bug around line 101 in CatList.php

    No meta_query is set for the customfield_name/customfield_value pair. I think they need to be in an array which is itself in an array ‘meta_query’ in $args.

    See examples of WP_Query definition in the Codex- the format is like:

    'meta_query' => array(
           array(
               'key' => 'age',
               'value' => '24',
               'compare' => '=',
           )
       )

    Thanks for an otherwise very useful plugin.

    https://www.ads-software.com/plugins/list-category-posts/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Fernando Briano

    (@fernandobt)

    I tried this code on my test blog:
    [catlist excludeposts=this customfield_orderby=Comics customfield_name=Comics customfield_value="DC" customfield_display=Comics]

    And I get the only 2 posts which have their custom field “Comics” set to “DC”. If I change it to “Marvel”, I get the posts which have their custom fields set to “Marvel”. And the display works too.

    Perhaps you were trying to filter by more than one custom field value?

    Thread Starter AACT

    (@aact)

    Hi, thanks for taking a look so quickly.
    No, I wasn’t trying to filter by more than one custom-field value.

    My query is
    [catlist customfield_orderby=rva_firstname customfield_name=rva_persontype customfield_value=Staff]

    i.e. I want all the people who are members of staff, with the list ordered by their first names.

    Your code puts a meta_key into $args of rva_persontype at around line 101 in CatList. It then overwrites this further down with rva_firstname when it looks at the customfield_orderby.

    I can’t see anywhere that you are putting a meta_query into $args, which is what is needed to do the customfield_name,custom_field_value matching[at least when meta_key is also needed for use with the orderby]

    I’ve patched CatList.php and it seems to work fine now.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Missing meta_query’ is closed to new replies.