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 | |
function show_user_date_of_registration( $user ) | |
{ | |
$udata = get_userdata( $user->ID ); // user data | |
$registered = $udata->user_registered; // user register date | |
return date_i18n( "j M Y", strtotime( $registered )); // out | |
} | |
// Usage in author.php |
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
add_action('after_setup_theme', 'uckan_create_pages'); | |
function uckan_create_pages(){ | |
$awesome_page_id = get_option("awesome_page_id"); | |
if (!$awesome_page_id) { | |
$post1 = array( | |
'post_title' => "Sayfa Adınız!", | |
'post_content' => "", | |
'post_status' => "publish", | |
'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
<?php | |
// Oluşturma Sayfasına Ekle | |
add_action( 'category_add_form_fields', 'add_category_field', 10, 2 ); | |
function add_category_field( $taxonomy ) { ?> | |
<div class="form-field term-group"> | |
<label for="category-custom-description">Açıklama</label> | |
<textarea rows="5" id="category-custom-description" name="category-custom-description"></textarea> | |
</div> | |
<?php } |
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 | |
/** | |
* Class Cerny_Post_Type | |
* | |
* @package Cerny_Post_Type | |
* @subpackage WordPress | |
*/ | |
class Cerny_Post_Type |
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 fontawesome5_icons() { | |
return array( | |
'icons' => array ( | |
'fab fa-500px', | |
'fab fa-accessible-icon', | |
'fab fa-accusoft', | |
'fas fa-address-book', | |
'far fa-address-book', | |
'fas fa-address-card', | |
'far fa-address-card', |
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 | |
function kan_gulegule_gutenberg() { | |
if (version_compare($GLOBALS['wp_version'], '5.0-beta', '>')) { | |
// WP > 5 beta | |
add_filter('use_block_editor_for_post_type', '__return_false', 100); | |
} else { | |
// WP < 5 beta |
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 | |
# uckan.net | |
$uckicerik = $post->post_content; // yazı iceriğini çekiyor | |
$word = str_word_count(strip_tags($uckicerik)); // içerikteki kelime sayısını hesaplıyor | |
$m = floor($word / 200); // kelime sayısını 200'e bölerek dakika sayısını hesaplıyor | |
$s = floor($word % 200 / (200 / 60)); // kelime sayısının %200'ünü alıp 3.33'e bölerek saniyeyi hesaplıyor | |
echo 'Okuma süresi: '; | |
$uckokunma = $m . ' dk' . ($m == 1 ? '' : '') . ', ' . $s . ' sn' . ($s == 1 ? '' : ''); | |
echo $uckokunma; | |
?> |
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
/* Add Next Page Button in First Row */ | |
add_filter( 'mce_buttons', 'my_add_next_page_button', 1, 2 ); // 1st row | |
/** | |
* Add Next Page/Page Break Button | |
* in WordPress Visual Editor | |
*/ | |
function my_add_next_page_button( $buttons, $id ){ | |
/* only add this for content editor */ |
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 | |
function url_get_image_id($image_url) { | |
global $wpdb; | |
$attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $image_url )); | |
return $attachment[0]; | |
} | |
function uckan_get_thumbnail($size, $type) { | |
global $post; |
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 | |
/** | |
* @link http://www.uckan.net/2017/03/31/wordpresste-shortcode-ile-yazi-icerisinde-benzer-yazi-gosterme/ | |
* @html http://codepen.io/uckannet/pen/OprjVz | |
* @package WordPress | |
* @author Cagri Uckan / uckan.net | |
**/ | |
function uckan_related_post_shortcode($atts){ | |
extract(shortcode_atts(array( | |
"id" => '', |
NewerOlder