Filter posts by custom field (include/exclude input);

Posted in: Newspaper
Post count: 196

Is there an example of this being done?
Can I filter posts by date using custom fields? if so, is there an example of how?

Post count: 27744

Hello,

Yes, you can use the custom field to filter on the block the posts/cpts.
For this, you need to use a custom filed type, true/false. When it is true the value set the posts will be included or excluded https://i.imgur.com/DOmaF9n.png

Thank you!

Post count: 196

From the custom field, can I pull if I set it up for a certain date? Thats what I am trying to do.

Post count: 27744

Hello,

I’m sorry, but I’m not sure I fully understand what you are trying to achieve. Could you explain once again with some screenshots, please?
A solution for sending a screenshot/video is this:
Download, capture, send: https://www.techsmith.com/jing-tool.html
After making the screenshot, you will have a link, paste it here.

Thank you!

Post count: 196

The first image shows the custom field I am using, the name, and I am using the date picker: https://ibb.co/PY9dBdB

This image shows that it’s displaying on the backend of WordPress. I would enter a date on the post, which is when the shoes will release to the public: https://ibb.co/SvwV3rc

I am trying to use the posts to display the posts that have a date via the date picker. Also, I would like to display the posts by which shoe is releasing the soonest. If a shoe has already been released, then it won’t be displayed.

Hope this makes sense.

Post count: 27744

Hello,

Unfortunately, you can’t use this one to filter the posts using the custom field. The only option to filter posts on the block using custom filed is to use the custom filed type true/false. What you want to achieve can be done with custom work.

Thank you!

Post count: 4

I’m trying to do just this and I can’t get it to work. I have a CPT for job listings. The CPT has a true/false field for Featured Jobs (https://imgur.com/xygGcn5). When I add a block to a page (https://imgur.com/yERwc2p) all the CPTs show up but when I add featured_job to “Include custom field:” no CPTs show (https://imgur.com/N07KnDp)…?

Post count: 21065

Hello @offthepath !

It seems to be an issue there.
I will add it to our investigation list!

Thank you so much for understanding!

Post count: 4

Updated to 12.6 last night and now it seems to be working!

Post count: 13

how can I filter more than one value of custom fields in flex loop ?
I tried to seperate two value by (,) but not working and when I use one value it filters fine

https://imgur.com/DbyEfaR

  • This reply was modified 2 years by Obaida.
Post count: 21065

Hello @Obaida!

Unfortunately, you can’t add more custom fields, only one.

Thank you!

Viewing 11 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic.