Support has been upgraded!
The Support Forum is closed. Not to worry! Providing the top quality support you expect and we're known for will continue! We're not ending support, just changing where you submit requests. This will provide you with the best experience possible.
Premium Support
Have you purchased an addon for Connections such as one of our premium templates or extensions with a valid license and you need help?
Please open a Support Ticket in your user account.
Free Support
Are you using the free Connections plugin? Don't worry, you are still very important to us! We are still providing you with the same high quality support that we're known for.
Please open a new support topic in the WordPress support forums for Connections.
Tagged: 8.5.17, meta_query
- This topic has 7 replies, 2 voices, and was last updated 6 years, 7 months ago by
Steven Zahm.
-
AuthorPosts
-
06/15/2016 at 2:03 pm #379605
John Blausey
ParticipantHi,
I’d like to see if there is a way I can create a page of directory entries, but only those entries that has a field of ‘wabw_wall_of_honor’ that is not empty.
wabw_wall_of_honor is custom field I’ve created.
Is this possible? What sort of tweaks would need to be made?
Thanks
06/16/2016 at 1:03 pm #379733Steven Zahm
Keymaster@ John
I thought I had a working solution for you but in actual testing it did not work :/This should have worked fine. Give it a try just in case it is not working for me.
[connections meta_query='{"meta_key":"wabw_wall_of_honor","meta_value":"","compare":"!="}']
I’m in the process of tracking down why the blank meta_value is being tossed and not used in the query like it should be. I’ll post back once I’ve tracked down and fixed the bug which should be later today. If not, it could be Monday.
06/16/2016 at 2:46 pm #379759John Blausey
ParticipantSteven,
I appreciate you taking a look at this! I’ll experiment with this as well while you do.
Thanks
06/16/2016 at 2:56 pm #379760John Blausey
ParticipantI tried this code, and you right, I get no results. Interestingly, when I look at the ‘wp_connections_meta’ table, the meta_key is stored as ‘Wall of Honor’ instead of ‘wabw_wall_of_honor’.
Thanks again for looking into this.
06/16/2016 at 3:12 pm #379761John Blausey
ParticipantSorry for the multiple postings! Thought it would be helpful to provide the last query (uncommented a line from your code).
https://gist.github.com/brandonjjon/f57de19fc823b119fecdee3c2767e942
06/17/2016 at 5:00 pm #379891Steven Zahm
Keymaster@ John
Ok, I was on the right track! I just need to tweak the syntax a bit. Here’s the shortcode your should use:
[connections meta_query='{"meta_query":{"0":{"key":"wabw_wall_of_honor","value":"","compare":"!="}}}']
This will display all entries who has a
meta_key
ofwabw_wall_of_honor
with ameta_value
that is not empty.This is what you are asking for correct?
06/21/2016 at 3:33 pm #380185John Blausey
ParticipantSteven,
Thanks for this. I had to edit the meta_key slightly, to read “Wall of Honor”, as this is how it is in the database for some reason. But works great now!
Much appreciated.
06/22/2016 at 9:10 am #380318Steven Zahm
Keymaster@ John
Great to hear it is working for you! Sorry about not getting that syntax correct! The meta_query support is not a feature even I use that often but is soooo very handy when you need it.
If you have a moment, I would truly appreciate a review as they really do make a difference. Many thanks in advance!
https://wordpress.org/support/view/plugin-reviews/connections
-
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.