Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
coding...

Mustafa KÜÇÜK mustafakucuk

💻
coding...
View GitHub Profile
@mustafakucuk
mustafakucuk / functions.php
Last active Jul 19, 2019
Adding Estimated Reading Time to WordPress.
View functions.php
<?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 Dec 7, 2018
WordPress - Disable Gutenberg without use plugin.
View functions.php
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 Nov 17, 2018
WordPress add widgets to sidebars during theme activation.
View functions.php
<?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 Oct 15, 2018
React Native - Speech to text (I try for IOS https://github.com/wenkesj/react-native-voice, you can try for Android)
View index.ios.js
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 Jan 15, 2017
HTML selectbox şehirler listesi
View sehirler.html
<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>