【发布时间】:2014-07-05 19:22:15
【问题描述】:
$insert = $wpdb->insert( $prefix."posts", array("post_title" => $posTitle,"post_content" => $postContent,"post_status" => "publish","post_type" =>"product"));
// select products ID
$select = $wpdb->get_results("SELECT ID AS productsId FROM ".$prefix."posts WHERE post_title='".$posTitle."'");
//echo $select[0]->productsId; die();
// insert Image in pots and product attribute meta posts table
$insertImg = $wpdb->insert($prefix."posts",array("post_status" =>"inherit","post_type" => "attachment","guid" => $postGuid,"post_parent" => $select[0]->productsId ));
我需要一个小的,我需要插入哪个表和列来在 wordpress admin 中显示产品图像,我在 wordpress 中通过查询插入产品而不是通过管理员插入产品。
【问题讨论】:
-
任何人都知道它的简单解决方案
-
管理区在哪里?在帖子列表中?
-
产品 -> 编辑产品 -> 右侧产品图片(特征图片)
-
我有一个实时图像路径cardkingdom.com//product_images/1/9/4/6/6/8/40161_large.jpg 我想存储此路径并在管理员中显示为产品图像
-
是的!我的重点是通过查询插入产品而不是手动编写代码,但图像在管理员中对我不起作用,所以我需要在数据库中使用存储图像并在管理员中显示
标签: wordpress