Random Featured Post Plugin
Download from WordPress.org
The Featured Post plugin allows you to display a random post from a designated category. Ideally this should draw readers landing on your homepage to some of your best posts. The featured post will display the title ‘Featured Post’ (customizable) along with the post’s title, an excerpt and a link to continue to the full post.
This plugin requires Wordpress version 2.3 or higher and has been tested up to version 2.5.1.
Installation
- Download and unzip featuredpost.zip (see below) to your plugin folder.
- Activate the plugin from the Plugins section of your dashboard.
- (Optional) Create a ‘Featured’ category.
- Go to the ‘Featured Post’ options in your dashboard and select the categories from which you would like posts to be randomly selected.
- Check the ‘Show Featured Post’ box and click ‘Update’ to save your changes.
- Place a call to the show_featured_post() function in your template, most likely in your main index template just before the loop. See additional notes below.
Additional Notes
- The show_featured_post($PreFeature = ”, $PostFeature = ”, $AlwaysShow = false, $categoryID = 0) function has five optional arguments. The first two are for any HTML you would like to display before and after the featured post. The third argument is a boolean (true/false) argument which will override the ‘Show Featured Post’ option and always display the featured post when true. The fourth option allows you to specify a category to display from, overriding the selection in settings page.
- If you choose to display excerpts, the plugin will display your optional custom excerpt from the advanced options section of your post; otherwise, the standard Wordpress excerpt is shown. The fifth option allows you to show more than one post at a time, overriding the settings page option.
- This plugin respects the <!–more–> tag when you choose to display the full content. There is a setting which allows you to ignore the tag and display the full post.
Examples
-
This example will display the featured post only on your homepage inside a span block:
if ( function_exists('show_featured_post') ) if (is_home() && !is_paged()) show_featured_post('<span class="container">','</div>'); - This example will always display the featured post, ignoring the ‘Show Featured Post’ option and the category ID option in settings:
if ( function_exists('show_featured_post') ) show_featured_post('', '', true, 42); - All output is contained in a DIV class named “featuredpost” and can be adjusted via your stylesheet.
Change Log
v1.1.3 (May 15, 2008)
- Bug fix: more tag was not being respected on single posts/pages when full content option was selected.
v1.1.2 (May 5, 2008)
- Added option of showing posts and/or static pages.
v1.1.1 (April 30, 2008)
- Added multiple category selection option.
- Added option to display multiple posts.
v1.1.0 (April 28, 2008)
- Discontinued use of truncated post content and switched to the option of displaying full post content with HTML intact or standard excerpts, custom or Wordpress generated.
- Added option to ignore the <!–more–> tag when displaying full post content.
- Added fourth argument to show_featured_post() function to allow category ID from settings to be overridden.
v1.0.1 (April 11, 2008)
- Added category name and ID table to options page for convenience.
v1.0.0 (April 7, 2008)
- Initial plugin release.
Bugs/Feature Requests
You can leave a comment below or contact me at scott(at)mydollarplan(dot)com.
If you find this plugin beneficial, please consider donating for the author’s time. Any little bit is appreciated!
Download from WordPress.org
Great plugin and just what I’m looking for. Many thanks.
Unfortunately, as a relative newcomer to Wordpress and adjusting css style sheets, the additional notes and examples provided are a bit beyond me. Not quite sure where to place the code. Any chance of a more detailed step-by-step on how to do this?
April 9th, 2008 at 3:20 am
Kate,
I’m not very good with CSS either but here’s my best attempt at an explanation. In your Design-Theme Editor, open your stylesheet and create a section like this:
#content .featuredpost {
border:1px solid #000000;
}
You can further adjust other elements in the featured block, such as the post title, like this:
#content .featuredpost h2 {
color: #FF0000;
}
Does that help?
April 9th, 2008 at 9:42 am
I’ll give it a shot. Thanks Scott.
April 9th, 2008 at 8:29 pm
Hi Scott
no go. This is what I have done:
downloaded, unzipped and uploaded the plug-in to my plug-ins folder; activated the plug-in on my WP Dashboard; inserted the category name for random post to choose from; saved. BTW, I assume Category ID is the name of the category? It’s not showing after I hit the save button.
I then inserted this code in the index.php within my theme folder:
<?php if ( function_exists(’show_featured_post’) )
if (is_home() && !is_paged())
show_featured_post(”,”);?>
And in my CSS style sheet for the theme, I’ve inserted:
#content .featuredpost {
border:1px solid #000000;
in the content styles section of the file.
I can only think I’ve got the code in the wrong place, either within the particular file or in a wrong file altogether.
Sorry to be a pain, but I’d really appreciate a solution as I’ve gone past the ‘forget it’ stage and want to make it work! Call me ornery …
Best
April 9th, 2008 at 9:58 pm
Kate,
The category ID is a number, it won’t save if you enter text. In your dashboard go to Manage-Categories and click the category you want. Then look in the address box of your browser and you’ll see a cat_ID= at the end of the URL. The number at the end is what you want. Also, did you check the “Show Featured Post” box in the options? If you need more help just shoot me an email.
April 9th, 2008 at 10:30 pm
Is there a way in which you can put more control in this plugin? Such as the fact, that some users may not want a random post, but posts ordered in terms of the newest first..
April 10th, 2008 at 12:11 am
Nick,
Do you mean that you want to always display the single newest post from a specific category as your featured post? Or am I reading your comment wrong?
April 10th, 2008 at 9:05 am
Very interesting plugin. I’ll probably use this for some of my future theme developments.
@Nick: You can probably just use a wp_Query to do that.
Good luck!
April 10th, 2008 at 10:23 am
Ok Im a retard…. Could anyone do a step by step guide for this?? I mean down to the \”T\”… Sorry and thanks for all the help…
April 10th, 2008 at 11:27 pm
This is the perfect plugin for me except I need to allow it to show images — any advice? I am trying to show a thumbnail that links to my latest project but right now I can only display text.
April 16th, 2008 at 11:07 am
@Kristen
The plugin shows the content of a post. I can put in an option to not strip HTML tags from the post content which would show images in your post, along with any text you might have as well though.
April 16th, 2008 at 11:25 am
That would be perfect. I tried examining the plugin code but couldn’t identify what exactly I needed to modify.
April 16th, 2008 at 11:49 am
@Kristen
Look for the lines
$desc = attribute_escape(strip_tags($post->post_excerpt));
and
$desc = attribute_escape(strip_tags($post->post_content));
and replace them with
$desc = attribute_escape($post->post_excerpt);
and
$desc = attribute_escape($post->post_content);
respectively.
April 16th, 2008 at 11:55 am
I modified the plugin as instructed and it nearly works — except instead of displaying the image you see <img src=”…..”
April 16th, 2008 at 12:22 pm
Sorry, forgot to take off the attribute_escape functions as well. The lines should be
$desc = $post->post_excerpt;
and
$desc = $post->post_content;
April 16th, 2008 at 12:34 pm
Thanks a million, it definitely works now!
April 16th, 2008 at 1:01 pm
Great plug-in, thanks. I’m using the following classes in my stylesheet, which work well for me:
h3.featuredpost
h2.featuredpost a
April 16th, 2008 at 10:55 pm
this actually works a bit better though after tinkering:
div.featuredpost h2 a
div.featuredpost h3
April 17th, 2008 at 1:16 pm
Hi, thanks a lot for this great plugin. I like it very much and you can see it in action on my site.
Some questions:
I would like to use the more-tag including images instead of truncating the text. Is that possible or do you plan this feature?
The solution in comment 15 breaks the formattings when attributes like strong or italic are used? Is it possible only to use the img-tag inside the truncated text?
Best wishes and excuse my chaotic english.
Daniel
April 22nd, 2008 at 9:26 am
another question is, if it possible to use this as a widget?
April 22nd, 2008 at 9:30 am
@Daniel,
Widgetizing this plugin is not possible; however, there are other plugins out there for displaying featured posts in your sidebar if that’s what you would like to do. Check the Wordpress.org plugin database. I’ll take a look at your other feature requests when I have a chance.
Also, if anyone is just looking for a plugin to display a single featured post and is not interested in randomizing from a group of posts then I would recommend using the WP-Sticky plugin.
April 22nd, 2008 at 9:39 am
Hi Scott,
yes I wanted to show your random featured post in a sidebar, because I like the flexibility to manage a group of articles through the categories, which are important for me
It would be really great to use an eyecatcher too.
April 22nd, 2008 at 10:11 am
I’m not a coder, but this worked for me:
$desc = strip_tags(($post->post_excerpt), ”);
April 22nd, 2008 at 10:54 am
Hi Scott,
Thanks for sharing with us this plugin. It works well in our site ~ with truncated text, etc.
Because I wanted to display the entire text of the post being rotated, I increased the character limit in the admin option which works okay except all the html tags and formats are lost.
Is there a way I could display the entire text of the post being rotated with formatting being retained?
Thanks heaps.
Pam
April 26th, 2008 at 6:50 pm
Hi- I’ve added this plugin to my site and it works great, but how do I set it to show more than one featured post at I time? For now I’ve duplicated the code: , but more than often it shows the same featured posts in a row.
April 26th, 2008 at 8:57 pm
@Pam:
I’ll really try to fit in some time to work on the plugin this week. In the meantime, comment 15 will do what you’re looking for, but keep in mind that if the post is ever truncated in the middle of a tag it will mess up your formatting.
@Casey:
This plugin is really designed to only show one featured post at a time but I’ll see about adding an optional parameter to the function call so that you can specify different categories for each call, that should help you out.
April 27th, 2008 at 9:07 pm
Ok Scott thanks! I only need to specify one category - but I’d just like to show more than one Featured Post at a time. Let me know if you find a way to make that work - thank so much!
April 28th, 2008 at 6:34 am
The plugin has been updated with a few new options. Basically, the truncated post option has been discontinued in favor of displaying either full, formatted post content (with or without more tag) or post excerpts.
@Casey:
The best I could do for you is add an additional option to the function call to specify the category (see above for example). You’ll be able to have two featured posts at once but they will have to be from different categories. You can have them come from the same category by creating two new categories just for featured posts and then adding different posts to each of those categories, along with their original categories.
April 28th, 2008 at 2:07 pm
Thanks very much, Scott. You’re a legend!
The admin option to use “excerpt” or “full text” with formatting remaining intact is just exactly what I’ve been looking for.
April 28th, 2008 at 3:22 pm
Its possible to configure more than just one category?
April 30th, 2008 at 2:02 am
@Miguel:
That’s one of the things on my “to do” list for this plugin.
April 30th, 2008 at 8:39 am
Plugin has been updated with multiple category selection and multiple post options.
April 30th, 2008 at 1:31 pm
Wow, thats was fast… thanks for the wonderful plugin, I am using and will update.
April 30th, 2008 at 8:17 pm
Hi - really useful plugin with one problem which means I can’t use it. I’ve just noticed that it displayed one of my ‘pages’ instead of one of my ‘posts’, even though pages don’t fall into any of the categories - is it possible to exclude ‘pages’?
May 4th, 2008 at 9:13 am
@Paul:
Good catch. The plugin has been updated with the option of displaying posts and/or static pages.
May 5th, 2008 at 10:53 am
Sounds good, and I would like to try this plugin but after bouncing back and forth between this page and the Wordpress plugin page I cannot find it.
Where is it?
May 5th, 2008 at 1:14 pm
@DigitalZip:
The link is at the top (I just added) and bottom of this page. It takes you to the WordPress.org Plugin Directory where you can find the download link on the right side of the page in an orange box.
May 5th, 2008 at 1:20 pm
Thank you Scott. It’s not very obvious on Wordpress that you should click on the orange download box. Well it isn’t to me
Got it now anyway.
May 5th, 2008 at 1:27 pm
Hi Scott
I was the first commenter here and just wanted to say thanks for your neat plug-in and for being such a responsive developer. It’s really appreciated especially by those of us who are ‘challenged’ by all this coding stuff!
I’m part of the comment08 challenge running right now to increase communication round the blogosphere, and thought I should say thanks to people who make my blogging life much easier. You’re on my list!
Best wishes.
May 5th, 2008 at 4:29 pm
Wow, that was quick! Since my comment I have been dabbling with using multiple loops within Wordpress, and found that this is also a good way to display a single random post alongside my usual homepage content. I’ll use that route in the interests of keeping plugins to a minimum, but this is certainly useful for those who don’t want to delve into advanced stuff like multiple loops.
May 5th, 2008 at 5:20 pm
Thanks Scott. Given the series of improvements that you have introduced to your plugin, I guess comment #24 has helped it realize its full potential, that there’s a big community out there looking for this kind of plugin. Good work! ~ Pam
May 6th, 2008 at 5:22 pm
Glad to see others are finding this useful.
Spread the word!
May 6th, 2008 at 9:09 pm
hi. Thanks for plugin
perfect.
regards
May 11th, 2008 at 11:55 am
Hi Scott,
I wanted to add this code into single.php to showw my featured articles in top of each post.
On my Homepage it works fine but in single.php it always displays the full post?
Best wishes
Daniel
May 12th, 2008 at 1:01 pm
@Daniel:
Are you using the most recent version of the plugin? I’m unable to replicate the problem you’re having. Please check your settings and make sure you’ve selected “display excerpt” under the content options.
May 13th, 2008 at 9:18 am
Hi, Scott.
Thanks for a great plugin. I’ve got it working pretty well.
I’d like to see the date of the featured post show up with the post and excerpt. Could you help me with the code for that?
Thanks!
May 13th, 2008 at 9:35 am
@Wardeh:
I thought about including the date but decided against it because typically a “featured” post would be an older post from deep in your archives and highlighting the date might keep readers from clicking through, or at least that was my thinking.
If you want to add the date you’ll need to modify the code. Look towards the end of the show_featured_post function and in the place of your choosing insert the line
echo date(”F n,Y”,strtotime($thepost->post_date));
May 13th, 2008 at 1:09 pm
Hi Scott,
I use 2.3.3 and K2. The problem is, that the same functions has different results. On my homepage everything works fine, but in single.php I got the whole article.
No, I use full content with “more-tag”. If I switch to “excerpt” everything works fine.
May 15th, 2008 at 1:29 am
@Daniel:
I hadn’t tried the full content option with the more tag on a single post. I found the bug and the plugin has been updated. Thanks for bringing it to my attention.
May 15th, 2008 at 11:15 am
hi scott, thanks a lot. hope your private million dollar plan works
but there is another mysterious behaviour. on the homepage it works again fine, but now after the more tag, only on single page, I get the list of related articles inside it?
May 15th, 2008 at 12:32 pm
@Daniel:
I’m guessing this is because whatever plugin you are using to generate the related articles is hooking the function that displays the formatted content. I’m not sure how to get around this. What plugin do you use for related articles?
May 15th, 2008 at 1:14 pm
hi scott, I use simple tags: http://wordpress.org/extend/plugins/simple-tags
May 15th, 2008 at 2:10 pm
@Daniel:
I just glanced at the code for that plugin and I’m near certain that’s the issue. You can probably test it by disabling that plugin. I’m not sure how to get around that, but I’ll do some thinking and let you know if I figure it out.
May 15th, 2008 at 2:16 pm
You’re right. When I disable the plugin everything works fine, as it should.
It’s a pitty, because I like simple-tags for managing the tags very much. Hope you find a solution.
May 16th, 2008 at 4:54 am
but for the moment I decided to disable the related posts, because your way of featuring articles is much more attractive.
May 16th, 2008 at 9:28 am
@Daniel:
I’m glad you find the plugin so useful. Until I can find a fix, you might want to check out another plugin to do the related posts. We use Similar Posts here and I’m happy with the way it works.
May 16th, 2008 at 9:31 am
I’ve successfully done steps 1-5 but 6 is where I get confused… what does it mean to place a call? and what is a loop… What exact code should I be placing in my index.php per theme??
May 16th, 2008 at 12:09 pm
@Linz:
In index.php look for the line that has “while (have_posts())” in it; that’s the start of the loop. Just before that line place the code from the first example above, making sure to include it between the “” tags.
May 16th, 2008 at 1:15 pm
Great plugin. Anyway, can it be inserted into the page/page?
Thx
May 16th, 2008 at 1:35 pm
@gofree:
Yes, but if you read the other comments you’ll see that it may conflict with some plugins.
May 16th, 2008 at 1:46 pm
Hi Scott,
I am trying to call it using this show_featured_post() with Adman plugin to have the featured post appear on the top of index in homepage, but it seems not working as it shows the code show_featured_post() back.
Did I do sth. wrong.
Thanks
May 16th, 2008 at 11:14 pm
@Scott. Great tipp. Thanks again.
May 17th, 2008 at 2:27 am
Working perfect on my site, I enjoyed the new implementations and support. Good Word
May 18th, 2008 at 10:05 pm
Hi Scott,
Great plugin. It displays my posts excerpts with no problem. However, when I go to display my pages it shows nothing.
Have I done something wrong?
May 19th, 2008 at 7:28 am
@Sheri:
I checked out your site and I see you’re using it on all of your pages… maybe I don’t understand the problem you’re having? Also, the formatting for the featured post is aligned too far to the left on Firefox 3 and IE 7.
May 19th, 2008 at 9:00 am
Scott,
Thanks for looking. They show up as long as I have posts and pages checked, but if I just check pages - which is what I would like to do - the entire box disappears.
I am running a browser check via browser shots right now. If it is aligned too far left I am unsure what to do - as moving it will mes it up in other browsers. Any advice would be very helpful.
Thanks again
Sheri
May 19th, 2008 at 10:27 am
@Sheri:
Maybe we have our terminology mixed up. The “static pages” referred to in the settings are things like an about page or archive page which are managed in a different section of WordPress. Can you be more specific as to the problem you’re having?
As far as the alignment, CSS is not my thing so I can’t help you there.
May 19th, 2008 at 10:46 am
lol, CSS is sometimes a savior and other times a pain.
Wordpress has posts and pages. In my pages section I am using eshop for my shopping cart. What I would ideally like to do with this plugin is use it to display random items from my pages - not my posts. Does this help at all?
Sheri
May 19th, 2008 at 10:54 am
@Sheri:
Ok, I understand your problem. Unfortunately, WordPress doesn’t allow you to categorize pages. I’m not sure how one of the previous commentors had static pages show up, I assume another plugin was being used. I did find this plugin which claims to tag static pages but I’ve not tested it. Feel free to give it a try and let me know if it works.
May 19th, 2008 at 11:16 am
Again please,
Hi Scott,
I am trying to call it using this show_featured_post() with Adman plugin to have the featured post appear on the top of index in homepage, but it seems not working as it shows the code show_featured_post() back.
Did I do sth. wrong.
Thanks
May 19th, 2008 at 12:17 pm
@gofree:
Then you’re not putting the code between the php tags. I would recommend you find a tutorial on modifying WordPress themes; explaining how to do this is beyond the scope of this page.
May 19th, 2008 at 12:28 pm
Thanks anyway, Scott.
May 19th, 2008 at 12:55 pm
Hi,
i love this plugin and i’ve installed it on my server.
Only a question, how can i use this plugin in different page with different code?
Example:
I need that on the homepage this plugin give me only three featured post.. but i want that on “archive” this plugin give me ten featured post (of the same categories).. is it possible?
Thanks.
Andrea
May 26th, 2008 at 9:13 am
I found it,
thanks anyway
May 26th, 2008 at 9:50 am
Hey great plugin… coming in handy a lot!
Works great for me right out of the box.
Thanks!
Chris
May 27th, 2008 at 12:19 pm
Excellent script.
I wanted to modify it so that it only displays the posts title, and reduce the space between the
“featured post:” headline and the posts title.
June 1st, 2008 at 6:02 pm
@roger
If you want to eliminate the post content/excerpt you’ll have to modify the code… look for the echo lines near the end of the code. I’ll think about adding this as an option next time I update.
You can reduce the space between elements using CSS, but I’ll leave that up to you, I’m not an expert.
June 2nd, 2008 at 11:09 am
Hi Scott and thanks for this plugin.
Is it possible to display featured posts by tag and not by categories?
June 7th, 2008 at 7:33 am
Hi, Scott. Nice Plugin, Iam trying to display random posts from the Feature Category on the home page,above the normal content, but if the post is the latest post and is from the featured Category, There are duplicates being displayed.
Can you suggest how to remove the 2nd duplicate, and let the random post from your plugin be displayed on the homepage.
June 9th, 2008 at 5:36 am
@Aldo: I’ll put it on my to-do list, but it might take me a while to get to it.
@venkat: The best I could do is return the post ID from the function. Then it would be up to you to check for the post ID as you go through the loop. Would that work for you?
June 9th, 2008 at 9:29 am
please help i got this error :
————–
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘) ORDER BY RAND() LIMIT 1′ at line 8 on line: 202————–
i use WP 2.3
regards
June 11th, 2008 at 6:23 am
@dr801:
It looks like you haven’t selected any categories in the options pages.
June 11th, 2008 at 8:25 am
Scott… great plugin.
One issue: I am using another plugin “Custom Field Images”, so that I could place an image ABOVE the Title. This works fine on the Full Post, however to get a thumbnail, I have had to add it separately into yet another custom field, which does not now show up in “Random Featured Posts”.
I know there is another way of getting the thumbnails in place, and that is by creating an extract option, and duplicating.
I am unsure what to do!
Any suggestions? See index page with one example of Painting with title below, that appears in my Mini-post view below the Featured Post.
Thanks
Peter
June 14th, 2008 at 7:35 am
@Peter:
I’m not clear on what your problem is exactly because I don’t see an image on the featured post of your page; however, this sounds suspiciously similar to the problem Daniel was having (see comment 51). Basically, your other plugin is most likely not compatible with this.
June 16th, 2008 at 9:03 am
Thanks for the post
Best
June 17th, 2008 at 11:58 pm
great wp-plugin!
June 18th, 2008 at 12:05 am
Hi Scott,
this plugin seems very good. I wonder if this plugin can choose the post date rather than by category. Exactly all posts published in a time interval.
Thank you and sorry for my english.
Alessandro
June 30th, 2008 at 10:49 am
The plugin shows the correct title of the random post but the content is the same of my latest post. Did I something wrong?
July 2nd, 2008 at 6:09 am
@Alessandro: I’ll see about adding to future version, but I don’t have plans to update in the near future. Sorry.
@Novecento: No idea… maybe you put the function call inside the loop. Also, make sure you’re using the most recent version.
July 2nd, 2008 at 11:54 am
The function call is placed before the if (have_posts() loop and i’m using the 1.1.3 version
July 2nd, 2008 at 6:03 pm
Didn’t know if this would help, but maybe you can use the custom fields to apply a mock category structure to static pages? You know, assigning a key and value that you can call in this plugin to only pull certain pages to display.
Personally, I want to know if it is at all possible to shortcode this plugin so it can be brought into a page, rather than page.php. Like say I want to have my homepage show a page rather than my posts, and put this plugin into the page I select as home, to show a featured post. Basically making this plugin part of one specific pages content. Any ideas?
July 6th, 2008 at 5:01 am
@Bryson:
You can check for the page ID and only execute the plugin function for a specific page like this:
global $post;
$postID = $post->ID;
if ($postID == 123) show_featured_post();
July 7th, 2008 at 9:47 am
@Scott
Thanks for the quick response. That looks like it might work very well for me, I’ll test it on my home app and see. Thanks.
July 7th, 2008 at 3:37 pm
That works pretty well, except that the page title keeps showing in the page as if it’s just another page. Still gotta sift through it and find a way to drop it from that page since it’ll be my home page.
Also gotta adjust the styling for the output of this plugin since I’m just using it as a part of a page, but rather as the page.
Thanks again Scott.
July 7th, 2008 at 4:06 pm
@Bryson:
Just use the same code as before at the part where the title is displayed except modify the if line like this:
if ($postID <> 123) // display title here
That shows the title on all pages except page 123.
July 7th, 2008 at 4:10 pm
I actually went another way, and from the looks of it, the hard way. I’m not a php whiz by any means though I can manage at times.
Here is what I have
[code]ID;
if ($postID == 18) { show_featured_post();
} else { if (have_posts()) : while (have_posts()) : the_post(); ?>
[/code]
It keeps any part of the wp page from showing if $postID is 18, and if it’s not, then I don’t want the featured post to show up, so it goes on to exclude the plugin output in favor of the page content. Works for me
July 7th, 2008 at 5:19 pm
And is it just me, or does IE7 really not like ajax? I couldn’t edit the post to take out the bbcode after it didn’t work. Seems to be like that a lot.
July 7th, 2008 at 5:22 pm
Hi there!
Is it possible to just extract a random page ID to use for other purposes?
I am using the MimboPro theme and would like to present a random leading article from one or more categories.
Best Regards Krezz
July 15th, 2008 at 6:01 pm
take a look at my homepage, http://www.brokesanity.com. Look in the red section of the header and tell me if that’s what you’re looking for.
I used, and quite easily I mitgh add, recent posts plugin to accomplish this.
July 16th, 2008 at 4:51 pm
Thanks this is exactly what i am looking for!
July 23rd, 2008 at 7:03 am
I dont why but suddenly it starts to show only full post, and not the WP excerpt anymore. I have checked the option to display excerpt in conf.
July 23rd, 2008 at 1:19 pm
Hi, Firstly thanks for your excellent plugin, secondly is there a way to reduce the number of words output in the extract?
August 7th, 2008 at 12:33 am
@Jon:
Strictly speaking for my plugin, other than creating your own custom excerpt under the advanced options of your post, no.
You can try another plugin like Advanced Excerpt at http://wordpress.org/extend/pl.....d-excerpt/ but I don’t have any actual experience with it.
August 7th, 2008 at 1:25 pm
or you can fill the excerpt field in “advanced options” (below the post field), is absolutely compatible with random featured post plugin, and anyone other plugin is needed
August 7th, 2008 at 2:07 pm
I wish to have my front page display a random featured post. How do I do that?
I tried creating a page with the code suggested
and the page just shows the code.
thanks for any help,
David
August 11th, 2008 at 1:38 pm
Got it to work. (I didn’t want to have to edit the loop, but realize that’s the only way)
Thanks for the great plugin. Now that I don’t write often, it’s nice to have something different show up every time someone visits.
David
August 11th, 2008 at 5:39 pm
Sorry…I’m back. I want the featured post to display only on my home page, not on post pages.
How do I “call” that in the code?
thanks,
David
August 11th, 2008 at 5:55 pm
Figured it out by trial and error
and I can’t enter the code here….so I guess I’m done.
thanks,
David
August 11th, 2008 at 6:04 pm
Scott,
Using your plugin at my site.
Thank you.
P.S: Is there a way to not show the photos in the featured post section…show only the excerpt?
August 12th, 2008 at 5:44 am
Scott, I am donating to your account for your hard work. And, I am adding a second request to comment 109 to add a feature to choose whether to eliminate photos.
Thanks,
David
August 12th, 2008 at 12:23 pm
@katya:
Images do not show when you select the excerpt option… check to see if you’re actually displaying the full content with a more tag, which appears similar to an excerpt.
@david:
Thanks! See my reply to katya. Do you want an option to eliminate images regardless?
August 12th, 2008 at 1:20 pm
That works. Thanks. I was using the Advanced Excerpt Plugin, which also probably has a way to eliminate photos with longer excerpts, but your option works fine for me for now.
Thanks,
David
August 12th, 2008 at 11:09 pm
Hi Scott,
I have selected the excerpt option. However, I see the image. Is it because of the layout of my site?
Cheers.
August 13th, 2008 at 1:15 am
@katya:
I’ve tried but I’m simply unable to replicate the problem you’re having. I checked the site you linked to in your sig but I don’t see the featured post running. I suppose it could have something to do with your layout, but more likely it’s an incompatibility with another plugin.
August 13th, 2008 at 4:23 pm
Thank you for your patience and your quick replies Scott
When I learn more of php, I should be able to figure these problems out for myself. : )
I have installed the plugin in the posts and not on the home page. Here is one such post.
http://theyoungindia.com/?p=312
Hope this plugin gets more popular.
Cheers.
August 14th, 2008 at 1:25 am
Hi Scott,
I am trying to edit the plugin to show images like Kristin did but cannot find the lines in the featuredpost.php file.
I am using Version: 1.1.3. Maybe the next version could have the image option built in?
If you could let me know where to look it would be great.
>>>>>>>>>>>
Look for the lines
$desc = attribute_escape(strip_tags($post->post_excerpt));
and
$desc = attribute_escape(strip_tags($post->post_content));
and replace them with
$desc = attribute_escape($post->post_excerpt);
and
$desc = attribute_escape($post->post_content);
August 14th, 2008 at 8:50 am
@katya:
That is definitely not the excerpt showing, it is the full post with a more tag, that’s why the image is showing. Please check your settings again. Try changing them around to see the difference.
@Flavio:
You’ll have to use the full content setting for an image to show. You’re on your own if you want to try to edit the code.
August 14th, 2008 at 10:44 am
Hi,
I dont knwo what I’m doing wrong. I have the following pasted to the bottom of my index.php document and nothing happens. Any idea as to why?
<?php if ( function_exists(’show_featured_post’) )
if (is_home() && !is_paged())
show_featured_post(”,”); ?>
September 4th, 2008 at 9:05 am
I can’t for the life of me figure out to arrange it so that when showing more than one featured post that they are side by side rather than underneath each other..=/
I’ve messed around with the css on that particular section marked “Featured Post”.. but cant seem to figure it out.
Any Css ideas? Or is this something I’d need to change in the plugin code?
Timothy B’s last post: teensy green
September 6th, 2008 at 1:58 pm
Not sure if it can be done with this plugin, if not, check out a site called perishable press, and search it for “double columns”. it will show you a very easy way to use multiple loops that post side by side.
September 6th, 2008 at 9:15 pm
I might try to run a second plugin called Advanced random post and just run that on the right side of the ..
September 6th, 2008 at 10:05 pm
Well I’ve just called two instances of the plugin in the two different hoping that the same featured post won’t show up at the same time =/ That seems to be the only workaround to the CSS issue..
September 6th, 2008 at 10:29 pm
You could check the codex as well, depending on how you’re featuring articles. If you’re just pulling random articles, it’s more coding, but the rand() feature seems to work pretty good for it. Might give you more options for multiple featured articles. I actually did it a while back without any problems though. I had five featured article sets that I was pulling from five different categories. It can be done with this plugin quite nicely.
bryson’s last post: Good Start for Chrome
September 7th, 2008 at 1:31 am
@Timothy B and bryson:
You can use this plugin alone to display two columns of featured posts side-by-side, but the formatting is a CSS issue. Off the top of my head, I believe you’ll need to enclose 2 div elements inside another div and set the float value of each.
In order to avoid randomly showing the same featured post in both columns, you’ll need to override the category ID in the function call for each column, specifying different category IDs. See example 2 above.
September 8th, 2008 at 11:28 am
Hi,
I’m trying to include your function call in a little content box on the top of my blog. But nothing is showing up, I’m using this line:
<?
php show_featured_post();
?>
The plugin is installed and on the options page all the requiered choices are made. What am I missing here?
September 10th, 2008 at 6:19 pm
Hi
Great plugin. Is it possible to use this plugin within the category pages as well? i.e it features posts not just on the home page but within each category.
Many thanks
Lynne
Lynne’s last post: Part Two Of RSS & Google Reader
September 11th, 2008 at 4:28 am
@Lynne:
Yes, but that will require you to do some coding in your theme to determine if you’re displaying categories. This is not really related to the plugin.
September 11th, 2008 at 11:31 am
No answer for me?
September 11th, 2008 at 12:16 pm
@Echtzeit:
Try not to take this the wrong way but I really can’t answer every “Why is this not working for me?” question unless you want to give me the admin password for your blog. Without an error message or specific question I can’t really help you. Plus, I see some sort of featured post thing on your blog with an error message that doesn’t appear to come from my plugin.
September 11th, 2008 at 1:39 pm
Ok, I got it working now, very strange
Now I have another question, the plugin “category-icons” is showing user defines icons next to the post title. In the index.php the code to invoke it, goes just in front of the “the_permalink” tag.
The code looks like this:
http://pastebin.com/d72364c58
Is it possible to show the icons next to your featured post as well? Where do I have to put it in your `”featuredpost.php”?
Thank you, for your time!
September 12th, 2008 at 5:58 am
I added this plugin in my blog. But i want to customize Title Font Size and want to add some styles. Can you plz tell me where i can edit those options? Thanks
October 1st, 2008 at 12:17 pm
i would like to display more than one featured article on my front page.
is there a way i can make sure that i do not get repeat featured posts
thanks for the plugin
October 3rd, 2008 at 10:54 am
@Jim: You’ll have to change your stylesheet. CSS are not my strong point so you’re on your own.
@Steffen: See comment #28 above.
October 3rd, 2008 at 11:40 am
Aloha! I’m digging this plugin as it’s perfect for what I’m trying to accomplish. Is there any way to NOT have the “Featured Post” header? That option would be great! Is there a way to hack it? Other than that, it rocks! Thanks so much…
October 18th, 2008 at 6:42 pm
@Patrick:
You can try hiding the h3 title using CSS. Not sure if this will work but off the top of my head,
.featuredpost h3 { display: hidden; }
Or you can edit the plugin itself and remove the line,
echo “<h3>”.$div_title.”</h3>n”;
October 20th, 2008 at 11:27 am
wow. thank this is what I was looking for. you could also add some examples of this plugin in use. thanks
October 22nd, 2008 at 11:19 am
Hi Scott,
first, thanks for a great plugin, its exactly what i was looking for…well, except for random thing :).
Is there a quick hack to show posts by date instead of random. I’ve tried other similar plugins as mentioned in the comments (wp-sticky, featured category) but they just don’t do it for me. I have heavily customized theme and want a block with featured news for that day (its a news portal) so random is not preferred. I was looking at the code and saw
.$sqlcat.” ORDER BY RAND()
could this be modified into date order?
Thanks again!
November 18th, 2008 at 1:21 pm
@perke:
You could try replacing “RAND()” with “$wpdb->posts.ID DESC” to show the most recent post.
November 18th, 2008 at 4:09 pm
PERFECT!! Thanks a lot, donation is on its way
November 18th, 2008 at 4:33 pm
Hello guys ! Is there anyone knows how I can include the content image to the random posts ?
Thanks
Joe