This is part of a WordPress plugin script. I am trying to edit it to get my own custom title. The code below returns the text: random_phrase
The 'post_title' => line does not get a random line from the /quotes.txt file. Any idea on why this is not working?
function random_phrase ()
{
$quotes = file ("quotes.txt");
$num = rand (0, intval (count ($quotes) / 3)) * 3;
echo $quotes[$num] . "<br>" . $quotes[$num + 1];
}
// and create a post
$wpvt_post = array(
'post_title' => random_phrase,
'post_content' => $post_content,
'post_author' => $item['item']['post_author'],
'post_status' => $item['item']['post_status'],
);
Aucun commentaire:
Enregistrer un commentaire