Viewing 3 reply threads
  • Author
    Posts
    • #6293
      cdcorey
      Member

      I 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.

    • #6304
      Jason
      Keymaster

      Hi @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_process hook. 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! 🙂

    • #6313
      cdcorey
      Member

      Thanks 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_process anyway, 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.

    • #7060
      cdcorey
      Member

      If 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_process hook:

      piklist_part_process [Filter]

Viewing 3 reply threads
  • The topic ‘piklist_add_meta_box $data array format’ is closed to new replies.