I am trying to implement new theme on my website, but there is 2 problems, 1st thumbnail images are not getting display, and 2nd custom fields are disappear from post. Any idea, where i can find files to change custom fields?
thumbnails usually dont display correctly due to the sizing / croping issues, and for custome fields it depends on what you are doing, if you have a directory script then the custom fields usually are added in when submit is hit, for most other themes the custome field is added inside the post and then displayed, having said that wp3.0 changes the handling of custom fields and is a nicer way to handle them
what version of wordpress are you using? what are you using your custom fields for? Since version 2.9 its been possible to add a single line to the functions.php file and enable thumbnail upload for a post. With version 3.0 its come as standard meaning you just select a thumbnail from your media gallery and assign it as the post thumbnail. You can go more advanced and create a script which checks first for a post thumbnail, if it cant find one, it checks for the first image in the post, if it cant find an image in the post then we will tell wordpress to display a default thumbnail instead. For example, below is some scripts I have been using on one of my own sites since 2.6 There would be 3 things you need to do. 1. in your functions.php file add the get_first_image() function as below 2. upload a copy of timthumb.php to your themes directory (search google for tim thumb) 3. insert the php code for "get thumbnail script" where ever you wanted to make a thumbnail appear (yeah......you could also turn it into a function if you wanted) get_first_image() function <?php //this script gets the first image in a post function get_first_image() { global $post, $posts; $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); $first_img = $matches [1] [0]; if(empty($first_img)){ //if no image is found in post we will define a default image $first_img = "/images/no-thumb-120x120.gif"; } return $first_img; } ?> PHP: get thumbnail script <?php //############### //here we will get the thumbnail for the post if (has_post_thumbnail()) { // the current post has a thumbnail $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 10,10 ), false, '' ); echo "<img src='/wp-content/themes/gazette/timthumb.php?src=".$thumb[0]."&w=120&h=120&zc=1&q=60' alt='' />"; } else { // the current post has a custom thumbnail (post wordpress 2.9) $thereisimage = get_post_meta($post->ID, PostThumb, true); if ($thereisimage) { $thumb = get_post_meta($post->ID, 'PostThumb', $single = true); echo "<img src='/wp-content/themes/gazette/timthumb.php?src=".$thumb."&w=120&h=120&zc=1&q=60' alt='' />"; } else { //otherwise check for first image and if there is none show a default thumb $thumb = get_first_image(); echo "<img src='/wp-content/themes/gazette/timthumb.php?src=".$thumb."&w=120&h=120&zc=1&q=60' alt='' />"; } } //########## ?> PHP: