Skip to content

Instantly share code, notes, and snippets.

View bulentsakarya's full-sized avatar
🎯
Focusing

Bülent Sakarya bulentsakarya

🎯
Focusing
View GitHub Profile
/**
* Snippet Name: Pagination for WordPress and Bootstrap
* Snippet URL: http://www.wpcustoms.net/snippets/pagination-for-wordpress-and-bootstrap/
*/
// usage:
if ($wp_query->max_num_pages > 1) :
wpc_pagination();
endif;
@bulentsakarya
bulentsakarya / bootstrap clearfix
Created August 9, 2015 00:00
Bootstrap 3.x Clearfix
/* Bootstrap Clearfix */
/* Tablet */
@media (min-width:767px){
/* Column clear fix */
.col-lg-1:nth-child(12n+1),
.col-lg-2:nth-child(6n+1),
.col-lg-3:nth-child(4n+1),
.col-lg-4:nth-child(3n+1),
/**
* Custom Tabs
*
* @since 1.0.0
* @return void
*/
add_filter( 'woocommerce_product_tabs', 'woo_odeme_product_tab' );
function woo_odeme_product_tab( $tabs ) {
$tabs['odeme_bilgileri'] = array(
'title' => 'Ödeme Bilgileri',
@bulentsakarya
bulentsakarya / otomatik meta
Created February 18, 2017 09:20
wordpress meta oluşturucu
/**
* Otomatik META Etiketleri Fonksiyonu (10/02/17 ahmethakanbesel.com.tr)
*
* Kaynak: http://ahmethakanbesel.com.tr/wordpress-eklentisiz-otomatik-seo-etiketleri-olusturma
*/
function meta_desc_olustur() {
global $post;
if (!is_single()) { return; }
$meta = strip_tags($post->post_content);
$meta = strip_shortcodes($post->post_content);
@bulentsakarya
bulentsakarya / gist:e33e0078ea0f45e5a017b99cdd663b7f
Created March 25, 2017 19:57 — forked from saltun/gist:439794ab032b7a894d91
PHP TC Kimlik Numarası Doğrulama
<meta charset="utf-8">
<?php
function tcno_dogrula($bilgiler){
$gonder = '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<TCKimlikNoDogrula xmlns="http://tckimlik.nvi.gov.tr/WS">
<TCKimlikNo>'.$bilgiler["tcno"].'</TCKimlikNo>
<Ad>'.$bilgiler["isim"].'</Ad>
@bulentsakarya
bulentsakarya / cmb2 code field
Created July 1, 2017 18:23
cmb2 code field
add_action( 'cmb2_init', 'wprsscode_add_metabox' );
function wprsscode_add_metabox() {
$prefix = '_cmb_';
$cmb = new_cmb2_box( array(
'id' => $prefix . 'wprss_code',
'title' => __( 'Your Code', 'nivothemes' ),
'object_types' => array( 'post' ),
'context' => 'advance',
@bulentsakarya
bulentsakarya / cmb2 frontend
Created July 8, 2017 19:34
CMB 2 frontend post submit
<?php
/**
* @link http://webdevstudios.com/2015/03/30/use-cmb2-to-create-a-new-post-submission-form/ Original tutorial
*/
/**
* Register the form and fields for our front-end submission form
*/
function wds_frontend_form_register() {
@bulentsakarya
bulentsakarya / pagination.php
Last active September 26, 2017 23:22
bootstrap 3.x based wordpress pagination
function nivo_pagination($pages = '', $range = 2){
$showitems = ($range * 2)+1;
global $paged;
if(empty($paged)) $paged = 1;
if($pages == '') {
global $wp_query;
$pages = $wp_query->max_num_pages;
if(!$pages) { $pages = 1; }
}
<?php
/**
* Plugin Name: WooCommerce Active Shipping Widget
* Plugin URI: https://www.skyverge.com/blog/how-to-create-a-woocommerce-widget/
* Description: Adds a widget to display a list of active WooCommerce shipping methods
* Author: SkyVerge
* Author URI: https://www.skyverge.com/
* Version: 1.0.0
* Text Domain: wc-active-shipping-widget
*
@bulentsakarya
bulentsakarya / tax_validation.php
Created July 28, 2017 11:22 — forked from emir/tax_validation.php
PHP Vergi Numarası Doğrulama
<?php
/**
* This method logically validates Turkish VAT number
*
* @param string $taxNumber
* @return bool
*/
public function validateTaxNumber(string $taxNumber): bool
{