This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _get_all_meta_values($key) { | |
global $wpdb; | |
$result = $wpdb->get_col( | |
$wpdb->prepare( " | |
SELECT DISTINCT pm.meta_value FROM {$wpdb->postmeta} pm | |
LEFT JOIN {$wpdb->posts} p ON p.ID = pm.post_id | |
WHERE pm.meta_key = '%s' | |
AND p.post_status = 'publish' | |
ORDER BY pm.meta_value", | |
$key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function () { | |
var winHeight = $(window).height(), | |
docHeight = $(document).height(), | |
progressBar = $('.wpuprogress'), | |
max, value; | |
max = docHeight - winHeight; | |
$(document).on('scroll', function(){ | |
value = $(window).scrollTop(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="wpuprogress"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wpu_scripts() { | |
wp_enqueue_script( 'wpu-progressBar', get_template_directory_uri() . '/js/progressBar.js', array(), '1.0.0', true ); | |
} | |
add_action( 'wp_enqueue_scripts', 'wpu_scripts' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.wpuprogress { | |
position: fixed; /* Çubuğun sayfada sabit kalması için. */ | |
top: 0; /* Çubuğu sayfanın en üstüne aldık. */ | |
height: 2px; /* Çubuğun kalınlığını artırmak için 2 sayısını değiştirebilirsiniz. */ | |
background-color: #f44336; /* Çubuğun rengi. */ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Burada herangi bir değişken olmadığı için tek tırnak kullandık. | |
echo '<a href="#test">Test</a>'; | |
// Değişken kullanmak istiyorsanız çift tırnak kullanın. | |
echo "<a href='$link'>Test</a>"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo '<a href="' . esc_attr( $link ) . '">Test</a>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// foreach için örnek | |
foreach( $items as $item ) { | |
echo $item[ 'title' ]; | |
echo $item[ 'url' ]; | |
echo $item[ 'description' ]; | |
} | |
// if else için örnek | |
if( have_posts() ) { | |
echo 'Yazı Bulundu!'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tek ögeli dizi için tek satır kullanılmalı. | |
$query = new WP_Query( array( 'ID' => 123 ) ); | |
// Birden fazla ögeli dizilerde $args gibi değişkene atanarak | |
// her bir öge için ayrı satır oluşturulmalı. | |
$args = array( | |
'post_type' => 'page', | |
'post_author' => 123, | |
'post_status' => 'publish', | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Doğru kullanım | |
$args = array( | |
'post_type' => 'page', | |
'post_author' => 123, | |
'post_status' => 'publish', | |
); | |
// Yanlış kullanım | |
$args = array( | |
'post_type' => 'page', |
OlderNewer