Advertisement
Guest User

Untitled

a guest
Oct 20th, 2014
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.38 KB | None | 0 0
  1. <?
  2.     date_default_timezone_set('America/Argentina/Buenos_Aires');
  3.     @set_time_limit(0);
  4.     require('wp-config.php');
  5.  
  6.  
  7.     require('wp-admin/includes/taxonomy.php');
  8.  
  9.     $ARCH = file_get_contents('archivo.txt');
  10.     $FRA = preg_split("|[\r\n]+|i", $ARCH, -1, PREG_SPLIT_NO_EMPTY);
  11.  
  12.     $CONTE = ""; $CUAL = "odd"; $X = 0; $PE = ""; $Za=1;
  13.     foreach($FRA as $FR){
  14.         $CONTE = "<p><strong>".$FR.".</strong> "</p>\n"; //Contenido del post!
  15.  
  16.         $post = array(
  17.           'post_content'   => $CONTE,
  18.           'post_title'     => "NO SE QUE TITULO USAS... puede ser Frase 1234... o lo que sea",
  19.           'post_status'    => "publish",
  20.           'post_type'      => "post",
  21.           'ping_status'    => "closed",
  22.           'post_date'      => date("Y-m-d H:i:s",time()),
  23.           'post_date_gmt'  => date("Y-m-d H:i:s",time()),
  24.           'comment_status' => "open",
  25.           'post_category'  => array(CrearCat("CATEGORIA")),
  26.           'tags_input'     => "tags separados por coma",
  27.         );
  28.         $ID = wp_insert_post($post);
  29.         $post = "";
  30.         $CONTE = "";
  31.         echo "Posteado: ".$FR."<br/>";
  32.     }
  33.  
  34.     function EliminarN($T){
  35.         $tofind = "1234567890";
  36.         $replac = "          ";
  37.         $mensaje = strtr($T,$tofind,$replac);
  38.  
  39.         return trim($mensaje);
  40.     }
  41.  
  42.     function CrearCat($T,$ST=""){
  43.         $cat_ID = get_cat_ID($T);
  44.  
  45.         if($cat_ID == 0) {
  46.             if($ST!="") $cat_ID = wp_create_category($T,CrearCat($ST));
  47.             else $cat_ID = wp_create_category($T);
  48.         }
  49.  
  50.         return $cat_ID;
  51.     }
  52. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement