Forum

Thread tagged as: Question, Problem, Configuration

Can you change blog post fields depending on the category selected?

Hey guys,

Just wanted to know if I can show / hide blog fields that a user can access dependant on the category they choose to post into?

I have three categories but the third may well have fields not needed by the others and I'm trying to find a nice way in order to ensure users don't fill out fields that have no use for specific categories.. It's mind boggling me right now.

Help appreciated as ever

Mathew Doidge

Mathew Doidge 2 points

  • 6 years ago

You could create different forms for the different categories, then display the particular form based on the category of that blog post which the person is viewing/commenting.

Is this helpful? Do you have some examples from your templates you could post for more complete answers and examples?

Hi Robert,

After some reading and help from Clive I think I need to change post types so I can then make a template for each post type. I've never done this before so I've no code yet other than actually outputting latest posts to the homepage. I'll take a look tonight and post my attempts unless in some fluke I get it working first time around.

I assume blog post types will be selectable on the post story page and that I can then template different fields depending on the post type. I'll scout the documentation again for a starting point.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, that's right - post types have different fields.

Hey Mat,

I would be interested to see how you do that. If you get it to work, would you mind sharing some tips here?

Cheers,

Robin Pick said:

Hey Mat,

I would be interested to see how you do that. If you get it to work, would you mind sharing some tips here?

Cheers,

Hi Robin,

I will write up my approach and post here as others may have improvements. I think I've managed to work it all out now, although the only thing that is a little crude at this stage is changing post type as from what I can see you have to post before the fields actually change.