Posted: 4th December 2008 by lechu in Hacks, Wordpress
Tags: , ,

wordpress-media-settings I have been using themes which needs to update the thumbnail images in the custom fields. I have been googling for plugins for Windows live writer because I usually use use this tool to do all the posts on different blogs.

After long search I could not find any plugins for this so I need to save every post as draft and edit online.

My solution to this problem

I created a function which will display the thumbnail image of the image stored. As you know in WordPress, every image uploaded creates a thumbnail with a specified image. I need an image sized 70px x 70px. So first I edited the Media settings and set the thumbnail size to 70 px width and 70px height and check the crop thumbnail to exact sizes.

When the thumbnail is created, the name of the thumbnail image file is added with "-70×70".png or .jpg depending on the format you insert.

I wrote a function which will replace the file name adding the "-70×70" to the file name

 
function the_content_limit($max_char, $more_link_text = '(more...)', $stripteaser = 0, $more_file = '') { 
$content = get_the_content(''); 
$content = apply_filters('the_content', $content); 
$content = str_replace(']]>', ']]>', $content); 
$content = str_replace('.png', '-70x70.png', $content); 
$content = str_replace('.jpg', '-70x70.jpg', $content); 
echo $content; 
} 
?> 

<br />

This function will replace the image with the thumnail image. This function can be added to the function file of the theme

I created a style in the style.css file of the theme

.mythumb { 
} 
.mythumb img { 
float:right; 
max-height:70px; 
max-width:70px; 
} 

<div class="mythumb">
    <?php the_content_limit(150, "");  ?>
</div>

Reblog this post [with Zemanta]

Related posts:

  1. New features of Windows Live Writer
  2. How to use windows live writer effectively
  3. Twitter Plugin for Windows Live Writer
  4. Auto Linking feature added to windows live writer
  5. Windows Live Writer Update
  1. ACS04 says:

    Hello,
    very good ! I’m going to try it right now as this solution seems to be simple and efficient …

    Jean-Luc

  2. takien says:

    your title “Custom Fields in Windows Live Writer”but you don’t even explain how to add/use Custom Fields from Windows Live Writer.