I would like to add a custom field to the WP Post
name: icon
value: $my_value
so i tried something like this
$favicon = get_option('aa_favicon');
$addicon = add_post_meta($post_ID, 'icon', $favicon, true);
$post_data = compact('....,'addicon')
not working....
Any ideas? be explicit please...i can't even call myself a noob at php.
Thank You
name: icon
value: $my_value
so i tried something like this
$favicon = get_option('aa_favicon');
$addicon = add_post_meta($post_ID, 'icon', $favicon, true);
$post_data = compact('....,'addicon')
not working....
Any ideas? be explicit please...i can't even call myself a noob at php.
Thank You
Code:
$pd = $days;
if ($pd == 'now') {
$post_status = 'publish';
$post_date= current_time('mysql');
$post_date_gmt= current_time('mysql', 1);
} else {
$tomorrow = mktime(0, 0, 0, date("m"), date("d")+$pd, date("y"));
$post_date_gmt=date("Y-m-d", $tomorrow). " " . rand(10, 23). ":" . rand(10, 59). ":" . rand(10, 59);
$post_date = $post_date_gmt;
$post_status = 'future';
}
$post_author=1;
$post_category = array($categorie);
$post_content=$content;
$badchars = array(",", ":", "(", ")", "]", "[", "?", "!", ";", "-");
$title2 = str_replace($badchars, "", $title);
$items = explode(' ', $title2);
$thetag = array();
for($k = 0, $l = count($items); $k < $l; ++$k){
$long = strlen($items[$k]);
if ($long > 3) {
$thetag[] = $items[$k];
}
}
$tags_input = array($thetag[0],$thetag[1],$thetag[2],$thetag[3],$thetag[4],$thetag[5],$thetag[6],$thetag[7],$thetag[8],$thetag[9]);
$post_title = trim($title);
$post_data = compact('post_content','post_title','post_date','post_date_gmt','post_author','post_category', 'post_status', 'tags_input');
$post_data = add_magic_quotes($post_data);
$post_ID = wp_insert_post($post_data);
if ( is_wp_error( $post_ID ) )
echo "\n" . $post_ID->get_error_message();
do_action('publish_phone', $post_ID);
echo "Created Post for <a href=\"$target_url\">$title</a><br/>";