How to change the key field when viewing posts in admin?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
17 views
Hey all, starting to get to know VP, I don't know how to ask a question.
The essence, I need the slider with the range of colors you can add new elements using the plugin Advanced Custom Fields I made form like this one:
5ae7671e31def553898856.png
In my type of post, I removed the title and editor, adding to their fields.
In the end, when I save the post, in the list it is signed "Draft".
5ae7683d58e87954313122.png
PS the bottom two posts were done prior to the removal from title of any type of fasting.
Is it possible to make my custom field(e.g. "Size of the rose") key( instead of the Header), or is it better to return the title back to replace it on mine?
Sorry if this question was already asked and thanks in advance to all for answers.
by | 17 views

2 Answers

0 like 0 dislike
When you remove Title from Custom Post Type, it still remains in the table wp_posts, and in fact necessary. It will only disable it in the admin UI. The to field in the database is not empty, WP generates him a default value. You can instead set your own what you want:

my_custom_title function( $data, $postarr ) { if( $data['post_type'] === 'my-post-type' ) { // here assign the desired value // view that in the array $postarr, there should be your custom field $data['post_title'] = 'my post title'; } return $data; } add_filter( 'wp_insert_post_data', 'my_custom_title', 10, 2 );


\rhttps://wp-kama.ru/hook/wp_insert_post_data
by
0 like 0 dislike
Eugene (I hope I guessed nick), you are moving in the right direction -- a great ACF plugin to create custom sliders. To make it even easier -- buy the PRO version, worth$ 25, opens up fantastic prospects.

First, instead of individual records you will be able to use the Repeater (repeater), where you can specify any set of fields. Question about editing on a page with a list of posts will disappear automatically

Here is an example of a slider (each slide photo, city, quote, quotes, width and location):
5afb658dd1327019513135.jpeg

Here's how it looks with ACF PRO
5afb65eeb833b021447084.png

Secondly it is not the only advantages of the Pro version
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
35,456 users