Skip to content

Instantly share code, notes, and snippets.

View bulentsakarya's full-sized avatar
🎯
Focusing

Bülent Sakarya bulentsakarya

🎯
Focusing
View GitHub Profile
@bulentsakarya
bulentsakarya / woocommerce-quanitity-max.php
Created December 8, 2019 20:35
WooCommerce ürün satış miktarını değiştirme
/*
* Changing the maximum quantity to 5 for all the WooCommerce products
*/
function woocommerce_quantity_input_max_callback( $max, $product ) {
$max = 5;
return $max;
}
add_filter( 'woocommerce_quantity_input_max', 'woocommerce_quantity_input_max_callback', 10, 2 );
@bulentsakarya
bulentsakarya / woocommerce-change-add-to-cart-text-archive-and-category.php
Last active November 30, 2019 10:12
Woocommerce "Sepete Ekle" buton yazısını değiştirme
// To change add to cart text on product archives(Collection) page
add_filter( 'woocommerce_product_add_to_cart_text', 'woocommerce_custom_product_add_to_cart_text' );
function woocommerce_custom_product_add_to_cart_text() {
return __( 'Hemen Al', 'woocommerce' );
}
@bulentsakarya
bulentsakarya / woocommerce-disable-payment.php
Last active November 29, 2019 20:28 — forked from corsonr/functions.php
WooCommerce: disable payments on checkout page
<?php // Do not include this if already open! Code goes in theme functions.php.
// Disable all payment gateways on the checkout page and replace the "Pay" button by "Place order"
add_filter( 'woocommerce_cart_needs_payment', '__return_false' );
@bulentsakarya
bulentsakarya / func.php
Last active September 21, 2019 13:03
wp tarih ekleme
// Load our function when hook is set
add_action( 'pre_get_posts', 'rc_modify_query_get_posts_older_than_today' );
function rc_modify_query_get_posts_older_than_today( $query ) {
// Check if on frontend and main query is modified
if( ! is_admin() && $query->is_main_query() ) {
if($query->is_search()) {
$timeago = $_GET['timeago'] != '' ? $_GET['timeago'] : '';
@bulentsakarya
bulentsakarya / like-it-enqueue.php
Created August 10, 2019 16:00 — forked from shizhua/like-it-enqueue.php
Add a like button without a plugin in WordPress
add_action( 'wp_enqueue_scripts', 'pt_like_it_scripts' );
function pt_like_it_scripts() {
if( is_single() ) {
wp_enqueue_style( 'like-it', trailingslashit( plugin_dir_url( __FILE__ ) ).'css/like-it.css' );
if (!wp_script_is( 'jquery', 'enqueued' )) {
wp_enqueue_script( 'jquery' );// Comment this line if you theme has already loaded jQuery
}
wp_enqueue_script( 'like-it', trailingslashit( plugin_dir_url( __FILE__ ) ).'js/like-it.js', array('jquery'), '1.0', true );
@bulentsakarya
bulentsakarya / kinsta-share-users.php
Created December 18, 2018 14:10 — forked from carlodaniele/kinsta-share-users.php
A plugin to share users and usermeta tables between independent WordPress installations. This plugin requires CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE defined into wp-config file
<?php
/**
* @package Kinsta_Share_Users
* @version 1.0
*/
/*
Plugin Name: Kinsta Share Users
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin for Kinsta blog readers
Author: Carlo Daniele
<?php
/**
* Template Name: Contact Form
*
* The contact form page template displays the a
* simple contact form in your website's content area.
*
* @package WooFramework
* @subpackage Template
*/
@bulentsakarya
bulentsakarya / Vps Kurulumu
Created October 25, 2018 09:16
Ubuntu + Apache + MySQL + Php + Let's Encrypt + Mod Pagespeed + WordPress
sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoclean
sudo apt-get autoremove
adduser sakarya
usermod -aG sudo sakarya
ufw app list
ufw allow OpenSSH
@bulentsakarya
bulentsakarya / gist:931a5a953a94cbc9327468fff11e812c
Created October 23, 2018 13:25 — forked from Marian0/gist:4d689c33164bc9daf0e1
Disable wordpress Frontend by htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !/wp-admin
RewriteCond %{REQUEST_URI} !/wp-includes
RewriteCond %{REQUEST_URI} !/wp-login\.php$
RewriteCond %{REQUEST_URI} !/wp-content
RewriteCond %{REQUEST_URI} !/feed
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>