本文整理汇总了PHP中WP_Import::import_file方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Import::import_file方法的具体用法?PHP WP_Import::import_file怎么用?PHP WP_Import::import_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Import
的用法示例。
在下文中一共展示了WP_Import::import_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: file
if (file_exists($class_wp_importer)) {
require_once $class_wp_importer;
} else {
$error = true;
}
}
//check if the wp import class is available, this class handles the wordpress XML files. If not include it
//make sure to exclude the init function at the end of the file in kriesi_importer
if (!class_exists('WP_Import')) {
$class_wp_import = TEMPLATEPATH . '/lib/importer/class.wordpress_importer.php';
if (file_exists($class_wp_import)) {
require_once $class_wp_import;
} else {
$error = true;
}
}
if ($error !== false) {
echo "The Auto importing script could not be loaded. please use the wordpress importer and import the XML file that is located in your themes folder manually.";
} else {
if (!is_file($file)) {
echo "The XML file containing the dummy content is not available or could not be read in <pre>" . TEMPLATEPATH . "</pre><br/> You might want to try to set the file permission to chmod 777.<br/>If this doesn't work please use the wordpress importer and import the XML file (should be located in your themes folder: dummy.xml) manually <a href='/wp-admin/import.php'>here.</a>";
} else {
$optionFields = array('_tdCore-logo' => '' . site_url() . '/wp-content/themes/James/lib/importer/dummy/JAMES-WP-LOGO.png', '_tdCore-home-bgType' => 'gallery', '_td-home-bgGal-speed' => '2', 'td-galleryCount' => '3', '_tdCore-galleryImg_1' => '' . site_url() . '/wp-content/themes/James/lib/importer/dummy/dummy900x720-1.jpg', '_tdCore-galleryImg_2' => '' . site_url() . '/wp-content/themes/James/lib/importer/dummy/dummy900x720-2.jpg', '_tdCore-galleryImg_3' => '' . site_url() . '/wp-content/themes/James/lib/importer/dummy/dummy900x720-3.jpg', '_tdCore-rasterEffect' => 'small squares', '_td-hoverColor' => 'ff00ff', '_tdCore-copyName' => 'Theme Dutch', '_tdCore-copyLink' => 'http://www.theme-dutch.com', '_tdCore-p-font' => 'News Cycle', '_tdCore-h-font' => 'News Cycle');
foreach ($optionFields as $field => $new_data) {
update_option($field, $new_data);
}
$wp_import = new WP_Import();
$wp_import->fetch_attachments = true;
$wp_import->import_file($file);
}
}