• Hi, i have created a custom post type (Hockey) and has registered a taxonomy (Categories). I have also created some meta boxes for handle som basic information about hockey teams like which town, year they started and so on.

    I have follow the Codex how to add_meta and update_meta but when i’m trying to show that info i put in those meta boxes with the function get_post_meta i don’t get anything.

    Do someone have a code i can look at that working so i can try to get this working?

    //Fredrik

Viewing 4 replies - 1 through 4 (of 4 total)
  • do you do anything to save your meta?

    https://wordpress.pastebin.com/0yye4LKM
    Is my working example to add metaboxes to 2 different post types.

    I add the action to add 2 different meta boxes

    Then I define that each uses a callback function per post type

    Define what is displayed on each post type

    Then save it

    I call to it like:

    <a href="<?php echo get_post_meta($post->ID, "_vetitleurl", true); ?>" rel="bookmark" title="Link to <?php echo get_post_meta($post->ID, "_vetitleurl", true); ?>"><?php the_title(); ?></a>

    for instance

    Just a note, the underscore before all my custom field names in all my code keeps that custom field hidden. It doesn’t appear in the normal custom fields menu.

    Thread Starter fanderzzon

    (@fanderzzon)

    Yes, i wan’t to save my meta and also update them. I understand your example but just wonder how you going to show the meta on a post/page?

    I edited my post above to show how I display the meta

    <?php echo get_post_meta($post->ID, "_vetitleurl", true); ?>
    Thread Starter fanderzzon

    (@fanderzzon)

    I just copy the code right of and it works, it’s just that I don’t understand the whole concept, it seem you have use meta for your social media things, i have follow the code from the codex and this tutorial but they are very different. Do you have an easy example for just say like 5 text boxes?

    Thanks for your help, just seems that i’m not at your php coding level ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Meta boxes’ is closed to new replies.