Cevaplar
Hiç cevap bulunamadı.
İlk cevabı siz yazın.
function populer_yazilar($limit=10) { global $wpdb; $populer_yazilar = $wpdb->get_results("SELECT id,post_title FROM wp_posts WHERE post_status = 'publish' AND wp_posts.post_type = 'post' ORDER BY comment_count DESC LIMIT 0,$limit"); return $populer_yazilar; }
function rastgele_yazilar($limit=5) { global $wpdb; $sql = "SELECT id,post_title FROM wp_posts WHERE id >= (SELECT FLOOR( MAX(id) * RAND()) FROM wp_posts ) AND post_status = 'publish' AND wp_posts.post_type = 'post' ORDER BY id LIMIT $limit" ; $rastgele_yazilar = $wpdb->get_results($sql); return $rastgele_yazilar; }
function son_yorumlar($limit=5, $yazi_uzunlugu=60) { global $wpdb; $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type, SUBSTRING(comment_content,1,$yazi_uzunlugu) AS com_excerpt FROM wp_comments LEFT OUTER JOIN wp_posts ON (wp_comments.comment_post_ID = wp_posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT $limit" ; $comments = $wpdb->get_results($sql); return $comments; }
function thumbnail($postid=0, $g='200', $y='200', $yazdir=false) { if($postid < 1) $postid = get_the_ID(); $yazi_resmi = get_post_meta($postid, "image", TRUE); if($yazi_resmi != null or $yazi_resmi != '') { //$thumb = $yazi_resmi; } elseif($images = get_children(array( 'post_parent' => $postid, 'post_type' => 'attachment', 'numberposts' => '1', 'post_mime_type' => 'image',))) foreach($images as $image) { $thumbnail = wp_get_attachment_image_src($image->ID, $size); $yazi_resmi = $thumbnail[0]; } else { $yazi_resmi = get_bloginfo('stylesheet_directory') . '/img/resim.jpg'; } //$a = pathinfo($yazi_resmi); $upload = wp_upload_dir(); $resim_adi = basename($yazi_resmi); $thumb_adi = $g.'_'.$y.'_'.$resim_adi; $thumb_path = $upload['path'].'/'.$thumb_adi; $thumb = $upload['url'].'/'.$thumb_adi; if(!file_exists($thumb_path)) { require_once (TEMPLATEPATH . '/image-resize-class/resize-class.php'); $resizeObj = new resize($yazi_resmi); $resizeObj -> resizeImage($g, $y, 'crop'); $resizeObj -> saveImage($thumb_path, 100); } return $thumb; }