custom post meta
-
I seem to be having issues with custom post meta when I input html into it.
I’m trying to add youtube code to embed per custom post kind of like an image tied to the post here is the code:
<iframe title="YouTube video player" width="560" height="349" src="https://www.youtube.com/embed/ytW-DO05vdM" frameborder="0" allowfullscreen></iframe>
I’m assuming I’m not escaping characters somewhere?
but it ends up doing this:
https://localhostr.com/files/qaYpxBE/Picture+5.jpghere is my functions php file:
<?php add_action('init', 'package_register'); function package_register() { $args = array( 'label' => __('packages'), 'singular_label' => __('package'), 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'hierarchical' => false, 'rewrite' => true, 'supports' => array('title', 'editor', 'thumbnail') ); register_post_type( 'package' , $args ); } add_action("admin_init", "admin_init"); add_action('save_post', 'save_embed'); function admin_init(){ add_meta_box("prodInfo-meta", "package Options", "meta_options", "package", "side", "low"); } function meta_options(){ global $post; $custom = get_post_custom($post->ID); $embed = $custom["embed"][0]; echo '<img src="https://www.discountslideshows.com/wp-content/themes/slideshow/images/vimeo.png"><br /><label>embed:</label><input type="text" name="embed" value="'. $embed .'" />'; } function save_embed(){ if(isset($_POST["date"])) update_post_meta($post->ID, “horario”, $_POST["date"]); global $post; update_post_meta($post->ID, "embed", $_POST["embed"]); } // custom table columns register_taxonomy("catalog", array("package"), array("hierarchical" => true, "label" => "Catalogs", "singular_label" => "Catalog", "rewrite" => true)); if ( function_exists('register_sidebar') ) register_sidebar( array( 'name' => __( 'Primary Widget Area', 'twentyten' ), 'id' => 'primary-widget-area', 'description' => __( 'The primary widget area', 'twentyten' ), 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); ?>
- The topic ‘custom post meta’ is closed to new replies.