title: PHP - WordPress Script To Get Random Line From Text File
body: <p>Good day. I have a WordPress plugin script here that as below works fine in doing what it should. What I am having trouble with is editing/appending the script to do one additional task that I need. What the plugin does is setup a category in WordPress and then every hour go get a video from Youtube and create a post on the blog.</p>
  
  <p>So for example, if I typed in create category: Siberian Husky's then that category would be created and every hour the script will go get a new video title, video embed and description related to Siberian Husky's.</p>
  
  <p><strong>(How the title is created now with the script ->)</strong> Let's say the first video it get's the title on Youtube is this: White Siberian Husky's Are Loveable</p>
  
  <p>That would be the title to the WordPress post. What I want to do is place a text file on in my sites root directory called /phrases.txt and on each line would be a new phrase. I want this script to go get randomly a new phrase from that text file and put it "in front" of the Youtube title.</p>
  
  <p><strong>(How I want the output to be after getting a random line from my text file ->)</strong> So when the post is made on the blog the title would be: Here Is My Phrase From Text File : White Sibeian Husky's Are Loveable</p>
  
  <p>I hope I made that clear enough. Below is the entire script that get's the data for the video post on the blog.</p>
  
  <p>I believe around line 1861 is where the script writes the title, don't quote me, I am not positive. That part of the code looks like:</p>
  
  <pre><code>// and create a post
          $wpvt_post = array(
              'post_title' =&gt; $content-&gt;items[0]-&gt;snippet-&gt;title,
              'post_content' =&gt; $post_content,
              'post_author' =&gt; $item['item']['post_author'],
              'post_status' =&gt; $item['item']['post_status'],
          );
  </code></pre>
  
  <p>Where the ->title, is creates the title for the post. I am not sure what to change or add to have the script go to my text file and get my phrase I want to add to the title.</p>
  
  <p>Here is a link to the entire script --> <a href="http://textuploader.com/kg8m" rel="nofollow">http://textuploader.com/kg8m</a></p>
  
  <p>It was to large to paste into this post, sorry.</p>
  
  <p>Thank you for your help.</p>