Classic Post Plugin

Here is my first wordpress plugin: The Classic Post Plugin.

Only tested with 2.1+

The point is to be able to mark posts under your post manager as “classic posts”
One those posts are selected they will be randomly displayed wherever you place the classic_post_get() hook.

Usage: Call classic_post_get(); in order to return the classic posts. You have the option of setting a limit on the amount of posts returned by calling classic_post_get(5); which will return 5 random classic posts.

Additionally you have the option of setting a return limiter classic_post_get(5,300); which will return 5 random classic posts and 300 characters from each post.

Call classic_post_get_list(); in order to return a list of links to classic posts. Callling classic_post_get_list(5); would limit to 5 posts.

== Installation ==
1. Upload `plugin-name.php` to the `/wp-content/plugins/` directory
2. Activate the plugin.
3. Choose the post you would like to randomly select from.
4. Place `<?php do_action(’classic_post_get(1,200)’); ?>` in your templates where you want posts displayed.
5. Place `<?php do_action(’classic_post_get_list(5)’); ?>` in your templates where you want lists of posts displayed.

== Frequently Asked Questions ==
1. I get errors when I try to activate the plugin.
A. Activate the plugin a second time - it should work the second time even if it gave errors the first time.

You can see this on display on the front page of Battle of the Sexes

You can Download Classic Post 1.1

The Zip file has now been updated to include a read me which was rewritten by David Miller to include documentation of his improvements. Thanks David!


Class Post Screenshot #1

Class Post Screenshot #2

Class Post Screenshot #3

Al the Virgin stated

I get an error when trying to download your plugin.

May 1st, 2007

Niki the Virgin stated

Would love to download, but I can not (

May 1st, 2007

Christopher the Pyro mentioned

Fixed. Sorry.

May 1st, 2007

Niki the Virgin uttered

Thank you!! (y)

May 2nd, 2007

Niki the Virgin scribbled

It outputs a couple of error when I try to activate it..

May 2nd, 2007

Christopher the Pyro said this

Can you post the error your getting? When you activate the plugin or when you put the code into the post?

May 2nd, 2007

David the Groupie up'n wrote this

I got the same error - I had that on other plugins - if you go back and activate a second time there is no error.

I modified the plugin to allow for output of a list of classic posts (through a new function call). You are welcome to have the modification if you like.

I also discovered that whenever I tried to select a post as classic when I was not on the basic wp-admin/edit.php page (for example wp-admin/edit.php?paged=2) it would not select or deselect the post. Can that be fixed?

May 2nd, 2007

Al the Virgin quibbed this

@David, sorry off topic but your site doesn’t look well in IE7. You may want to check that out.

May 2nd, 2007

Christopher the Pyro asserted

I’m not sure why your having that issue with only the first page working, however I have made your addition part of the official plugin found here on the page. Thanks!

Additionally if everybody can email me specific errors I can work on getting them debugged for you.

Thanks

May 2nd, 2007

David the Groupie asserted

Thanks Al - I’ve been fighting with that for a while. I may just do a fresh redesign a this rate.

May 2nd, 2007

Keith the Director stated

Afraid I have the same problem as David - I cannot select posts that aren’t on the first page of the ‘Manage Posts’ screen.

I think it’s a great idea for a plugin though and I’ll definitely be using it if you can get the bug fixed. (y)

May 2nd, 2007

David the Groupie remarked

I have fixed the bug over at my site davidjmiller.org/classic-posts/ - Chris can tell you when the fixed version is linked here.

May 2nd, 2007

Niki the Virgin uttered

I got mine up- the list version (TY, David). Also, to select older posts, I just pasted in the appropriate post number until the fix has been made )

May 2nd, 2007

Christopher the Pyro thought this

I’m also hosting the latest version with Davids latest fixes now.

May 2nd, 2007

Jeff the Virgin thought this

This is the error I get when activating the plugin:

WordPress database 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 ‘SHOW_COLUMNS FROM wp_posts LIKE ‘classic” at line 1]
SHOW_COLUMNS FROM wp_posts LIKE ‘classic’

WordPress database error: [Duplicate column name ‘classic’]
ALTER TABLE wp_posts ADD classic VARCHAR(1) NOT NULL DEFAULT ‘n’

Warning: Cannot modify header information - headers already sent by (output started at /home/journeyg/public_html/wp-includes/wp-db.php:121) in /home/journeyg/public_html/wp-includes/pluggable.php on line 275

May 3rd, 2007

Christopher the Pyro up'n wrote this

Try deactivating and activating again..

May 3rd, 2007

Keith the Director hunt n' pecked this

Excellent I have now been able to get the plugin working.

For my site I just wanted a list of links to the pages to display so have amended the php accordingly. If you would like a copy just drop me a line via the contact form:

http://www.f1fanatic.co.uk/credits-and-contacts/contact-f1fanatic

Thanks again for the excellent plugin. )

May 3rd, 2007

Jeff the Virgin said this

Nope, still same error message. After I refresh the plug-in list, it shows that it’s activated, but the code won’t work.

May 4th, 2007

Christopher the Pyro hunt n' pecked this

Did you deactivate it and then reactivate it?

May 4th, 2007

Christopher the Pyro uttered

The read me and zip file has been updated to include all the details of David’s improvements!

May 6th, 2007

Chris the Virgin got all philosophical

Great idea! I’m looking for something like this for ages.

Would it be possible to have a widgetized version as well, to put a list of ‘Top Posts’ into a sidebar (aka Popular Posts on wordpress.com)?

Thanks,

Chris

Life is what you make it!
http://www.nomad4ever.com

May 12th, 2007

Bill Compton the Virgin stated

Hi Jim. Photos i received. Thanks

June 4th, 2007

Leon Sceviour the Virgin mentioned

This one makes sence “One’s first step in wisdom is to kuesstion everything - and one’s last is to come to terms with everything.”

June 14th, 2007

TheV the Virgin said this

Hey Chris/Chris,

Was just wondering about step 3 in the instructions…
“3. Choose the post you would like to randomly select from”

How would I do this? i.e. How can I mark a post as being a ‘classic post?’

Thanks!

June 29th, 2007

TheV the Virgin hunt n' pecked this

Regarding my earlier post, just read the description again and found it is under Post Manager…my bad!

June 29th, 2007

joe the Groupie asserted

I’ve installed the plugin, activated, deactivated, activated again (twice), but no list of classic posts is coming up (i’ve selected about 20).

am I missing a step?

July 6th, 2007

David the Groupie hunt n' pecked this

Joe,

Have you inserted anything like “ where you want the list to show?

July 7th, 2007

David the Groupie chimed in with

Sorry - that should have said `<?php do_action(’classic_post_get_list(5)’); ?>` rather than “

July 7th, 2007

joe the Groupie stated

` rather than >>

Yes, that’s exactly the code I used. I tried it in a widget (using both RunPHP widget and ExecPHP widget), and also put it directly into the sidebar template. Maybe there’s something with my theme?

thanks for replying so quickly!

July 7th, 2007

David the Groupie commented

Unfortunately I can’t help with widgets since I don’t use them. Maybe you should try displaying a post with `<?php do_action(’classic_post_get(1,200)’); ?>` and see if that works in your main content area. That may not be what you’re looking for but it might offer some clues into the problem.

July 7th, 2007

joe the Groupie mentioned

OK, when you say “main content area”, do you mean it should go somewhere into the main index template (index.php)? Like after the comments div and before the endwhile? (or after the endwhile?)

Thanks so much for your help … this is a really cool plugin you’ve created and think it will be a nice addition for my readers.

July 7th, 2007

David the Groupie spake, and sayeth

Yes, index.php would be the mail content area. Perhaps right before ‘<?php if (have_posts()) : ?>’ (which would place it right before your latest entries) or else after ‘<?php endif; ?>’ (which would place it after your posts).

July 7th, 2007

joe the Groupie added

oh boy … that didn’t work … it broke the site and left this error:

Parse error: syntax error, unexpected T_STRING in /usr/www/users/jjanish/metstoday/wp-content/themes/wpcolors-blue-orange-fixed-2col/index.php on line 31

That was when I put the code after the endif

July 7th, 2007

David the Groupie commented

I got the same error on my site - The correct code is:
<?php do_action(classic_post_get(1,200)); ?>

For the list I’ll bet it had the same problem - The code should have been:
<

July 7th, 2007

David the Groupie pontificated

Not sure why that got cut off:
<?php do_action(classic_post_get_list(5)); ?>

July 7th, 2007

joe the Groupie thought this

That did it !!!!

It works in the widget (using runphp) now!

Thank you SO much for your help … great plugin !

July 7th, 2007

Classic Post Plugin,WordPress 经典文章(置顶)插件 - WordPress中文站 the Virgin scribbled

[…] Classic Post Plugin,经典文章插件,其作用就是将你认为经典(或重要,或需要特别显示)的文章,放到你所需要的地方。当前版本 Classic Post Plugin 1.1,此插件作者仅在 WP 2.1 以及更高版本中测试过;经过本站测试,2.3 版本下工作正常。 […]

April 21st, 2008

daily post 04/22/2008 - XO,这厮不生猛 the Virgin said this

[…] Classic Post Plugin | Battle of the Sexes : Chris vs Chris - Annotated […]

April 22nd, 2008

gary the Virgin chimed in with

hi I tried adding this to my wp2.5 site. By default ../wp-admin/edit.php shows only the option to ‘deselect’ all posts.

I tried doing so and ‘deselect’ does not change. Nothing shows up when i use classic_post_get_list on my sidebar either.

is this plugin ok for 2.5? any fix re this?

many thanks in advance

April 25th, 2008

Feed for Battle of the Sexes : Chris vs Chris

Leave a comment

Names and emails are required (emails aren't displayed), url's are optional.

) (w) (u) p (y) (n) d (*) o) 8) ( (f) (g) (t) o (8) (l) (i) x (~) (e) $ (&amp) (c) ( s (d) (o) (@) (p) (^) (b) [