WordPress random posts plug-in
Does anyone here have any experience using WordPress? I would love to include a random (not related) posts list feature on the blog that I have set-up (I'll post a link in 'Off-Topic" chat when I get the last few posts in there - it's all silly... :p ) I have no problem finding plug-ins - the two or three can be found from the WordPress site plug-in section. However, the read me files are vague at best to someone like me who doesn't speak PHP...
Really don't have the time to "fiddle" and "experiment" even though I would probably figure it out eventually. To someone that really know what they are doing - I'm sure it's a piece of cake.
Could anyone give me hand?
Risto
Re: WordPress random posts plug-in
Hey Risto...
I think that for most WP plugins, just upload the zipped file to some folder, expand it, copy the relative php file to the wp/content/plugins folder... then go into the admin within wp, go to plugins and activate said plugin... should be set to go :)
Re: WordPress random posts plug-in
Quote:
Originally Posted by
gidgit
I think that for most WP plugins...
Thanks for looking gidgit,
Maybe most - but more likely many? :)
The plugin I was considering the other night, took a little bit of finicking - defining parameters somewhere and adding unknown (not well explained) code somewhere.
If you do a search on Google for - Random WordPress - the top result will give you the related category. The random post plugin I was considering is the one that links to the w-a-s-a-b-i website...
About the w-a-s-a-b-i site - and plugin downloads available - there are later versions than what's listed there. The other night I was looking at a designated wiki page with later downloads - instructions - etc. but can't for the world of my find it again. :( Even the wiki page didn't make it totally clear (for me).
My "blog/silly fest" will be the plainest, cheapest looking one on the planet - still want that feature though. :rolleyes:
Not sure if this helps anyone...
Risto
Re: WordPress random posts plug-in
I don't even know what a word press is... Is it like a blog or something?
Re: WordPress random posts plug-in
Quote:
Originally Posted by
Availor
I don't even know what a word press is... Is it like a blog or something?
Wordpress and Textpattern are the most popular blog publishing systems. If you need a own Blog, use one of them.
In the Wikipedia article about Textpattern, you'll find the sentence "Textpattern is an open source content management system ", but if you needs a CMS with much more functionality, I would recommend Typo3.
Remi
Re: WordPress random posts plug-in
Re: WordPress random posts plug-in
Hi Risto,
you're right, there are no detailed installation instructions into the Readme-File of the "Random Posts"-Plugin.
- Download the plugin
- Upload the plugin to the wp-content/plugins folder in your WordPress directory online.
- Access the Plugin Panel in your WordPress Admin Panel and click on "Activate" behind the listed plugin "Random Posts" to activate the plugin.
- To insert the plugin in your current template, search for the right template file and insert the following PHP code. For example: If you use the standard WordPress theme, and wants to insert the random Posts into your sidebar, insert the following PHP code into the file "themes/default/sidebar.php".
Code:
<?php
if (function_exists('random_posts')) {
// Description:
// The function random_posts displays a configurable list of random posts.
// Parameters:
// $limit - No. of posts to show.
$limit = 4;
// $len - Lenght of auto-generate excerpt.
$len = 100;
// $before_title - Text to appear before the entry title.
$before_title = '(Text before the entry title) ';
// $after_title - Text to appear after the entry title.
$after_title = '(Text after the entry title) ';
// $before_post - Text to appear before the entry excerpt.
$before_post = '(Text before the entry excerpt.) ';
// $after_post - Text to appear after the entry excerpt.
$after_post = '(Text before the entry excerpt.';
// $show_pass_post = Include/exclude password protected entries (Default: false).
$show_pass_post = false;
// $show_excerpt = Show/hide excerpt (Default: false).
$show_excerpt = false;
random_posts($limit, $len, $before_title, $after_title, $before_post, $after_post, $show_pass_post, $show_excerpt);
}
?>
Regards,
Remi
Re: WordPress random posts plug-in
Thanks remi. :)
Didn't see that particular piece of code? It's not in the read-me of 1.1 - it only contains instructions on how to write it.
When you get a chance, could you post a link to the page where you found that snippet of code? If you took the time to write it out for me - extra thanks!
The link from wordpress to the plug-in is for version 1.0 and 1.1. But I saw later versions referenced in a wiki (can't find it now). However, if 1.1 does the trick/works (I only need to show post titles - very basic stuff) it will be ok for me. It's the only thing I wanted anyway.
Looking at the code you posted - it's seems to match the instructions of 1.1?
Again, thanks for taking the time to look at it for me! Very much appreciated!
I'll give it a test.
Risto
Re: WordPress random posts plug-in
Hi Risto,
you're welcome. The code is from a short test by myself. You have to change the $before_title and $after_title - the current text was only for testing. I've used V1.1 - I haven't done a search for a newer version.
Remi
Re: WordPress random posts plug-in
Well we would have had to work on this some more to realize one had to go into the sidebar file proper like ... good catch Remi... thanks for this :)
Re: WordPress random posts plug-in
remi,
I will be using the code on single pages only and showing only the title of the post. I installed the script and pasted in the code - it all worked fine. :)
However, the formatting of the output doesn't look all that great... Don't need all the "before and after stuff".
I massacred the code a little bit (but left the after title) and it looks a bit closer to what I would like to see.
Question: How would I go about getting each post in a bulleted list - or if it's too tricky; on a line of their own?
A bulleted list like this:
- Post 1
- Post 2
- Post 3
- Post 4
- Post 5
The massacred code now looks like this:
Quote:
<p>Theoretically related posts</p>
<?php
if (function_exists('random_posts')) {
// Description:
// The function random_posts displays a configurable list of random posts.
// Parameters:
// $limit - No. of posts to show.
$limit = 5;
// $len - Lenght of auto-generate excerpt.
$len = 0;
// $after_title - Text to appear after the entry title.
$after_title = '..... ';
// $show_pass_post = Include/exclude password protected entries (Default: false).
$show_pass_post = false;
// $show_excerpt = Show/hide excerpt (Default: false).
$show_excerpt = false;
random_posts($limit, $len, $after_title, $show_pass_post, $show_excerpt);
}
?>
Agains thanks for your help!
Risto
Re: WordPress random posts plug-in
It's no big problem to build a list item - exactly therefore are the $before_title/$after_title variables used:
Code:
<?php
if (function_exists('random_posts')) {
// If you print outs the necessary HTML code inside this piece of code,
// then the following header is only printed, if the "Random Posts" plugin
// is activated (comfortable, isn't it? ;) )
// Print out the header of this part of your sidebar with <h2> or <p>-tags
// (depends on your used template):
printf("<h2>Theoretically related posts</h2>");
// Print out the starting <ul>-tag to start a list:
printf("<ul>");
// Parameters for the following function random_posts:
// $limit - No. of posts to show.
$limit = 5;
// $len - Lenght of auto-generate excerpt.
$len = 100;
// $before_title - Text to appear before the entry title.
// each random post should included within a <li>...</li>-tags
$before_title = '<li>';
// $after_title - Text to appear after the entry title.
$after_title = '</li>';
// $before_post - Text to appear before the entry excerpt.
$before_post = '';
// $after_post - Text to appear after the entry excerpt.
$after_post = '';
// $show_pass_post = Include/exclude password protected entries (Default: false).
$show_pass_post = false;
// $show_excerpt = Show/hide excerpt (Default: false).
$show_excerpt = false;
// Execute the function random_posts to display
// a configurable list of random posts.
random_posts($limit, $len, $before_title, $after_title, $before_post, $after_post, $show_pass_post, $show_excerpt);
// Print out the closing </ul>-tag to close the list:
printf("</ul>");
}
?>
Regards,
Remi
Re: WordPress random posts plug-in
remi! :cool:
Thank you so much for your help and time. That's exactly what I was looking for! It works perfectly! :)
I'll post a link in the off-topic forum to my "sort of like a blog" when I get the last couple of posts in there (back tracking and changing a few things around).
Risto
Re: WordPress random posts plug-in
Cool... good job on getting this resolved guys :)