Click here for HomePagewww.RadMod.com
St. Louis, MO USA
The Radical Moderate
Covering: Big Brother, Propaganda, Theocracy and Liberty
By Tim Willoughby, Y.A.W.L. *
(* Yet Another Wretched Lawyer)

 
HOME RM's Platform RM's Quals About the RadMod TimsLaw.com
 

Libertarian Democrat

A Libertarian Democrat is vigorously pro-personal liberty, and believes government can play a constructive role in regulating our economy and providing a social safety net.

Categories:

About

Help Beta Test:

  • The RadMod is trying to convert an old fashioned HTML business website, TimsLaw.com, over to Wordpress. Feedback on how TimsLaw works would be appreciated.

Credits:

Internal Links:

A Moderate Motto:

"Few things in life are as good or as bad as they seem in the emotions of the moment."
--- An Anonymous Moderate

Showing only the single latest post on the Wordpress front page, and excluding some categories of posts
Posted in Category: WordPress

I fixed a chronic problem for Wordpress users: How to show a Single recent post on the Wordpress front page, 1) without setting “Posts Per Page” to 1, and 2) with the ability to exclude some categories from being eligible to be displayed on the front page at all.

See this article for background about how the Posts Per Page admin setting is EVIL. Nutshell: Setting posts per page to 1 will get you a single post on the frontpage, but will ALSO get you only 1 search result and 1 post listed under each category view.

I’ve played with some fixes, fixes that do NOT involve implementing the Wordpress “home” feature.

I want my Wordpress political blog at Radmod.com to show only 1 article on the frontpage, the very latest. BUT, I do not want the featured article to be my latest “Wordpress”-related rambling, or my latest silliness categorized under “diversions”.

Try this code in your index file, directly below the first line of LOOP code

The Wordpress LOOP is the codeblock that starts as follows: [close up all spaces to use]
< ? php if ( have _ posts ( ) ) { while ( have _ posts ( ) ) { the _ post ( ); ? >

Right below the start of the Loop code, I inserted the following: [close up all spaces to use]
< ? php if ( is _ home ( ) ): ? > < ? php if ( in _ category (16) or in_ category (15) ): ? > < ? php continue; ? >< ? php endif; ? > < ? php endif; ? >

Here’s how my code works:

  • If we are on the homepage … [Wordpress knows if the user wants the site-root (homepage) or wants a specific article. If we’re on a specific article page, don’t do anything, just display the article as normal] ….
  • … Since we’re on the Homepage, now see if the First Post’s category is 16 or 15 …
  • …….. If we’re on the homepage, AND the category is 15 or 16, then invoke the ‘continue’ command, which skips the rest of the Loopcode and returns to the top of the Loop and works on the next post … [by “continuing” we skip the display of that post]

And my code will test each of the latest posts, until one of the posts is NOT in category 15 or 16. The first post in some truly political category will be displayerd, having skipped all the Wordpress or Diversion category posts.

Once the Loop processes a post, I have a BREAK command at the bottom of the Loop, to prevent the Loop from getting a second post. [close up the extra spaces] —

I put “< ? php break ; ? >” at the bottom of the Loop just above the following:
? php } } else { // end if any posts

 

END of article
    (Printable version)    

 

Leave a Reply



Link:
Showing only the single latest post on the Wordpress front page, and excluding some categories of posts

by on Tuesday March 28, 2006.
Category: WordPress.

 

PREVIOUS post in SAME category as this post:
WP-Print 2.03 problem - fixed by reverting to old version

 

NEXT post in SAME category as this post:
Long unbroken words break Wordpress layout - Fix with word_wrap.php plugin

The RM is a "Libertarian Democrat"

A Libertarian Democrat is vigorously pro-personal liberty, and believes government can play a constructive role in regulating our economy and providing a social safety net.

Lawyers Must
Speak Out!

We must keep our ears tuned to the degeneration toward tyranny.
See Justice O'Connor's Warning.

Recent Rants:

  1. Interpetting that Roger Ailes joke about Obama, Bush and Terrorism
    in Cat: Propaganda-Media
  2. Example of Dem wingnuttery in an extreme gun ban bill (it’s probably DOA tho)
    in Cat: Politics-misc, Libertarian
  3. 11th Circuit says no right to sexual privacy, upholds Alabama ban on sale of dildos
    in Cat: Theocracy, Libertarian, Law-Courts
  4. The era of Republicans ignoring the Golden Rule has ended
    in Cat: Politics-misc
  5. National Park Service no longer discusses age of Grand Canyon - Bush further muzzles science
    in Cat: Science vs Religion
  6. Disease of willful ignorance
    in Cat: Politics-misc
  7. St. Louis County touchscreen voting: Great news and awful news
    in Cat: Politics-misc
  8. GOP merges terror and culture wars: Porn prosecutions UP, Crime -Terror prosecutions DOWN
    in Cat: Libertarian, War
  9. Skeptical Maxims about Polls and Democrats
    in Cat: Politics-misc
  10. Bush admin, not Clinton, screwed up with North Korea
    in Cat: Propaganda-Media, War

Links:

Politics
Anti-Theocracy
Media Watchdogs
  • MediaMatters.org
    Former right wing propagandist saw the light, and shines light on right wing media
  • NewsBusters
    Focusing on liberal bias in the media, food for thought for moderates and liberals
  • Newshounds
    The NewsHounds keep a close eye on the FoxNews propaganda machine
Misc
HOME  | Top of page  | Tim's Employment Law site - www.TimsLaw.com

CONTACT the RadMod

[powered by WordPress.]

Get Firefox!