// Kısa Başlık
function baslik($char) {
$title = get_the_title($post->ID);
$title = mb_substr($title,0,$char,'UTF-8').'...';
echo $title;
}
// Kısa Başlık 2
function baslik2($char) {
$title = get_the_title($post->ID);
$title = mb_substr($title,0,$char,'UTF-8');
echo $title;
}
// Öne çıkarılmış görsel
add_theme_support('post-thumbnails');
// tarih saat önce gösterimi
function human_time() {
$time = human_time_diff(get_the_time('U'), current_time('timestamp'));
if ($time >= 365) {
$time = round($time/365);
return $time.' yıl önce';
} else if ($time >= 30) {
$time = round($time/30);
return $time.' ay önce';
} else if ($time >= 7) {
$time = round($time/7);
return $time.' hafta önce';
} else {
return $time.' önce';
}
}
//görüntülenme sayısı
function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
return "0";
}
return $count;
}
function setPostViews($postID) {
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
$count = 0;
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
}else{
$count++;
update_post_meta($postID, $count_key, $count);
}
}
/*Yorumlar Fonksiyon*/
if ( ! function_exists( 'twentyeleven_comment' ) ) :
function twentyeleven_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
?>
', '' ); ?>
break;
default :
?>
id="li-comment-">
break;
endswitch;
}
endif; // ends check for twentyeleven_comment()
?>
// Sayfalama
function wk_sayfalama() {
global $wp_query;
$wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;
$wk_sayfalama = array('base' => @add_query_arg('paged','%#%'),'total' => $wp_query->max_num_pages,'current' => $current,);
echo paginate_links($wk_sayfalama);
}
function kategoriPosts($katid) {
global $wpdb;
$post_say = 0;
$querystr = "SELECT count FROM wp_term_taxonomy WHERE term_id = '$katid' AND taxonomy = 'category'";
$result = $wpdb->get_var($querystr);
$post_say = $result;
return $post_say ;
}
/* sayfalama baş */
function sayfalama($pages = '', $range = 2)
{
$showitems = ($range * 2)+1;
global $paged;
if(empty($paged)) $paged = 1;
if($pages == '')
{
global $wp_query;
$pages = $wp_query->max_num_pages;
if(!$pages)
{
$pages = 1;
}
}
if(1 != $pages)
{
echo "";
if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "
«";
if($paged > 1 && $showitems < $pages) echo "
‹";
for ($i=1; $i <= $pages; $i++)
{
if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
{
echo ($paged == $i)? "
".$i."":"
".$i."";
}
}
if ($paged < $pages && $showitems < $pages) echo "
›";
if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "
»";
echo "
";
}
}
/* sayfalama son */
require_once(TEMPLATEPATH . '/tpanel_ym/nhp-options.php');
?>
bu benim functions.php dosyam burda hem öne çıkarılmış görseli hemde özel alanda resim olarak ayarlamak istiyorum arkadaşlar yardımlarınızı bekliyorum