Tagged: conditions, field
- This topic has 4 replies, 2 voices, and was last updated 5 years, 5 months ago by
hrmervin.
-
AuthorPosts
-
-
August 20, 2016 at 1:36 pm #7199
hrmervinMemberHi Everyone,
I’m stumbling on something likely simple–but I have looked at the documentation, and taken a few minutes to try to find the solution here, and I have not come across the solution yet.MY GOAL: is to create a “mybook_author” field, directly under the title field of my new post type (mybook) and show this field ONLY in the edit window of THIS post type (and not have this field show up in the edit window of other post types).
This is the content of my piklist plugin file defining the new post type, and the field.
https://gist.github.com/MervinHernandez/2e134fd925f19a448a1ed6b7eb91f5e1
-
August 21, 2016 at 7:39 pm #7202
intrepidrealistParticipantHi hrmervin!
In the header of your file after POST TYPE, you need to use the exact word you used to register the post type.
“My Books” is in accurate.So it should be: POST TYPE: mybook.
Also, this file should be placed in the piklist/parts/meta-boxes folder, if you haven’t done so. -
August 21, 2016 at 8:04 pm #7204
hrmervinMemberI’m familiar with how you create a separate meta box, and that you can set ‘false’ for it to look like a meta box, but the function that creates the field by itself, allows it to be visible inline, immediately below the title.
What I accomplished here, next to where I define the post type (in the root of my piklist plugin file) is what I’d like to see, however I’m not sure how to set the condition on this function that displays the field, so it only displays in this post type.
-
August 21, 2016 at 8:15 pm #7206
intrepidrealistParticipantDid you try changing:
POST TYPE: My Bookto:
POST TYPE: mybookSorry, I’m not familiar with using Piklist with plugin development. But, I do know what you have wouldn’t work for me conditionally because it’s not the code name of you Post Type, but the title…
-
August 21, 2016 at 11:26 pm #7213
hrmervinMemberRESOLVED: I removed the default editor in the post type definition + created a “main” meta box to include first, the long field for the subtitle, and then the re-instanced editor box via piklist, immediately below the subtitle field + made the whole meta box NOT look like a meta box.
Thanks for the tweet hint!
-
-
AuthorPosts
- The topic ‘Single Field Condition’ is closed to new replies.