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 | |
$foo = array( | |
'echo' => false, | |
'include' => 1, | |
); | |
$bar = esc_html__( 'Test Yazı', 'text-domain' ); | |
test_fonksiyon( $foo, $bar ); | |
// Yanlış kullanım | |
test_fonksiyon( array( echo => false, include => 1 ), esc_html__( 'Test Yazı', 'text-domain' ) ); |
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( | |
'echo' => false, | |
'include' => array( 1, 2 ), | |
); | |
// Yanlış kullanım | |
$args = [ | |
'echo' => false, | |
'include' => [ 1, 2 ], |
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
<?php if ( have_posts() ) : ?> | |
<div class="hfeed"> | |
<?php while ( have_posts() ) : the_post(); ?> | |
<article id="post-<?php the_ID() ?>" class="<?php post_class() ?>"> | |
<!-- ... --> | |
</article> | |
<?php endwhile; ?> | |
</div> | |
<?php endif; ?> |
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 | |
if( condition ) { | |
action1(); | |
action2(); | |
} elseif( condition2 && condition3 ) { | |
action3(); | |
action4(); | |
} else { | |
defaultaction(); | |
} |
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
switch( $type ) { | |
case 'foo': | |
some_function(); | |
break; | |
case 'bar': | |
some_function(); | |
break; | |
} |
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', |
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
// 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
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
// 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>"; |