Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 创建自定义段塞_Php_Wordpress - Fatal编程技术网

Php 创建自定义段塞

Php 创建自定义段塞,php,wordpress,Php,Wordpress,嘿,所以现在当我发布到WordPress(自动)时,我使用的是这样的东西 $content = '<iframe width="100%" height="315" src="https://www.youtube.com/embed/'.$row['vid_code'].'?vq=hd1080&modestbranding=1&autoplay=1&controls=1&iv_load_policy=3&loop=1&rel=0&s

嘿,所以现在当我发布到WordPress(自动)时,我使用的是这样的东西

$content = '<iframe width="100%" height="315" src="https://www.youtube.com/embed/'.$row['vid_code'].'?vq=hd1080&modestbranding=1&autoplay=1&controls=1&iv_load_policy=3&loop=1&rel=0&showinfo=0&color=white&autohide=0&disablekb=1" frameborder="0" allowfullscreen></iframe>';


// Create post object
$my_post = array(
     'post_title'    => wp_strip_all_tags( trim( $row['title'] ) ),
     'post_content'  => $content,
     'post_status'   => 'publish',
     'post_author'   => 1,
     'post_category' => array( 3 ),
     'post_date' => date('Y-m-d H:i:s')
);
$content='';
//创建post对象
$my_post=数组(
“post_title”=>wp_strip_all_标签(trim($row['title')),
“发布内容”=>$content,
“发布状态”=>“发布”,
“后作者”=>1,
“post_类别”=>数组(3),
“发布日期”=>日期('Y-m-d H:i:s')
);
现在我想知道我需要添加什么才能获得
”$行['video'].
我的部分代码将成为我的网站自定义slug

好问题

尝试将其添加到代码中,它应该会返回您想要的内容。
$new_url=sanitize_title('.$row['vid_code'].')

下面是这样的

$content = '<iframe width="100%" height="315" src="https://www.youtube.com/embed/'.$row['vid_code'].'?vq=hd1080&modestbranding=1&autoplay=1&controls=1&iv_load_policy=3&loop=1&rel=0&showinfo=0&color=white&autohide=0&disablekb=1" frameborder="0" allowfullscreen></iframe>';


// Create post object
$my_post = array(
     'post_title'    => wp_strip_all_tags( trim( $row['title'] ) ),
     'post_content'  => $content,
     'post_status'   => 'publish',
     'post_author'   => 1,
     'post_category' => array( 3 ),
     'post_date' => date('Y-m-d H:i:s')
);

$new_url = sanitize_title(''.$row['vid_code'].'');
$content='';
//创建post对象
$my_post=数组(
“post_title”=>wp_strip_all_标签(trim($row['title')),
“发布内容”=>$content,
“发布状态”=>“发布”,
“后作者”=>1,
“post_类别”=>数组(3),
“发布日期”=>日期('Y-m-d H:i:s')
);
$new_url=sanitize_title('.$row['vid_code'].');