Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- date_default_timezone_set('America/Argentina/Buenos_Aires');
- @set_time_limit(0);
- require('wp-config.php');
- require('wp-admin/includes/taxonomy.php');
- $ARCH = file_get_contents('archivo.txt');
- $FRA = preg_split("|[\r\n]+|i", $ARCH, -1, PREG_SPLIT_NO_EMPTY);
- $CONTE = ""; $CUAL = "odd"; $X = 0; $PE = ""; $Za=1;
- foreach($FRA as $FR){
- $CONTE = "<p><strong>".$FR.".</strong> "</p>\n"; //Contenido del post!
- $post = array(
- 'post_content' => $CONTE,
- 'post_title' => "NO SE QUE TITULO USAS... puede ser Frase 1234... o lo que sea",
- 'post_status' => "publish",
- 'post_type' => "post",
- 'ping_status' => "closed",
- 'post_date' => date("Y-m-d H:i:s",time()),
- 'post_date_gmt' => date("Y-m-d H:i:s",time()),
- 'comment_status' => "open",
- 'post_category' => array(CrearCat("CATEGORIA")),
- 'tags_input' => "tags separados por coma",
- );
- $ID = wp_insert_post($post);
- $post = "";
- $CONTE = "";
- echo "Posteado: ".$FR."<br/>";
- }
- function EliminarN($T){
- $tofind = "1234567890";
- $replac = " ";
- $mensaje = strtr($T,$tofind,$replac);
- return trim($mensaje);
- }
- function CrearCat($T,$ST=""){
- $cat_ID = get_cat_ID($T);
- if($cat_ID == 0) {
- if($ST!="") $cat_ID = wp_create_category($T,CrearCat($ST));
- else $cat_ID = wp_create_category($T);
- }
- return $cat_ID;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement