Jan 08

New Plugin: ShowOnFrontPage

Tag: GeneralRichard @ 8:43 pm

Sometimes I find myself wanting to hide a post from the front page. I find that WP is so quick to post to, that I’m often tossing things into it via the “Press It” bookmarklet, but I don’t always want the whole world to see them front and center :-)

So I created the ShowOnFrontPage plugin to remedy it. It will add a checkbox to the Post Status field called “Show on front page” which will be checked by default for all posts. Uncheck it and voila no more post on the front page :-) Don’t worry, it will still show up under whatever category you posted it to…

Please please please test carefully and abundantly :-) I believe that it requires 1.3+, so please try it with that version before getting too upset!

Update (8/12/05): Help! It seems the plug-in is not working correctly on releases after 1.5, including. If anyone can help me update it, I would be most appreciative. My new job and hyperactive kid are leaving me no time at all! :) If you are a plugin author that knows what might have changed in the loop structure, let me know….

Update (9/14/05):
Super user Steve Carson updated the plugin to 0.3.1 and hopefully fixed compatibility issues and a bug or two. Feedback welcomed on the updated plugin!

Update (1/16/08):
Finally noticed and updated per the comment by Viktor below. Now posts no longer disappear when moderated comments are approved. Yikes :)

Download the plugin here: ShowOnFrontPage Plugin

(P.S. I’ve added my Amazon wish list to the sidebar, and a PayPal donation link below. I expect nothing, but would be delighted by anything :) )



[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon] Sphere: Related Content

85 Responses to “New Plugin: ShowOnFrontPage”

  1. trench says:

    this is definately a needed plugin! I want to try! THANKS!

  2. Mat says:

    Just what I’ve been looking for - Wordpress is great but its no CMS (yet!)

  3. trench says:

    I hope it doesnt become a full CMS. Simplicity is is what makes wordpress so great. Again good plugin!

  4. Alexey says:

    Nice plugin. But doesn’t work. Instead publishing I’m get error message: Database error: [You have an error in your SQL syntax near 'WHERE Post_ID = 19 AND meta_key = 'showfrontpage'' at line 1]
    SELECT meta_value FROM WHERE Post_ID = 19 AND meta_key = ’showfrontpage’;

    Any ideas?

  5. Mat says:

    ok, i installed it and nothing happens, I untick ‘Show on front page’ and save and publish the article. I go to my front page and there it is. I go back to the article and edit it and the box is ticked so I untick it again and save and publish and once again its there,

    The tick box just stays ticked

  6. Richard says:

    Mat,

    What version are you running? (Wordpress version)

    I’m beginnging to think that I’m using some 1.3+ features.

  7. Mat says:

    I have 1.2.2

  8. Richard says:

    Do you have a 1.3 install to try it on? I may have to backrev a feature or something to get it to work on 1.2.2.

  9. Mat says:

    Not got 1.3, will install and give it ago!

  10. Mat says:

    Have installed 1.3 and it works - seems this plugin is for 1.3 and upwards

  11. Alexey says:

    Hi Richard. You advice is right, just upgraded from 1.2 to 1.5 and everything ok now. Thanks a lot. Nice job.

  12. iddapidda says:

    This is a great idea! :-) … wish it was available for 1.2.2 though, not ready to upgrade just yet ..

  13. Xain says:

    please make it available for the latest version!

  14. Richard says:

    Xain, do you mean make it available for 1.2.2? It already works with the “latest” versions which are 1.5 nightly builds.

  15. Svensson Svensson » Internet från A till Z says:

    - http://www.phpbb.com - Forum kan man göraQ - http://www.q4music.com - MusiktidningR - http://www.richardgoodwin.com/wp/?p=24 - Smart WP-plugin till som tyvärr inte funkade hos mig …S - http://www.sta [...]

  16. Xain says:

    oh sorry, i meant 1.2.2
    thanx…

  17. Xain says:

    can u plz fine a solution for that?

  18. Richard says:

    Xain,

    I’m sorry, with school and work keeping me busy I’m not sure I have time to do this at the moment. But I fully support if someone else wants to hack my version to work on 1.2.2, and will host the plugin, etc.!

  19. Standing Tall » WordPress ?????????????? says:

    ??????????????????????????????? ShowOnFrontPage - ????? ???????? ????????“Show on front page?? [...]

  20. Noah Kuhn says:

    Hey there,

    Given any thought to extending this plugin to include ordering?

    Maybe include an admin control panel where you could move items up or down as well as remove an item from the frontpage. You could probably just add a new custom field and then a new admin panel that checks.

    Anyway, just some ideas.

    I have been working on my own plugin along these lines but I’m not far along enough in uderstanding wordpress to completely get it to work.

  21. indi says:

    This is a much needed plugin, ta for making it.

    One feature I’m trying hack in is to change the default from ‘Checked’ to Unchecked. That is, I want the default to be not to appear on the frontpage. I think I’ll figure it out, but it would be nice if the default could be set by changing one variable in the code.

  22. Joe Schmoe says:

    GREAT plugin for 1.5. Just what I needed. Thanks!

  23. Marcel says:

    Nice plugin! :) I am using it in my blog http://c3w.de and ists working very good. Thanks a lot! :)

  24. Ian says:

    I’ve just tried this and it seems to work, but displays the following on my site:
    WordPress database error: [Table 'strayhorn.cat_visibility' doesn't exist]
    SELECT cat_ID from cat_visibility
    WordPress database error: [Table 'strayhorn.cat_visibility' doesn't exist]
    SELECT cat_ID from cat_visibility

    Any suggestions?

  25. Ian says:

    My mistake, problem was related to a different plugin I forgot to deactivate.

  26. The Left Wing » richardgoodwin.com » Blog Archive » New Plugin: ShowOnFrontPage says:

    [...] in: ShowOnFrontPage Filed under: Irreverent Errata — Blog Goddess @ 5:52 pm richardgoodwin.com » Blog Archive » New Plugin: ShowOnFrontPage [...]

  27. Standing Tall » Blog Archive » WordPress ?????????????? says:

    [...] ??????????????????????????????? ShowOnFrontPage - ????? ???????? ????????“Show on front page?? [...]

  28. Rex Spector says:

    Thank you so much. I have been looking for a plugin like this for a long time.

  29. Michael Jones says:

    This plugin is a Godsend! Exactly what I was needing for a client’s hybrid blog I’m working on! You rule!

    One request, though. How about a way to make posts in whole categories invisible on the front page, but have the posts still visible when you view the category? A “make all posts from X category invisible on front page only” thing.

  30. Anonymous says:

    VERY Nice, much better than trying to make a category limitation for the front page. I do have one complaint though. Now I get “— Next Page »
    ” on the home page, and there is nothing on the following page.

    I never ay this before, not even when I had at leat three times as many posts on the homepage. They just scrolled.

    Is there a way to supress this “Next Page” link

  31. kp says:

    I got it! I had my “maximum number of posts to display” set to 12, as seen on the Options section of the Dashboard/Admin screen. Even though the categories I wanted to be displayed on the front page were filtered down to just two posts, the plugin script script still saw that there were 13 possible, and thus dislayed the “next” link. Once I increased the limitation to 100, all is fine.

    ps: BIG APOLOGIES to Richard. I had emailed him earlier, but accidentally about a totally different plugin…created by someone else. Sorry.

  32. katesgasis.com » ShowOnFrontPage Plugin says:

    [...] howOnFrontPage Plugin
    April 19th, 2005

    Found this nifty plugin at richardgoodwin. The plugin lets you decide whether the post will appear in the front page or not. This can [...]

  33. Stephane says:

    can’t seem to get this one to work… I simply don’t get a checkbox.

  34. Jobu says:

    Same issue as Stephane above - no errors, but checkbox does not appear. (using WP 1.5)

  35. nikki says:

    no checkbox for me either (WP1.5 with KarmaPress upgrade)

  36. Jobu says:

    I found the cause of my missing checkbox - my host is running PHP as a CGI, which breaks a bit of the plugin. In line 115 of showfrontpage.php:

    if(preg_match(’|post.php|i’, $_SERVER['SCRIPT_NAME']) && $_REQUEST['action'] == ‘edit’)

    Changing SCRIPT_NAME to SCRIPT_URL seems to fix things up for me.

    (With PHP-CGI enabled, $_SERVER['SCRIPT_NAME'] always returns something like ‘php.cgi’, causing the regex to fail. The correct script name is returned by using $_SERVER['SCRIPT_NAME'].)

    Hope this helps some people out, and thanks for the great plugin!

  37. rosseaston.com » Blog Archive » WordPress hack: changing the homepage says:

    [...] ; require(’./wp-blog-header.php’); ?> If you’d like a plugin to do this task then Richard Goodwin has developed one to do a similar job. Happy WordPress-ing. [...]

  38. nikki says:

    Thanks Jobu

    Currently doing a few draft posts whilst I’m at work - I’ve noticed that the checkbox appears after I have saved the post.

    Will investigate further when I get home…

  39. Jobu says:

    nikki - A quick and dirty fix for that would be deleting this from the line mentioned above:

    && $_REQUEST[’action’] == ‘edit’

    There’s a better way to do it, but this shouldn’t cause too much funny business if you want to try it out.

  40. John says:

    One question, this checkbox only seems to appear if you have “Standard” selected under options for when you begin to write your news articles and shows up once you click on the “Advanced” tab, but if you dont save the post or do anything seriously delicious then it turns it into a draft automatically?

    How can I stop it turning into a draft automatically?

    I like to have the advanced mode ticked for when I create an article so I get all the features I need without having to click more buttons to write an article… The checkbox does not seem to appear this way, it only seems to appear when editing a draft article or an article already posted.

    Any solutions mate?

  41. Justin says:

    Using a basic fresh install of WP 1.5.1.1, I’ve found the plugin creates duplicate entries for the showfrontpage key and prevents deletion of the duplicates until the plugin is disabled. This installation was part of Dreamhost.com’s included site hosting bundle, fwiw.

  42. Usayd says:

    Thats a great idea! I’ll probably try it out

  43. FrosBlog.com » http://www.richardgoodwin.com/wp/?p=24 says:

    [...] or trackback from your own site.

    [...]

  44. FrosBlog.com » Plugins says:

    [...]

    WordpressMay 28, 2005 07:56 pm
    Plugins

    ShowOnFrontPage It will add a checkbox to the Post Status field called “Show on front page” which will [...]

  45. Owen Clay says:

    This is perfect - just what I was after! I wanted to keep my movie reviews off my front page and now I can! If someone is subscribed to my RSS feed, will the new posts show up for them even though they are not on the front page?

  46. josch says:

    i like your solution, but it seems to that it dosent work on 1.5
    I have an other languageversion installed, could this be the problem, that i got now checkoxes?

    greetings from germany,
    josch

  47. Nick says:

    I run 1.5 and am having the problems matt is describing above (uncheck it, article still posted in front, go to edit and its checked again)

    any ideas?

  48. Jens says:

    Hi!

    I have installed your plugin, but everytime, I edit an page, it adds a showfrontpage to the keys. The result is, that I have many entries for the same key and the same article…

    Should be checked for Version 1.5.1.2 of WP. Please drop me a mail, if you have some hints for me!

  49. Phil Hart says:

    something isnt right with the php file. there seems to be missing a closing php tag. every post i make gives me a message about cannot modify header files. i disable the plugin and i can post fine.

  50. Indulge says:

    I have used and loved your plugin on WP 1.5.1.2
    Today I have updated to WP 1.5.1.3 and it’s gone! No more “show on front page” ….
    Will there be an adaption to Version 1.5.1.3 ???
    That would be so great!
    Thank you for your work and this great plugin :-)

  51. Phil Hart says:

    It’s possible my problem was becuase i was using the SVN and not the 1.5.2. I moved to 1.5.2 and my problem has gone away. thanks

  52. Bhooshan says:

    I think you’re right Richard. The plugin doesn’t work in WP 1.5+. I installed the same and doesn’t show any options in the ‘Post Status’ area. Having said that, I think you or someone from the WP community, should take some time out and update the script ASAP. It’s a definite boon to people like me who are non-developers and would like to have this feature soon.

  53. Bhooshan says:

    OK..sorry for my earlier comments. After going through the comments trail I realised that saving the post, displays the “Show on Frontpage” option. It’s still not functioning to my liking though. :(

  54. Owen Clay says:

    If you click on Advanced Editing you should see the options straight away without having to save then edit.

  55. Ian Threlfall says:

    This plugin has been really helpful for me as i want to keep things off the main page. But i also (someone else has mentioned this) would like to set the default settings as unchecked.

    I have tried to alter the code in the plugin (Changing true to flase, for checkbox value) but has made no difference!

    Any ideas, as otherwise i cannot post via email as it will jump on to the front page.

  56. Steve Carson says:

    I made a few minor changes to 1.3 in order to fix a couple issues.

    1) Placed the show on frontpage checkbox on new posts as well as when editing posts.

    2) Fixed a problem where every time I pressed save when the check box was not checked it would create a new meta record for the showfrontpage value.

    (edited: New version available for download at top of post)

  57. Scott says:

    Your functionality works for Page type posts too. With viewlevel 1 set for a Page, the user cannot view the page.

    However, the page is still listed in the sidebar. It’s be great if the page wasn’t even listed in the sidebar unless they were logged in and of a certain level.

    Nice plugin.

  58. Scott says:

    Sorry. Comment above was for the wrong plugin. :) I had a few too many tabs open.

    However, for your plugin, I am having an issue. By default the box is NOT checked, but the value = true. No matter how many times I check/uncheck the box on the initial Write, it appears on the front page. I have to go into the post after I save it to update the flag.

  59. Tony says:

    I am using wordpress 1.5 at http://www.rapnews.co.uk

    Problems:

    1. When writing a new post, and unticking the ‘display on frontpage’, this is ignored and the post appears on the main page. I have to go into edit mode on that particular post, and uncheck the option.

    2. My frontpage is set to display the most recent 20 posts. Once I installed the plug in, I started going through the posts listed in ‘manage’ and turning off ‘display on frontpage’ to lots of them’. I’ve done this on several ‘manage’ pages, including page 1 which is this month, and page 2 which is last month. On my main page, only 9 posts appear. There are 9 posts in the current month. Can I not make it display the posts from last month which I want displayed?

    3) The lack of there being a working method to set the default choice for the checkbox would be appreciated.

  60. BuildingMyEmpire.com » Show on Front Page Plugin says:

    [...] Sometimes you have a blurb to add to your blog, but you just don’t need to be constantly posting to the front page. This plugin is set up so you can check it off if you don’t want the post to be shown on the index page of your blog. It would be handy I suppose if you had some articles that were written previously and just want them posted to that day…. instead of reposting them to the main page. [...]

  61. fixfamily » Blog Archive » Less technical stuff (thank God?!) says:

    [...] Ok, I admit that last four or five posts were a bit IT-overfraughted. Fortunately, I found a plugin for Wordpress (the weblogging tool used for this site) which allows to decide whether to show new posts on the front page which is the default, obviously, or to let them go straight-to-archive. Now, you won’t see any MythTV related posts ever again, unless you go to the archive, or I also file them in a different category. [...]

  62. View from the Potting Shed » Blog Archive » Testing WordPress 2.0 before I upgrade says:

    [...] Plugins — for those of you who don’t know — are additional modules that add extra functionality to the WordPress application. For example, by default the search function in WordPress only searches the data in Posts and not static Pages, so the excellent Search Pages plugin extends the search to include Pages too. Another example, the ShowOnFrontPage plugin controls whether Posts show on the front page or not — very useful if you’re using WordPress as a Content Management System. [...]

  63. Wes DeBoer says:

    I have found a couple bugs that I fixed in the plugin. By reading the comments above it seems that some of the users having troubles with 1.5+ should benefit from these changes. They are really simple to add.

    1. the plugin does not save the show on front page setting correctly when publishing a post the first time. you have to go back and edit that post and then it will save the setting. to fix this bug add this:

    on line 44 after the line

    add_filter(’the_posts’,’showfrontpage_clearposts’,10);

    add this

    add_action(’publish_post’, ’showonfrontpage_editpost’);

    this can really go anywhere in the file outside of another function. i just put it hear for fun.

    2. the default setting for the checkbox when writing a new post was set to ‘Unchecked’, but if you want the to default to be ‘Checked’ then add this to approx. line 121 or 122

    else
    {
    $checked = ‘ checked=”checked”‘;
    }

    hope that helps you all out.

  64. Patrick says:

    Thanks for the plugin, and the edit above.

    Works fine for me in 2.0: I added it to the 2.0 plugin compatibility list

    http://codex.wordpress.org/User:Matt/2.0_Plugin_Compatibility#P_-_S

  65. Ken says:

    I edited a little more, because the “Show on Front Page” checkbox is showing up at the bottom of every a lot of pages in the admin. I changed
    if ( preg_match(’|post.php|i’, $_SERVER['SCRIPT_NAME'] ) && $_REQUEST['action'] == ‘edit’ || $_REQUEST['action'] == ” )

    to

    if ( preg_match(’|post.php|i’, $_SERVER['SCRIPT_NAME'] ) && ( $_REQUEST['action'] == ‘edit’ || $_REQUEST['action'] == ” ))

    I basically added the extra parens around the “or” statements.

  66. Mupetz says:

    oh yeh !
    huh’ , i searched something like that for 1 hour and finally here it is :)
    Working good with 2.0.1
    Thanks Richard

  67. Bill says:

    Finally i found what i’ve been looking for!! Your site! ;) Great site, folks!!
    great graphics…;)

  68. kristian says:

    This is a great plugin. Really usefull. Thanks a lot

  69. Robert Buzink says:

    Works perfect, also on 2.0.2. Should be default wordpress fuctionality!

  70. Robert Buzink says:

    I was a bit to enthousiastic, I guess. I had to use Ken’s hack to make sure it didn’t show up on every page. That’s ok, doesn’t cost much effort. Now I have another. more serious problem:

    All of a sudden, after I posted a lot (6) of posts that were not on the frontpage, only the last post showed up on the frontpage, all others dissapeared into the categories. They still had the ’show on frontpage’ button checked though. After deactivating the show on frontpage plugin everything went back to normal. I’m not sure what is the problem all of a sudden. it could be the many non-frontpage posts, but it could also be something else.

    Anyone with the same problem? (I’m really sad now, because I liked this plugin alot. Now I have to mess around with dates to get posts of the mainpage :-( )

  71. George says:

    Fantastic plugin - I’m new to the whole Wordpress thing and this is great!!! Exactly what I was looking for - you da MAN !!! :)

  72. Elias says:

    A truly awesome plugin, a must. Great work !

  73. Chris Heuer’s Idea Engine » links for 2006-08-24 says:

    [...] New Plugin: ShowOnFrontPage at richardgoodwin.com (tags: wp:plugin) [...]

  74. Fnool #1558 says:

    Great work!
    Thanks.

  75. Ped says:

    Your horoskope for today is fantastic…use it the best way ;)

  76. Milly says:

    Concur with all commenters above: great! Should be WordPress standard.

  77. xbxgb0y says:

    拓展训练 ,[url=http://www.nicefu.com]拓展训练[/url],拓展训练 ,[url=http://www.51nlp.net]拓展训练[/url]

  78. mois says:

    i would like to use pocket SharpMT to blog in wordpress. sharpmt uses movable type as i know. it allready works with the wordpress standard xmlrpc.php which writes the movable type posting into the worpress database.
    but now comes ShowOnFrontPage in: as i’m using the showonfrontpage-plugin, all my posts via xmlrpc won’t show up on my frontpage as somehow the showfront variable is set ‘false’. now im looking for a way to avoid having set that variable (without deactivating showonfrontpage-plugin ;-) ) every time i’m blogging via bloggingsoftware and not using the wordpress form.
    any ideas?

  79. » mois-Blog says:

    [...] i would like to use pocket SharpMT to blog in wordpress. sharpmt uses movable type as i know. it allready works with the wordpress standard xmlrpc.php which writes the movable type posting into the worpress database. but now comes in the handy wordpress-Plugin ShowOnFrontPage. i like this plugin a lot, but: everything posted via xmlrpc.php (and not via wordpress authoring form) won’t show up on my frontpage. somehow the showfront variable of that post is set ‘false’. now im looking for a way to avoid having set that variable (without deactivating the showonfrontpage-plugin ;-) ) every time i’m blogging via bloggingsoftware and not using the wordpress form. any ideas? Moblogging Plugins Technik Wordpress Weitere thematisch naheliegende Einträge Download EzStaticHexa-FarbenZwei neue Bücher… [...]

  80. Azzurra says:

    Buon luogo, congratulazioni, il mio amico!

  81. Marco says:

    I’ve installed the plugin and I can check and uncheck the checkbox and save it correctly, but eitherway the post will show on the page.
    (using Wordpress 2.0.5)

  82. Viktor Persson says:

    There was a bug (atleast for me) that made the post dissapear from frontpage when someone entered a comment on the post. It seemed like when entering a comment it called the filters and accidently set the ShowOnFrontpage to ‘false’.

    I fixed this by changing line 90.

    else {

    to

    else if (isset($_REQUEST["post_ID"])) {

    .. this makes sure the showonfrontpage value only is updated when editing a post.

    Regards

  83. Update to ShowOnFrontPage at richardgoodwin.com says:

    [...] a brief update as suggested by a commenter to my ShowOnFrontPage plugin. Thanks Viktor! Sphere: Related [...]

  84. Rachel says:

    Hi, Richard,

    Not sure if I am doing something wrong (entirely possible since I am still a WP newbie) but I can’t get the plugin to show up in the plugin list using WP 2.3.2. I’ve tried uploading it in the folder and without the folder - either way it doesn’t show up in the list…

    Thanks!

    Rachel

  85. Ash says:

    Hi Richard

    Nice plugin. Tried it on a 2.3.3 blog and whilst i can activate the plugin unlike Rachel above it does’nt actually work.

    Any ideas?

Leave a Reply