MyBB Community Forums

Full Version: Wordpress help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I know i should be asking @Wordpress, but i am currently banned on the IRC, and i really don't want to talk to them lol.

Here is the code i am using.

<?php
/**
 * @package Hello_Dolly
 * @author Matt Mullenweg
 * @version 1.5.1
 */
/*
Plugin Name: Hello Dolly
Plugin URI: http://wordpress.org/#
Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from <cite>Hello, Dolly</cite> in the upper right of your admin screen on every page.
Author: Matt Mullenweg
Version: 1.5.1
Author URI: http://ma.tt/
*/

function hello_dolly_get_lyric() {
	/** These are the lyrics to Hello Dolly */
	$lyrics = "He who walks the fire breathes
Unlike the rest
Living by the bloody creed
Kirisute gomen
Air of battle tasting stale
Reeks of deceit
Send the bitter straight to hell
Kirisute gomen
In their wretched guts all they want is to feed
Unending, covetous hunger known as greed
As the last legion makes it's way to the skies
I can see in their eyes
They've already died
Inside, but as for the outside
I'll take their fucking heads
Quake has bred with the storm
Conceiving war
Wicked stampeding hordes
Kirisute gomen
I will never be what they
Want me to
I live by my own path in life
No turning
Back now, I won't be held down
Forced into a shallow grave built upon their empty ways
There's no turning back
There's hell to pay, such disarray
A bloodied mess, flesh masquerade
With all the blood making a flood
You made your path by crossing us
He who spits the fire seethes
All he detests
Decapitating, bloody creed
Kirisute gomen";

	// Here we split it into lines
	$lyrics = explode("\n", $lyrics);

	// And then randomly choose a line
	return wptexturize( $lyrics[ mt_rand(0, count($lyrics) - 1) ] );
}

// This just echoes the chosen line, we'll position it later
function hello_dolly() {
	$chosen = hello_dolly_get_lyric();
	echo "<p id='dolly'>$chosen</p>";
}

// Now we set that function up to execute when the admin_footer action is called
add_action('admin_footer', 'hello_dolly');

// We need some CSS to position the paragraph
function dolly_css() {
	// This makes sure that the posinioning is also good for right-to-left languages
	$x = ( 'rtl' == get_bloginfo( 'text_direction' ) ) ? 'left' : 'right';

	echo "
	<style type='text/css'>
	#dolly {
		position: absolute;
		top: 4.5em;
		margin: 0;
		padding: 0;
		$x: 215px;
		font-size: 11px;
	}
	</style>
	";
}

add_action('admin_head', 'dolly_css');

?>

How can i get that to display in a template? What is the code?
I hate registering and posting only once. And i don't want to become a member of there site. (Hence why i am here)
Whatever floats your boat.
@Mark M: No harm in registering. It turns out that once one asks a question, there is a big possibility they'll wander back to ask again - perhaps several months down the line.

I'm guessing you're not the first person to ask about displaying Hello Dolly on the main site (instead of admin interface) so why not do a search there.

Someone even created a plugin so you could put your *own* text.
http://wordpress.org/extend/plugins/fancy-plugin/
I did get it working, i just forgot to echo it Toungue. I just don't like joining things and leaving it. Makes me feel bad.
Thanks for the update Wink