Posts tagged post
The lazy bloggers post
0If you are a lazy blogger then this tool is for you! It will create blog posts for free for your use!
Here is the article I generated:
Foreign I just got slapped with a wet salmon - really - I have not updated this since they invented sliced bread... You would not believe that I actually have a life. I prostrate myself in sorrow and beg thy forgiveness..
I am lost in a sea of pseudo-olde-english with setting fire to people wearing Crocs, learning to speak Japanese, just generally being the life of the party to various lawyers I met recently, my day is full to overflowing from the light through yonder window breaks to I feel like going to bed. I am happy with that. life happens.
I go, my lords and ladies; just I will blog more regularly. You wanna test me? The Piccaninnies say I have to!.
Try for yourself!
Display previous/next posts in single, category… in WordPress
0This is a really good option in WordPress, yet very few know how to do it. Well the code is relatively simple, and it gives a good navigation point for users that, if they liked your article, might want to keep reading your stuff.
If you want to plainly display the next post after the one the user is reading, use the following function:
< ?php next_post_link(); ?>
Now this function has several (very useful) parameters, which are:
< ?php next_post_link('format', 'link', in_same_cat, 'excluded_categories'); ?>
Format: For example bold ('%link'), italics ('%link')... And so on, you can add here divs, p, span or anything you want to apply css classes or ids.
Link: To display a custom text instead of the post title, for example if you want "Next post" use:
< ?php next_post_link('%link', 'Next post in category', TRUE); ?>
in_same_cat: A very handy parameter if you want to display only the next post of the same category. Set to TRUE if you want it that way, or FALSE if you simply want the next post.
You can use one more parameter to exclude categories, for example:
< ?php next_post_link('%link', 'Next post in category', TRUE, '13'); ?>
And now the next post will be from the same category, unless that category is 13 (The id, check in the administration panel)
If you want to exclude multiple categories you'll have to use the "and" separator. It will work like this:
'1 and 5 and 15'
Note: If you are using WordPress 2.2, the concatenation method was a comma (','). So you would use:
'1,5,15'
Of course to display previous posts substitute next by previous, with everything else being the same.
Enjoy,
Easily assign an image to a post in WordPress
1Have you ever wondered how to assign an image to a certain post using WordPress? Surely there are some plugins that try to do this, and maybe they accomplish it, but probably slowing down your blog.
Well, here is a way of doing it without slowing the blog or installing any sort of additional plugins. When you are done writing your post, upload an image to a directory that you will use for this, for example: "www.yoursite.com/post_images/". And I recommned that you name the image something that has to do with the post, it will help you if you need to edit it.
Now in the writing are scroll down until you see the tab "Custom fields":

And fill in the following information:
Key: post_image Value: image_name.jpg
The key must be always the same, in this example it will be post_image. And the value will be the name of the image that we uploaded. In the example it is assigning_images.jpg
And that's it for now. The next step is including this images into our template.
Add the image to the template:
As you can see under the tab Custom Fields there is a link to the WordPress codex, where they explain the functions we'll use for this, so consult that if you have any doubts.
So here is the code to display the image (It must be inserted inside the Loop):
if(get_post_meta($post->ID, 'post_image',true)){ //There is an image assigned: echo '<img src="http://yourblog.com/post_images/'.get_post_meta($post-/>ID, 'post_image',true).'" />'; }
Note that if you copy and paste the code before you'll have to delete a / in $post->ID because WordPress is adding it automatically.
Of course this is the most basic approach, but hopefully you will understand the method and will be able to work on it.
At the moment I am using it to display thumbnails on the archive excerpts (They are not live yet, I'm still testing) and it is a very easy and fast way of doing it.
If you ever need to edit either the image or the meta-data simply re-upload the picture or edit the post.
Cheers,