本文整理匯總了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);
}
}