Get a free trial // Grow your CSS skills // Land your dream job

Random Slogan Displayer

Last updated on:

Create a text file called slogans.txt with permissions that it can be read by the server. Put each slogan on a different line, e.g.:

Building websites since before there was a web.
The internet is for lovers.

       $f_contents = file ("slogans.txt");
       $line = $f_contents[array_rand ($f_contents)];
       print $line;


  1. Dean Gransar
    Permalink to comment#

    simply briliant!
    unfortunatley I already installed jquerry plugin …
    but probably wordpress takes more hacking since
    it likes get those from a database…

  2. Sarang
    Permalink to comment#

    Hey , I need help 2 create contact & inquiry form in PHP + PHP code if you plz

Leave a Comment

Posting Code

We highly encourage you to post problematic HTML/CSS/JavaScript over on CodePen and include the link in your post. It's much easier to see, understand, and help with when you do that.

Markdown is supported, so you can write inline code like `<div>this</div>` or multiline blocks of code in in triple backtick fences like this:

  function example() {
    element.innerHTML = "<div>code</div>";

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed