WordPress.org

Ready to get started?Download WordPress

Forums

OptionTree
don't know how to use meta boxes (7 posts)

  1. vabmedia
    Member
    Posted 1 year ago #

    Hi,

    I made metaboxes.php then made the function in the functions file to call the metaboxes includes/metaboxes.php. So now what? Do I need to write some more functions to get these metaboxes to show up in my custom post type? What do I do?

    http://wordpress.org/extend/plugins/option-tree/

  2. GotPop
    Member
    Posted 1 year ago #

    Hey vabmedia!
    I'm also trying to figure this out. Shall we both post our findings here? Good luck!

  3. vabmedia
    Member
    Posted 1 year ago #

    Hi DeepTitanic,

    I saw that the Options Framework People posted a tutorial on their site on how to set up metaboxes: http://wptheming.com/2010/08/custom-metabox-for-post-type/

    And I've seen similar examples elsewhere also. I'll be trying it this weekend. Will let you know how it works :-)

  4. Yojance
    Member
    Posted 1 year ago #

    Start with the example code inside the plug-in and learn from that and try to create more advance metaboxes later on.

  5. vabmedia
    Member
    Posted 1 year ago #

    Yes, I figured it out, just using the examples was enough. I also had a custom post type that I was adding meta boxes to, and needed to identify that in page=> "custom-post-type"
    If you just had a regular post you would do page=>post

    I also contacted the developer of the plugin he was really nice and helpful.

    What happened though, was for some strange reason, it wasn't pulling up the meta boxes no matter how many times I went in and revised everything. Finally, what I did was that I changed the actual file name from meta-boxes.php to peru-meta-boxes.php and the meta boxes finally showed up.

    Weird, right?

    The instructions in the documentation were all right, except for just naming my file the standard "meta-boxes.php" didn't work, and when I renamed the file, it worked. Go figure - it's always the simplest thing that you overlook.

  6. vabmedia
    Member
    Posted 1 year ago #

    Ok, so after I got the metaboxes to work, I tried pulling my images using Ot_get_option('metabox-option-name') and It echoed back metabox-option-name. I was trying to get the image url from the upload meta box option.

    This pulled the urls, but didn't pull the image:
    $attachments = get_children( array(
    'post_parent' => get_the_ID(),
    'post_type' => 'attachment',
    'numberposts' => 1, // show all -1
    'post_status' => 'inherit',
    'post_mime_type' => 'image',
    'order' => 'ASC',
    'orderby' => 'menu_order ASC'
    ) );
    foreach ( $attachments as $attachment_id => $attachment ) {
    echo wp_get_attachment_image( $attachment_id );
    }

    So ...now I need to pull each image one by one. How do I do that?

  7. thirtyjin
    Member
    Posted 1 year ago #

    Yes, the same problem;

    I changed the actual file name from meta-boxes.php to xxxx-meta-boxes.php and the meta boxes finally showed up.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic