Skip Navigation

[Resolved] Creating my Own "Posts Status" and Placing them on CRED

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 6 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 8 replies, has 2 voices.

Last updated by theW 6 years, 3 months ago.

Assisted by: Nigel.

Author
Posts
#600936
PS.png

Tell us what you are trying to do?

Using VIEWS, I'm setting up a few filters to display the Current Logged in User Custom Posts in a Front Page, separated by Tabs. I know how to set up all this...

My question is:
WHAT WOULD BE BETTER, OR WHAT WOULD ALLOW FOR MORE FLEXIBILITY, FROM THE 2 OPTIONS BELOW? :

* A - Keep using my Custom Field "Status", a radio field with 3 options (can this be filtered?)
OR
* B - Create my Own "Posts Status" and Place this as an editable field on my CRED post editor, for other authors to select their post status and later on be able to filter them as such.

Either or, the goal is to filter this Custom Posts "Projects" in 3 categories:

1- Funding
2- Open
3- Closed

Is there any documentation that you are following?
None

Is there a similar example that we can see?
Please see the image attached

What is the link to your site?
hidden link

#601110

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi there

Firstly, please note that you are posting in the Community Forum for users of the free Types plugin. As a Toolset customer you can and should post in the Technical Support forum which we prioritise and where you should receive speedier service.

I recommend you use a custom field for your status.

If you use a custom post_status you will have to set that up yourself, there is nothing in Toolset to help you do that, but—more importantly—you cannot add a field to directly set the post status to a CRED form.

You would need to add a generic field for the status and then use the CRED API to modify the post status after the form was submitted.

It is very much do-able, but requires you writing some PHP.

If you use a custom field to record status you won't need to.

#601148

Thank you for your response Nigel,
Indeed, the custom field for the status function would be a lot easier.

The next challenge after that would be:

Can I create a VIEW FILTER based of this "Status" Custom Field ?

The goal is:
Have a page with 3 tabs, or simply 3 pages in the site –

#1 FUNDING - Will display the Current Logged in User's Custom Posts that are marked with a "Funding" status.
#2 OPEN - Will display the Current Logged in User's Custom Posts that are marked with a "Open" status.
#3 CLOSED - Will display the Current Logged in User's Custom Posts that are marked with a "Closed" status.

See what I mean?

I have successfully configured a view to display ALL the Current Logged in User's Custom Posts, so I have an idea of how to do it but I would appreciate your help if you could tell me how to filter them based on this "Status"

Thank you!

#601156

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

You need to add a Query Filter where you specify the status custom field value.

That is described here: https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/

That would involve creating 3 Views, one for each status.

If you want to be a bit smarter about it you can supply the value as a shortcode attribute where you insert the View.

That's described here: https://toolset.com/documentation/user-guides/passing-arguments-to-views/

#601169
2.png
1.png
Tabs.png

This is Awesome!
Thank you so much Nigel!

I tried following the tutorials but I'm still a little unclear...

If I "supply the value as a shortcode attribute" do I still need to create 3 different views?

I decided to make 4 tabs in the layout...
#1 ALL (I added my "Current Users Projects" View)
#2 FUNDING .. I tried inserting the same view above but with a new filter (see attached "2.png")
#3 OPEN
#4 CLOSED

... That seems to have also added to the first tab..

Could you please explain what am I doing wrong?

#601734

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi there

Sorry for the delay in getting back to you, I was away over Christmas.

The problem you have here is that you can only add shortcode attributes when the View is inserted with a shortcode.

In your example you are inserting a View into a Layout with a View cell, and you cannot add the attribute to the View cell.

Instead, insert your View into the Layout using a Visual Editor cell, and then use the Field and Views button to insert the View into the Visual Editor cell.

That will insert the wpv-view shortcode, and you can manually edit it to add the shortcode attribute used in the View filter (e.g. status="funding" for a View filter that uses the shortcode attribute status).

#602309

No problem.
Thank you for getting back to me.
Ok.. I think I kind of understand...

Would you be so kind and sending a few screenshots of what you mean?
Please also answer my question:
If I "supply the value as a short code attribute" do I still need to create 3 different views?
or this one view I already created is enough?

Look forward to hear from you.
Thanks again!

#602675

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

layout.png
filter.png

Let me try again.

For my sample site I have a custom post type "Things" with a custom field "status" with possible values "funding", "open", "closed".

I create a View "Things filtered by status" which displays the Things post type and has one Query Filter, as shown in the screenshot filter.png

The filter is for the status custom field, and the value of the filter comes from the shortcode attribute which I have also called status, but I could have called anything.

Now, in my Layout I have inserted a tabs cell.

In the first tab "All" I have inserted a Visual Editor cell and added the View using the wpv-view shortcode with no status attribute set, so all posts will be shown.

In the second tab "Funding" I have inserted the same View into a Visual Editor cell, and have this time edited the shortcode to include the attribute status="funding".

In the third tab "Open" I insert the same View the same way, this time with the attribute status="open".

I repeat this for the fourth tab and the Closed status.

You should be able to see that in the layouts.png screenshot.

Now when visiting a page with this Layout I see the tabs with the modified View showing the relevant posts in each tab.

That's all there is to it. If you have any more problems, please let me know.

#603197

TERRIFIC!!
Thank you so much Nigel.
I got the result as required.

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.