|
|
|
Libertarian DemocratA 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:
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." |
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 codeThe Wordpress LOOP is the codeblock that starts as follows: [close up all spaces to use] Right below the start of the Loop code, I inserted the following: [close up all spaces to use] Here’s how my code works:
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:
END of article
Leave a Reply
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. Recent Rants:
Links:Politics
Anti-Theocracy
Media Watchdogs
Misc
|