WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Adding plugins meta box's to custom post types (12 posts)

  1. davidsword
    Member
    Posted 4 years ago #

    I'm using a plugin in wp 2.9, that adds a meta box to posts:

    (http://mondaybynoon.com/wordpress-attachments/ - it allows users to add and drag-n-drop image fields while Posting)

    I was wondering if there's anyway in WordPress 3 to allow plugins such as this to be shown in the custom post types,.. perhapes in the register_post_type() 'supports' argument?..

    (like so: http://i41.tinypic.com/5mamr.jpg )

    any help / guidance / clarification is greatly appreciated,

  2. MichaelH
    Member
    Posted 4 years ago #

    What about using the register_meta_box_cb argument with register_post_type()?

    Don't know how well it works but here's one example:
    http://bit.ly/bRjAzS

    or this:
    http://bit.ly/cG59rT

  3. davidsword
    Member
    Posted 4 years ago #

    Thank you for the link - that artical provided a lot of insite.

    After 2 solid days of research & trial+error, I found all I had to do was add:

    // add custom meta to custom post type 'portfolio'
    	add_meta_box( 'attachments_list', __( 'Attachments', 'attachments_textdomain' ), 'attachments_add', 'portfolio', 'normal' );

    to the attachment where it declares it for 'posts' and 'pages'.

    :)

  4. japer
    Member
    Posted 4 years ago #

    hello david.

    could be explained as you did?

    I'm trying and I could not ...

    I thank you infinitely.

  5. davidsword
    Member
    Posted 4 years ago #

    to my understanding,

    for meta boxes to be added to the "post" or "page" Write screens, authors of the plugins need to use "add_meta_box(" to declare it in the different post types with the 4th argument "$page" of add_meta_box .. soo if you have a new custom post type, ie: 'portfolio', you have to add that you want the meta box to be on the 'Portfolio' write screen with "add_meta_box()" -- just as it should be already with 'post' andor 'page'

    so all i did was search the desired plugins source for "add_meta_box(" and added the previous code beneath the two already there to put the meta box in 'posts' and 'pages'

  6. shableep
    Member
    Posted 4 years ago #

    sweet. this worked perfectly for me. thanks.

  7. whipd09
    Member
    Posted 4 years ago #

    Great fix. I could get Microkid's Related Posts to now appear in my custom-post Portfolio edit page. However I need it to search for portfolio custom-post items instead of regular posts as well. Do you think that's only another tweak as well?

    http://wordpress.org/extend/plugins/microkids-related-posts/

  8. Devin Price
    Member
    Posted 4 years ago #

    I wrote a step by step guide for adding metaboxes to custom post types. Perhaps it'll be helpful: http://wptheming.com/2010/08/custom-metabox-for-post-type/

  9. maorb
    Member
    Posted 3 years ago #


  10. Alain
    Member
    Posted 3 years ago #

    thanks david! that saved me two solid days...

  11. chipperson
    Member
    Posted 3 years ago #

    David... THANK YOU! this was exactly what I was looking for :D

    And Devin- thank you too!!! i feel like I won the lottery after landing on this page :)

  12. Jonathan Christopher
    Member
    Posted 3 years ago #

    Hey everyone, just wanted to make it known that Attachments has supported additional content types for some time now, under Settings there is an area for Attachments and you can pick/choose which CPT you'd like to use.

Topic Closed

This topic has been closed to new replies.

About this Topic