Skip to content

Instantly share code, notes, and snippets.

Çağrı cagriuckan

Block or report user

Report or block cagriuckan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cagriuckan
cagriuckan / fontawesome-5.php
Last active Apr 6, 2019
Font Awesome 5 Icon Array
View fontawesome-5.php
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',
@cagriuckan
cagriuckan / functions.php
Last active Dec 8, 2018
Wordpress 5.0 ve üstü versiyonlarda gutenberg editörü yerine eski klasik editörü kullanmaya devam etmek için functions.php'ye eklenmesi gereken kod.
View functions.php
<?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
@cagriuckan
cagriuckan / functions.php
Created Nov 10, 2017
Wordpress - Yazının okunma süresini hesaplama
View functions.php
<?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;
?>
View functions.php
/* 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 */
View single.php
<?php wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Sayfa:', 'uckan' ),
'after' => '</div>',
'link_before' => '<span class="page-number">',
'link_after' => '</span>',
)); ?>
View create-page.php
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',
);
@cagriuckan
cagriuckan / index.php
Created Jul 19, 2017
Get First Image
View index.php
<?php
uckan_get_thumbnail('full', 'url'); // Sadece görselin urlini almak istiyorsanız bunu kullanın
uckan_get_thumbnail('gorsel'); // IMG kodlarıyla birlikte gelmesini istiyorsanız bunu kullanın
?>
@cagriuckan
cagriuckan / functions.php
Last active Jul 19, 2017
Wordpress - FIRST IMAGE IN POST
View functions.php
<?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;
@cagriuckan
cagriuckan / shortcodes.php
Last active Mar 31, 2017
Wordpress Related Post Shortcode
View shortcodes.php
<?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" => '',
@cagriuckan
cagriuckan / functions.php
Created Mar 31, 2017
Wordpress Post Thumbnails
View functions.php
<?php
<!-- Begin -->
add_theme_support('post-thumbnails');
if ( function_exists( 'add_image_size' ) ){
add_image_size( 'uckan-small' ,190, 120, true );
}
<!-- End -->
?>
You can’t perform that action at this time.