Of course it wasn’t great as WordPress, but it had nice features that WordPress doesn’t have. About five or six years ago, I was blogging on a platform called LiveJournal. Display Your Mood Or The Music You’re Listening To How to: Manually define whether to show full posts or excerpts on your home pageģ.If this custom field is set, full posts are displayed. The first thing it does is look for a custom field called full. To show full posts on your home page, simply edit the post and create a custom field called full and give it any value.Ĭode explanation. In this code, excerpts are displayed by default. Find the loop in your index.php file and replace it with the following code: Once more, we’ll use a custom WordPress loop. The following hack lets you define how a post is displayed on your home page. But wait: with custom fields, we can do it easily. Sure, WordPress has no built-in option to let you define how a post is displayed. I’ve always wondered why 95% of bloggers displays all of their posts the same way on their home page. Define How Blog Posts Are Displayed On The Home Page How to: Set a post’s expiration date and time on your WordPress blogĢ.Note that this code does not remove or unpublish your post, but just prevents it from being displayed in the loop. If the current date and time is equal to or earlier than the value of the custom expiration field, then the post is not displayed. If one is, its value is compared to the current date and time. This code is simply a custom WordPress loop that automatically looks to see if a custom field called expiration is present. The post will not show up after the time on that stamp.Ĭode explanation. Specify expiration as a key and your date and time as a value (with the format mm/dd/yyyy 00:00:00). To create a post set to expire at a certain date and time, just create a custom field. $secondsbetween = strtotime($expirestring)-time() $expirestring = implode($expirationtime) $expirationtime = get_post_custom_values('expiration') Edit your theme and replace your current WordPress loop with this “hacked” loop: This may seem quite hard to do but in fact is not, using the power of custom fields. Sometimes (for example, if you’re running a contest), you want to be able to publish a post and then automatically stop displaying it after a certain date.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |