Never tell
your girlfriend that her diet is not working.
Another day … another
useless WordPress plug-in. Last night, I was getting
aquatinted with the rand ()
function while trying to pull a random image from my photo gallery. That proved to
be beyond my otherwise hax0r skillz
and I looks like I’ll have to wait for Gallery to get a MySQL back
end.
This little thing is something
I made while playing with the rand ()
function. You can tell I have an very exciting life … anyway, this
plug-in will pull up a random string of text from a file. The plug-in is called with witty ();
, which can be
placed anywhere in your template and used as many times as you want.
Yes, there are hundreds … even thousands of
php scripts that do this, but this one is in a convenient plug-in form, and I guarantee you that it will cook, clean and sexually
please you on demand.
Update (20th October, 2004): The plugin is now compatible with one-click install, so all you need to do now is
initiate it once and then use the link in the plugin description to add your quotes.
Download WP Random Witty Text
1.1 here.
Thanks!
The wise words in the above entry are not produced by the plugin, because you can’t use WP tags in entries … not without some major hacking anyways. So you will have to input witty quotes or an excerpt by hand.
Following is the part of my style sheet that deals with “pull quotes”:
.pullquote {
float: right;
margin-right: 5px;
margin-left: 10px;
margin-bottom: 5px;
width: 100px;
font-family: Georgia, "Times New Roman", Times, serif;
text-align: center;
display: inline;
padding: 3px;
background-color: #F1F1F1;
border-color: #CCC;
border-style: solid;
border-width: 1px 0 1px;
}
And this will make the first letter bold, automatically:
.pullquote:first-letter {
font-weight: bold;
font-size: larger;
}
When writing an entry just place text within
p class ="pullquote"
and it will appear as it does in my entry. Of course, change colors etc. to suit your site’s layout and color scheme.I thank you most graciously for the .css code. That is exactly what I am looking for.
I am going to hard code the index.php for WordPress so that the excerpt for an article appears in the pull quote, which is what I want to do.
Again, thank you so very much!
If you wish, you may have a look at my site, http://www.thunderbyrd.net/ to see the pullquotes I have there. I am putting them in manually until I can hack the code. I’ve only been using Wordpress for a couple of weeks now.
I made two versions of the pullquote, one 100px wide, and one 150px wide. Handy to have more than one size :)
Thank you again. You have been credited in the .css style sheet BTW.
Thanks for the kudos. You should not have to hack the code. You can probably use the excerpt field in WP and when calling it in your template just slap appropriate divs around it. That may mess with RSS feeds and archive display (since excerpts may be displayed there), then you can use a custom field.
I got the .css code working as I like on my page now. In my index.php, I have added the following code:
<div class="pullquote">
<?php the_excerpt(); ?>
</div>
This is just above the line that spits out the content for the post and is working quite nicely. Since this is just in the
index.php
, I don’t think it will mess up any of the feeds since they don’t use theindex.php
.My quandry now is a way to figure out how to tell the code to skip entries where the
excerpt
field has nothing in it. Currenty, if you don’t have an excerpt, it will make one up based on the content of the post.Again, thanks for all of your help!
I am glad my suggestion worked out.
the_excerpt_rss();
is in every RSS generating file, so the excerpt you enter should appear in your RSS feeds. Just fire up a RSS reader and see for yourself, I could be wrong.I wonder if there is something off with your WP installation, because WP does not generate excerpts from content … in my experience. The tag is in the default
index.php
and excerpt in empty unless manually entered. Also, WP docs explicitly state that “If a manual entry excerpt has been entered, it will be in this variable. If not it will be empty.” Perhaps, it would be a good idea to bring this up on WP forums.for what it’s worth my random image code, maybee of help to you:
(ofcourse you have to change things, depending on your table names etc)
[Edit: Since comments can’t handle code, please look here (caches_code.txt)]
catch: Thanks for the code. I had to move it into a text file since it wasn’t displaying properly. That said, it wont be much use since my gallery does not have a MySQL backend … otherwise it would have been easy.
Actaully, the code for WP 1.2 handles excerpts like this:
If an excerpt was entered when creating the post (in advanced editing mode), it will be used.
However, if there is not one, the first 150 (or so, I don’t remember the exact number ;) words of the post will be used.
This is hard coded into the source code for WP for normal posts. I didn’t look at the RSS stuff, but I may in the future.
Again, my thanks for your help in better understanding .css and WP.
Thanks for the info, I didn’t know how it worked, but I had the_excerpt in the default template on my test installation and it was left blank when no excerpt was entered manually. Kudos on your site, it shaping up nicely ;)
[…] ript that I was using for it. Super duper simple to install, even for me. You can get it HERE. My back is bugging the hell out of me today. I think i […]
[…] ound-color: #f93; } Mind of Mog 25.June.04 Witty Text Added a plugin, the witty text one. Works great. One great thing about WordPress i […]
Installed my first WP plugin. Random Witty Text. Reads quotes from a flat text file and pos […]
This plugin is outstanding! Thanks for the code!!
I added the code below to my index.php template so my photo would appear at top of menu section just above the category listing.
Is there some ss includes or php code that will generate a random photo from a folder in the wp-images where I could I 5-6 images where one is selected randomly each time the main page is loaded?
please advise at leisure
tanks, lot of tanks
bgr