Shoutbox

Wordpress help - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: Wordpress help (/showthread.php?tid=62776)

Wordpress help by Tasha on 07-07-2006 at 09:14 PM

Hum... Anyone who's familiar with wordpress will know that it has a description for your blog, which you enter in the options panel. What I want to do is have that random, so it comes up with random quotes everytime my site is loaded. (Am I making sense here? =P) So like, in the description bit on www.tashaj.info, where it currently says "test", say, person a loads the page, it'll say "hi!" and person b loads it and it says "lol", how can I make something that randomises it? So basically like a random word thing... But actually in wordpress.

I know I make zero sense. =P


RE: Wordpress help by Thor on 07-07-2006 at 09:31 PM

If u can add PhP code into that window, then here's some code:

code:
<?php

$textArray[0] = "The first line of text!";

$textArray[1] = "Much text!";

$textArray[2] = "Some text...";



$count = count($textArray);
$count = $count - 1;
$random = rand(0, $count);
echo("<p>" . $textArray[$random] . "</p>");

?>


EDIT: Had done something wrong, fixed now...
I haven't tested it, but it should do the trick. :)
RE: Wordpress help by Nathan on 07-07-2006 at 09:58 PM

That wouldn't work. I tested it and no it doesnt.
I will make one later :P i am still getting my head round php


RE: Wordpress help by Nathan on 07-07-2006 at 10:26 PM

code:
<?
$random_text = array
(
"Random Text 1",
"Random Text 2",
"Random Text 3",
"Random Text 4",
"Random Text 5"
);
$count = count($random_text);
$randomize = (rand()%$count);
echo ("$random_text[$randomize]");
?>

Sorry about the DP. This works and is much better ;)
RE: Wordpress help by RaceProUK on 07-07-2006 at 10:34 PM

Is your blog hosted n a Unix server? If so, there's a program called 'fortune': invoke it, and use the output from it as your quote.

This of course requires you have a Unix server with 'fortune' on the PATH, that PHP has read/execute access to it, and that a PHP module is installed to run server-side programs.