Skip to content

Instantly share code, notes, and snippets.

View mustafakucuk's full-sized avatar
💻
coding...

Mustafa KÜÇÜK mustafakucuk

💻
coding...
View GitHub Profile
@mustafakucuk
mustafakucuk / functions.php
Last active July 19, 2019 22:57
Adding Estimated Reading Time to WordPress.
<?php
// For Plugin: https://tr.wordpress.org/plugins/reading-time-wp/
function reading_time($post_id) {
// Words per minute
$wpm = 150;
$post_content = get_post_field('post_content', $post_id);
$number_of_images = substr_count(strtolower($post_content), '<img ');
$post_content = strip_shortcodes($post_content);
@mustafakucuk
mustafakucuk / functions.php
Created December 7, 2018 13:40
WordPress - Disable Gutenberg without use plugin.
if (version_compare($GLOBALS['wp_version'], '5.0-beta', '>')) {
add_filter('use_block_editor_for_post_type', '__return_false', 100);
} else {
add_filter('gutenberg_can_edit_post_type', '__return_false');
}
@mustafakucuk
mustafakucuk / functions.php
Created November 17, 2018 20:11
WordPress add widgets to sidebars during theme activation.
<?php
// This codes works when theme activate.
function switch_theme(){
$widgets = get_option( 'sidebars_widgets' );
$widgets['home_sidebar'] = array(
'search-1', // widgetname-1
'text-1',
'categories-1',
);
@mustafakucuk
mustafakucuk / index.ios.js
Created October 15, 2018 08:46
React Native - Speech to text (I try for IOS https://github.com/wenkesj/react-native-voice, you can try for Android)
import React, { Component } from 'react';
import {AppRegistry, View, Text,StyleSheet,TouchableOpacity } from 'react-native';
import Speech from 'react-native-speech';
import Voice from 'react-native-voice';
export default class NVoice extends Component {
constructor(){
super();
this.state = {
results: []
@mustafakucuk
mustafakucuk / sehirler.html
Created January 15, 2017 17:13
HTML selectbox şehirler listesi
<option value="istanbul">İstanbul</option>
<option value="ankara">Ankara</option>
<option value="izmir">İzmir</option>
<option value="adana">Adana</option>
<option value="adiyaman">Adıyaman</option>
<option value="afyon">Afyon</option>
<option value="agri">Ağrı</option>
<option value="aksaray">Aksaray</option>
<option value="amasya">Amasya</option>
<option value="antalya">Antalya</option>