Archive for "Functions.php"

29 Eyl

Yazının Kaç Defa Okunduğunu Gösterme

written by No Comments posted in Functions.php, Kodlar

Bu kod sayesinde ziyaretçilerinize yazınızın kaç defa okunduğunu eklentiye gerek kalmadan gösterebileceksiniz. Adım 1 Tema dizinindeki Functions.php dosyasına aşağıdaki kodu ekleyin. 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 View”; } return $count.’ Views’; } function setPostViews($postID) { $count_key = ‘post_views_count’; $count = get_post_meta($postID, $count_key, [...]

Read more
23 Eyl

Gömülü Kodu Kullanarak YouTube Videosu Gösterme

written by No Comments posted in Functions.php, Kodlar

WordPress’te eziyete dönen YouTube videosu göstermek bu kod ile çok kolay olacak.Öncelikle temanızın functions.php dosyasına aşağıdaki kodu ekleyin. function youtube($atts) { extract(shortcode_atts(array( “value” => ‘http://’, “width” => ’475′, “height” => ’350′, “name”=> ‘movie’, “allowFullScreen” => ‘true’, “allowScriptAccess”=>’always’, ), $atts)); return ‘<object style=”height: ‘.$height.’px; width: ‘.$width.’px”><param name=”‘.$name.’” value=”‘.$value.’”><param name=”allowFullScreen” value=”‘.$allowFullScreen.’”></param><param name=”allowScriptAccess” value=”‘.$allowScriptAccess.’”></param><embed src=”‘.$value.’” type=”application/x-shockwave-flash” allowfullscreen=”‘.$allowFullScreen.’” allowScriptAccess=”‘.$allowScriptAccess.’” [...]

Read more
22 Eyl

Twitter Takipçi Sayısını Gösterme #2

written by No Comments posted in Functions.php, Kodlar, Sosyal

Bu kod ile twitter hesabınızı kaç kişinin takip ettiğini ziyaretçilerinize gösterebilirsiniz. Şu yazıdaki kodun daha farklı versiyonu. İlk olarak aşağıdaki kodu functions.php’ye ekleyin. function update_twitter_count() { $name = ‘wordpressim’; $url = ‘http://api.twitter.com/1/users/show.xml?screen_name=’. $name; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); $data = curl_exec($ch); curl_close($ch); $xml = new SimpleXMLElement($data); $count = $xml->followers_count; $count = [...]

Read more
21 Eyl

Twitter Takipçi Sayısını Gösterme

written by No Comments posted in Functions.php, Kodlar, Sosyal

Bu kod ile twitter hesabınızı kaç kişinin takip ettiğini ziyaretçilerinize gösterebilirsiniz. İlk olarak aşağıdaki kodu functions.php’ye ekleyin. function get_follower_Count(){ $count = get_transient(‘follower_count’); if ($count !== false) return $count; $count = 0; $data = wp_remote_get(‘http://api.twitter.com/1/users/show.json?screen_name=YOURNAME’); if (!is_wp_error($data)) { $value = json_decode($data['body'],true); $count = $value['followers_count']; } set_transient(‘follower_count’, $count, 60*60); // 1 hour cache return $count; } Bu [...]

Read more