Forums

Random quote in header (3 posts)

  1. newcreat
    Member
    Posted 3 years ago #

    I am converting my legacy site (peterwade.com) to WordPress 2.6b, and I'm stuck trying to get a random text quote into the header.

    I first thought of a widget but cannot find how to put a widget into the sidebar, and one that I've set up doesn't work. I need to know the code to place in sidebar.php at the point where I want the widget to display its result. ("A few suggestions" in my current site.)

    Since I could not find how to use a widget in the header, I've tried the procedure I found in the forum... I have a "random_quote.php" file in the current theme directory containing...

    <?php
    	/* Pull quote from file for header                           */
    	$quote = file("inchrist.txt");
    	srand((double)microtime()*1000000);
    	$inquote = $quote[rand(1,count($quote))];
    	/* End pull quote                                       	*/
    echo $inquote;
    ?>

    I have added this to the css style...
    background: url('http://localhost/assets/wp-content/themes/2008/random_teach.php');

    But its not working. Can anyone point me to a tutorial or the correct information I need.

    Thanks,
    Peter

  2. Les Bessant
    Moderator
    Posted 3 years ago #

    If you're using a widget, you manage that from the Widgets panel - you don't need to put anything in sidebar.php.

    If you want to include a random quote, rather than reinventing the wheel, you could try a plugin. I've successfully used

    Random Words

  3. mickdakota
    Member
    Posted 3 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic