Answer the question
In order to leave comments, you need to log in
How do I add a custom field for the Carbon Fields plugin for my post type?
I created my own type of portfolio posts and in it I will store the work from the portfolio.
Now I need to have a custom field of the Carbon Fields 2.2 plugin appear on the posts page .
First I tried to add
it. It didn't work.
Then I tried through associationswhere('post_type' = 'portfolio')
Container::make('post_meta', 'Контент страницы Портфолио')
->add_tab('Ссылка на работу', array(
Field::make( 'association', 'crb_association' )
->set_types( array(
array(
'post_type' => 'portfolio',
)))
->set_required(true)
));
Answer the question
In order to leave comments, you need to log in
Decided as follows
Container::make( 'post_meta', 'Портфолио' )
->where( 'post_term', '=', 'portfolio')
->add_tab('Ссылка', [
Field::make( 'text', 'portfolio_link', 'Ссылка на портфолио')
]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question