2

Is there a way to return channel entries based on a custom field type value? I have set up a custom field type and I want to be able to return channel entries that just a have a specific value for that field. Is that possible?

Oh, and just to make it more complicated I can't use the search:field_name= parameter because:

  1. The custom fieldtype I need to search is a P&T Dropdown
  2. I actually need to also return any results that match a specific author_id= value in the same channel entry results
  3. I really need to query multiple custom fields across multiple channels

So what a I really need is a OR type query using a custom field as a parameter. I thought about creating a custom query or even making a quick plug-in, but the channel entries table along with trying to query custom field data is so convoluted. It's seriously a complete nightmare.

I'm open to any suggestions. Thanks.

1

I think this is a good candidate for the Channel Query plugin. It has all of the features of {exp:channel:entries}, with the flexibility of the Query module.

{exp:channel_query 
    sql="SELECT entry_id FROM exp_channel_titles WHERE /* your custom query here */"
}
    <!-- all channel entries variables can be used here -->
{/exp:channel_query}

Your custom query gets the entry_id's that match your criteria. Then, because you've got all the parameters and variables that come with the channel:entries tag, there should be no further querying for entries-related data needed. Just template as usual, as if you are using the native channel:entries tag.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.