Hi,
I'm new and noob here so hello to everyone :)
First of all I'm totall noob in wordpress.
I'm trying to insert a page programmatically and page is created but no plugin specific content.
I use a plugin that adds a video from youtube (when I do it manually by going to wp admin -> add page and there below the standard fields are those plugin fields that I need to fill to put a video onto the website it works), but when I try to do it with php page is created but no video.
I use wp_insert_post and then add_post_meta.
When using a wp-admin I ran a wireshark to find out what names of the fields I need to insert and added all of them with add_post_meta.
And there's no video.
<?php
require_once('videos/wp-config.php');
function post_video() {
class wm_mypost {
var $post_title;
var $post_content;
var $post_status;
var $post_author;
var $post_name;
var $post_type;
var $comment_status;
}
$wm_mypost = new wm_mypost();
$wm_mypost->post_title = rand(1,1000);
$wm_mypost->post_content = '[imaioVideo v=1]';
$wm_mypost->post_status = 'publish';
$wm_mypost->post_author = 1;
$wp_rewrite->feeds = 'no';
$wm_mypost->post_type = 'page';
$post_id = wp_insert_post($wm_mypost);
if( !is_wp_error($post_id) && $post_id > 0 ) {
$err = add_post_meta($post_id, 'imaioPageType', '0');
add_post_meta($post_id, 'fbPageGroups%5B%5D', 'N');
add_post_meta($post_id, 'startHeight', '');
add_post_meta($post_id, 'layoutSizingSectionClick', '');
add_post_meta($post_id, 'layoutHeader', '1');
add_post_meta($post_id, 'fpColumnLayout', '0');
add_post_meta($post_id, 'leftColWidth', '');
add_post_meta($post_id, 'rightColWidth', '');
add_post_meta($post_id, 'leftSidebarColor', 'FFFFFF');
add_post_meta($post_id, 'leftWidgetColor', 'FFFFFF');
add_post_meta($post_id, 'leftSidebarSpacing', '0');
add_post_meta($post_id, 'rightSidebarColor', 'FFFFFF');
add_post_meta($post_id, 'rightWidgetColor', 'FFFFFF');
add_post_meta($post_id, 'rightSidebarSpacing', '0');
add_post_meta($post_id, 'contentBlockColor', 'FFFFFF');
add_post_meta($post_id, 'postContentSpacing', '0');
add_post_meta($post_id, 'footerWidgetAreaColor', 'FFFFFF');
add_post_meta($post_id, 'footerWidgetSpacing', '0');
add_post_meta($post_id, 'selectedTemplate', 'standard');
add_post_meta($post_id, 'tabLabel', '');
add_post_meta($post_id, 'fbCommentWidth', '450');
add_post_meta($post_id, 'adSize', '120');
add_post_meta($post_id, 'adSpacing', '0');
add_post_meta($post_id, 'ad1Image', '');
add_post_meta($post_id, 'ad1Url', '');
add_post_meta($post_id, 'ad2Image', '');
add_post_meta($post_id, 'ad2Url', '');
add_post_meta($post_id, 'ad3Image', '');
add_post_meta($post_id, 'ad3Url', '');
add_post_meta($post_id, 'wpLikePageArrow', 'optin_sk_down_');
add_post_meta($post_id, 'wpLikeLeftSpace', '50');
add_post_meta($post_id, 'bgImageBeforeLikeHeight', '');
add_post_meta($post_id, 'bgImageBeforeLike', '');
add_post_meta($post_id, 'bgImageAfterLikeHeight', '');
add_post_meta($post_id, 'bgImageAfterLike', '');
add_post_meta($post_id, 'fbLikeBackgroundImageRepeat', 'no-repeat');
add_post_meta($post_id, 'likeRevealArrowOnTop', '4');
add_post_meta($post_id, 'likeRevealArrowLeftMargin', '445');
add_post_meta($post_id, 'likeRevealText', '');
add_post_meta($post_id, 'likeRevealFont', 'Arial');
add_post_meta($post_id, 'likeRevealFontSize', '18');
add_post_meta($post_id, 'likeRevealColor', 'FFFFFF');
add_post_meta($post_id, 'likeRevealTextTop', '5');
add_post_meta($post_id, 'likeRevealTextLeft', '500');
add_post_meta($post_id, 'optinTopArrow', 'top');
add_post_meta($post_id, 'optinVideoTopSpace', '30');
add_post_meta($post_id, 'optinSideArrowTopSpace', '30');
add_post_meta($post_id, 'optinFormTopSpace', '0');
add_post_meta($post_id, 'optinArrow', '1');
add_post_meta($post_id, 'optinCode', '');
add_post_meta($post_id, 'optinBoxWidth', '215');
add_post_meta($post_id, 'optinAppLink', '');
add_post_meta($post_id, 'buttonNum', '0');
add_post_meta($post_id, 'buttonColor', 'red');
add_post_meta($post_id, 'optinButtonUrl', '');
add_post_meta($post_id, 'reviewTemplate', 'rev_contentside_cl');
add_post_meta($post_id, 'reviewArrow', '1');
add_post_meta($post_id, 'affiliateProduct', '');
add_post_meta($post_id, 'prodAffiliateLink', '');
add_post_meta($post_id, 'affLinkText', '');
add_post_meta($post_id, 'rating', '5');
add_post_meta($post_id, 'arrowColor', 'red');
add_post_meta($post_id, 'headline', '');
add_post_meta($post_id, 'headlineFont', 'Arial');
add_post_meta($post_id, 'headlineSize', '18');
add_post_meta($post_id, 'headlineColor', 'C40000');
add_post_meta($post_id, 'headlineTopSpace', '');
add_post_meta($post_id, 'headline2', '');
add_post_meta($post_id, 'headline2Font', 'Arial');
add_post_meta($post_id, 'headline2Size', '14');
add_post_meta($post_id, 'headline2Color', 'C40000');
add_post_meta($post_id, 'headline2TopSpace', '');
add_post_meta($post_id, 'videoSectionClick1', '');
add_post_meta($post_id, 'videoAdminName1', 'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D9hIKNY10G1E%26testtest%26bebe%26url');
add_post_meta($post_id, 'videoCode1', 'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D9hIKNY10G1E');
add_post_meta($post_id, 'videoShadowWidth1', '400');
add_post_meta($post_id, 'videoShadow1', 'tb');
add_post_meta($post_id, 'skinName1', 'Tablet');
add_post_meta($post_id, 'videoCodeWidth1', '400');
add_post_meta($post_id, 'videoAutoplay1', '1');
add_post_meta($post_id, 'videoAlign1', '');
add_post_meta($post_id, 'videoStartMin1', '');
add_post_meta($post_id, 'videoStartSec1', '');
add_post_meta($post_id, 'videoStopMin1', '');
add_post_meta($post_id, 'videoStopSec1', '');
add_post_meta($post_id, 'redirectLink1', '');
add_post_meta($post_id, 'revealTime1', '');
add_post_meta($post_id, 'videoRevealSectionClick1', '');
add_post_meta($post_id, '1svpControlsClick', 'Controls+%26+Embed');
add_post_meta($post_id, '1svpSplashClick', 'Splash+Images');
add_post_meta($post_id, '1svpLogoClick', 'Logo%2FWatermark');
add_post_meta($post_id, '1svpBannerAdClick', 'Banner+Ad');
add_post_meta($post_id, '1svpPinitClick', 'Viral+Buttons');
add_post_meta($post_id, '1svpBuyButtonClick', 'Buy+Button%21');
add_post_meta($post_id, '1svpHtmlOverlayClick', 'Custom+HTML');
add_post_meta($post_id, 'hidePlayBar1', '2');
add_post_meta($post_id, 'splash1', '');
add_post_meta($post_id, 'replacePlayerImage1', '');
add_post_meta($post_id, 'videoAffiliateLink1', '');
add_post_meta($post_id, 'logo1', '');
add_post_meta($post_id, 'logolink1', '');
add_post_meta($post_id, 'logoalpha1', '');
add_post_meta($post_id, 'ad1', '');
add_post_meta($post_id, 'adlink1', '');
add_post_meta($post_id, 'adstart1', '');
add_post_meta($post_id, 'adduration1', '9999');
add_post_meta($post_id, 'vidYouTubeUser1', '');
add_post_meta($post_id, 'pinDescription1', '');
add_post_meta($post_id, 'ppBtnCode1', '');
add_post_meta($post_id, 'ppBtnImg1', '');
add_post_meta($post_id, 'btnstart1', '');
add_post_meta($post_id, 'btnduration1', '');
add_post_meta($post_id, 'html1', '');
add_post_meta($post_id, 'htmlWidth1', '');
add_post_meta($post_id, 'htmlRevealTime1', '');
}
}
?>
Any help will be appreciated.