Telefon Numarası Formatlama

function formatPhone($phone){ $phone = preg_replace(‘/[^0-9]/’, ”, $phone); if (strlen($phone) > 10) { $countryCode = substr($phone, 0, strlen($phone) – 10); $areaCode = substr($phone, -10, 3); $nextThreeDigits = substr($phone, -7, 3); $lastFourDigits = substr($phone, -4, 4); $phone = ‘+’ . $countryCode . ‘ (‘ . $areaCode . ‘) ‘ . $nextThreeDigits . ‘-’ . $lastFourDigits; } else […]

Read More

PHP Hata Mesajı Yönetimi

Tüm hata raporlarını kapatır: error_reporting(0); Sadece basit hataları gösterir: error_reporting(E_ERROR | E_WARNING | E_PARSE); E_NOTICE kullanıldığı için gereksiz hata mesajlarını göstermez: error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); E_NOTICE harici tüm hata mesajlarını gösterir: error_reporting(E_ALL ^ E_NOTICE); Tüm hata mesajlarını gösterir: error_reporting(E_ALL);

Read More

Text Kısaltma Fonksiyonu

function truncate($text, $chars = 120) { if(strlen($text) > $chars) { $text = $text.’ ‘; $text = substr($text, 0, $chars); $text = substr($text, 0, strrpos($text ,’ ‘)); $text = $text.’…’; } return $text; }

Read More

Animasyonlu Hamburger Menüsü Yapma

<a class=”hamburger menu-btn” href=”javascript:void(0)”><span></span></a> <div class=”main-menu-wrap”> <div class=”main-menu”> <a href=”#”>Home</a> <a href=”#”>About Us</a> <a href=”#”>Services</a> <a href=”#”>Blog</a> <a href=”#”>Get in Touch</a> </div> </div> $(function(){ var clicked = 0; $(‘.menu-btn’).click(function(e){ var screen_height = $(window).height() – $(‘.mob-header’).height(); $(this).toggleClass(‘active’); $(‘body’).toggleClass(‘menu-active’); if (clicked == 0) { $(‘.main-menu-wrap’).height(screen_height); clicked = 1; return; } if (clicked == 1) { $(‘.main-menu-wrap’).removeAttr(‘style’); clicked […]

Read More

Rastgele Başlık Listeleme – WordPress

<h2>Random Posts</h2> <ul> <?php $posts = get_posts(‘orderby=rand&numberposts=5′); foreach($posts as $post) { ?> <li><a href=”<?php the_permalink(); ?>” title=”<?php the_title(); ?>”><?php the_title(); ?></a></li> <?php } ?> </ul>

Read More

İçerikleri Dinamik Olarak Sayfaya Ekleme

$(document).ready(function() { // On the click of the submit button, start the function $(“#loadBtn”).click(function() { // Append the loading image to the div that the content is being loaded within $(“#content”).append(‘<div class=”loading” style=”display:block;”></div>’); // Load the file within the content div $(this).load(“data.html”, function(){ // Hide the loading image once the content has been loaded $(“.loading”, […]

Read More

Mobil Aygıt Algılama

<?php function is_mobile() { return preg_match(“/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up.browser|up.link|webos|wos)/i”, $_SERVER["HTTP_USER_AGENT"]); } ?>

Read More

Eklentisiz Breadcrumb Hazırlama – WordPress

Aşağıdaki kodu temanızın functions.php dosyasına ekleyin: // Breadcrumbs function custom_breadcrumbs() { // Settings $separator = ‘&gt;’; $breadcrums_id = ‘breadcrumbs’; $breadcrums_class = ‘breadcrumbs’; $home_title = ‘Homepage’; // If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat) $custom_taxonomy = ‘product_cat’; // Get the query & post information global $post,$wp_query; […]

Read More

Integrate WordPress Into A Website

Aşağıdaki kodları wordpress kurulu olan root dizinine customFeed.php olarak kaydedin: <?php define(‘WP_USE_THEMES’, false); require(‘./wp-blog-header.php’); $num = $_GET["numberposts"] ?: ’10′; $cat = $_GET["catid"]; $postID = $_GET["postid"]; $type = $_GET["type"]; switch ($type){ case “singlePost”: $posts = get_posts(‘p=’.$postID.’&numberposts=1′); break; case “catFeed”: $posts = get_posts(‘category=’.$cat.’&numberposts=’.$num.’&order=ASC’); break; default: $posts = get_posts(‘numberposts=’.$num.’&order=ASC’); } ?> <xml> <items> <?php if($type == “catFeed”){ ?> […]

Read More