• 断然的 普拉迪语

    (@pradesh)


    我目前正在编写一个word press自定义帖子,在这里我从mysql数据库中获取内容,并使用wp_insert_post以编程方式创建帖子。完成此操作后,将按预期获取并显示标题和描述。然而,图像并没有显示出来,而是只打印了url。

    请找到与图像显示相关的代码(我不确定是否需要添加任何其他标记)。

    'post_content'=>wp_strip_all_tags($result->descriptions.“.$result->image),

    请查找与获取和显示逻辑相关的完整代码。

    函数techiepress_query_garage_table($car_available_in_cpt_array){全局$wpdb;$table_name=$wpdb->前缀。'车库';如果(NULL===$car_available_in_cpt_array ||0===$car_avalable_in_cpt_array||'0'===$car_avaailable_in.cpt_arrary||空($car_aavailable_in _cpt_aerray)){$results=$wpdb->get_results(“从$table_name选择*”);返回$results;}其他{$ids=内爆(“,”,$car_available_in_cpt_array);$sql=“从$table_name中选择*WHERE id NOT IN($ids)”;$results=$wpdb->get_results($sql);返回$results;}}函数techiepress_insert_into_auto_cpt(){$car_available_in_cpt_array=technicepresss_check_for_similar_meta_ids();$database_results=techiepress_query_garage_table($car_available_in_cpt_array);如果(NULL===$database_results||0====$数据库_results ||'0'===$database_ results| | empty($database_nresults)){回报;}foreach($database_results作为$result){$car_model=数组(“post_title”=>wp_strip_all_tags($result->品牌),“post_content”=>wp_strip_all_tags($result->descriptions.“”.$result->image),“meta_input”=>数组(“id”=>$result->id,“品牌”=>$result->品牌,“model”=>$result->model,“color”=>$result->color,“km”=>$result->km,),'post_type'=>'auto',“post_status”=>“发布”,);wp_insert_post($car_model);}}

    我需要帮助的页面:[登录查看链接]

查看2个回复-1至2(共2个)
  • 目标Infosoft

    (@aimsinfosofts)

    你好,

    请删除“post_content”中wp_strip_all_tags()中的图像。

    请使用:
    “post_content”=>wp_strip_all_tags($result->descriptions)$结果->图像,

    谢谢

    螺纹起动器 普拉迪语

    (@pradesh)

    嘿,它很管用!!!!。
    谢谢。

查看2个回复-1至2(共2个)
  • 主题“如何以程序方式显示自定义帖子类型的图像缩略图”对新回复关闭。