Skip to content

Instantly share code, notes, and snippets.

@akinayturan
akinayturan / functions.php
Created February 10, 2015 20:29
WP ~ Eklentilerin Gereksiz Kodlarını Kaldırma
<?php
//epfarki.com //Gereksiz .css ve .js dosyalarını kaldırma
function stil_sil() {
if(!is_page('İletişim')){
wp_deregister_style( 'contact-form-7' );
}
wp_deregister_style( 'cptchStylesheet' );
wp_deregister_style( 'codecolorer' );
wp_deregister_script( 'wp-recentcomments-jquery' );
}
@akinayturan
akinayturan / show.css
Created February 10, 2015 20:32
WP ~ Kategorileri İkiye Bölme
.sag {float:left; width:45%}
.sol {float:left; width:45%}
@akinayturan
akinayturan / show.php
Created February 10, 2015 20:37
WP ~ Toplam Kategori, Yazı, Yorum Sayısını Gösterme
<?php
$args=array(
'orderby' => 'name',
'order' => 'ASC'
);
$categories=get_categories($args);
$cat_count = 0;
foreach($categories as $c) {
$cat_count++;
@akinayturan
akinayturan / show.php
Created February 10, 2015 20:38
WP ~ Kategorileri Alfabetik Sıralamak
<?php wp_list_cats('sort_column=name&hierarchical=0'); ?>
@akinayturan
akinayturan / .htaccess
Created February 10, 2015 20:39
WP ~ Dizinlere Erişimi Engellemek
Options -Indexes
@akinayturan
akinayturan / functions.php
Created February 10, 2015 20:41
WP ~ Eklentisiz Rastgele Yazıya Gitme
function yazi_yonlendir() {
global $wpdb;
$query = "SELECT ID FROM $wpdb->posts WHERE post_type = 'post' AND post_password = '' AND post_status = 'publish' ORDER BY RAND() LIMIT 1";
if ( isset( $_GET['random_cat_id'] ) ) {
$random_cat_id = (int) $_GET['random_cat_id'];
$query = "SELECT DISTINCT ID FROM $wpdb->posts AS p INNER JOIN $wpdb->term_relationships AS tr ON (p.ID = tr.object_id AND tr.term_taxonomy_id = $random_cat_id) INNER JOIN $wpdb->term_taxonomy AS tt ON(tr.term_taxonomy_id = tt.term_taxonomy_id AND taxonomy = 'category') WHERE post_type = 'post' AND post_password = '' AND post_status = 'publish' ORDER BY RAND() LIMIT 1";
}
if ( isset( $_GET['random_post_type'] ) ) {
$post_type = preg_replace( '|[^a-z]|i', '', $_GET['random_post_type'] );
@akinayturan
akinayturan / show.php
Created February 10, 2015 20:43
PHP ~ Saat farkı Sorunu Çözümü
$saatfarki = "3"; //server ile aradaki saat farkı
$tarih_arr = getdate((time()+3600*$saatfarki));
$tarih = $tarih_arr["mday"];
echo "$tarih";
@akinayturan
akinayturan / show.php
Created February 10, 2015 20:45
PHP ~ Site Meta Bilgilerini Çekme
<?PHP
$meta = get_meta_tags('http://epfarki.com/');
echo "<b>Site Açıklaması:</b> ".$meta['description']."<br /><br />";
echo "<b>Site Anahtar Kelimeleri:</b> ".$meta['keywords']."<br /><br />";
?>
@akinayturan
akinayturan / show.php
Created February 10, 2015 20:48
PHP ~ Site Title Bilgilerini Çekmek
<?PHP
function TitleOku($url){
$icerik = file_get_contents($url);
$kalip = "|<[s]*title[s]*>([^<]+)<[s]*/[s]*title[s]*>|Ui";
if(preg_match($kalip, $icerik, $match))
{
return $match[1];
}
else
{
@akinayturan
akinayturan / show.php
Last active November 9, 2016 09:08
WP ~ Yazılarınızın Son Güncelleme Tarihini Gösterme (http://baykusgrup.com/wp-yazilarinizin-son-guncelleme-tarihini-gosterme/)
<?php the_modified_date('j F Y'); ?> // "15 Mayıs 2012" şeklinde
<?php the_modified_date('d.m.Y'); ?> // "15.05.2012" şeklinde
<?php the_modified_date('d.m.y'); ?> // "15.05.12" şeklinde
<?php the_modified_time('H:i'); ?> // "10:51" şeklinde