Tagged: 0.9.9.7, piklist_add_meta_box
- This topic has 3 replies, 2 voices, and was last updated 5 years, 6 months ago by
cdcorey.
-
AuthorPosts
-
-
April 14, 2016 at 4:53 pm #6293
cdcoreyMemberI have a custom metabox that I’d like to be able to have appear on different post types by choosing them in the admin, rather than hardcoding it into the metabox file.
I found this post that talks about doing something similar by hooking into the piklist_add_meta_box filter.
Unfortunately, piklist_add_meta_box is not even listed in the User Guide. I can’t find any documentation on the format of the data filtered by that hook, and I can’t get it to print anything out that I can examine to figure it out myself (I can’t even tell for sure that the hook actually runs). I know from the post linked above that my function should accept a $data array and $post, and return $data, but it’s hard to do much with that without knowing what the contents of $data is expected to look like.
Is this the right way to do this? If so, can someone elucidate me on the specifics of the $data array?
I’m using Piklist 0.9.9.7, by the way.
-
April 18, 2016 at 11:53 pm #6304
JasonKeymasterHi @cdcorey!
My apologies for the lack of documentation. We’re putting our effort into making a new and improve documentation site.
From 0.9.9.7 on you can use the
piklist_part_processhook. The first parameter is the part that you’ll be changing the post types for, and the second parameter is the folder the part is in (e.g. metabox, settings, etc.). If you like looking at source code to learn more, check out the process_parts function in the piklist/includes/class-piklist.php file.Hope this helps! 🙂
-
April 19, 2016 at 10:23 am #6313
cdcoreyMemberThanks Jason, that sounds like just what I need.
I look forward to the new documentation site. I hope it’ll be a Wiki – I understand the Piklist team may have limited time to write it, but with the assistance of the community, the documentation could easily be a lot more thorough. For example, since I’m going to have to dig through the code for
piklist_part_processanyway, I wouldn’t mind making some documentation notes while I’m at it, but the current docs site provides no way for me to do that. -
July 29, 2016 at 3:51 pm #7060
cdcoreyMemberIf anyone else comes across this thread while looking for this information, the Piklist Documentation has since been updated with an overview of the
piklist_part_processhook:
-
-
AuthorPosts
- The topic ‘piklist_add_meta_box $data array format’ is closed to new replies.