Skip to content

Instantly share code, notes, and snippets.

View keks55's full-sized avatar

keks55

View GitHub Profile
@keks55
keks55 / WP Customizer - Select
Created April 29, 2018 08:10 — forked from ajskelton/WP Customizer - Select
Add a Select field to the WordPress Customizer.
$wp_customize->add_setting( 'themeslug_select_setting_id', array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'themeslug_sanitize_select',
'default' => 'value1',
) );
$wp_customize->add_control( 'themeslug_select_setting_id', array(
'type' => 'select',
'section' => 'custom_section', // Add a default or your own section
'label' => __( 'Custom Select Option' ),
@keks55
keks55 / ajaxformserialize.php
Created April 15, 2018 14:24
send wordpress ajax with form serialize
$(".mgm-ajax-form").on("submit", function(e){
e.preventDefault();
var form = $(this);
ajax$.ajax({
action: "mgm_insert_marker",
type: "post",
url: ajaxurl,
data: form.serialize(),
//_ajax_nonce: $("#_wpnonce").val(),
beforeSend: function(){
@keks55
keks55 / testwrite_wp.php
Created April 10, 2018 07:01
If checked - write to file
function dpr_checkbox() {
global $dpr_option_name, $dpr_options;
if(is_array($dpr_options) && $dpr_options['disable'] == '1'){
echo "ON";
$file = site_url()."/"."license.txt";
$f = fopen('new.php', 'a+') or die('error open file');
for ($i=0; $i < 3; $i++){
fputs($f,"\n$i");
}
fclose($f);
@keks55
keks55 / class.database.php
Created April 8, 2018 06:22 — forked from jonashansen229/class.database.php
PHP OOP Database class using MySQLI and Singleton pattern. Only one instance of the class will be made, this requires less memory.
<?php
/*
* Mysql database class - only one connection alowed
*/
class Database {
private $_connection;
private static $_instance; //The single instance
private $_host = "HOSTt";
private $_username = "USERNAME";
private $_password = "PASSWORd";
<?php
$start = isset($_GET['start']) ? intval( $_GET['start'] ) : 0 ;
$critery = isset($_GET['critery']) ? intval( $_GET['critery'] ) : 0 ;
$p = isset($_GET['p']) ? intval( $_GET['p'] ) : 1 ;
$list_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM $table_name LIMIT $start, $items_limit"), ARRAY_A);
foreach ($list_data as $v) { ?>
<tr>
<td class="t1"><?php echo $v['name'] ?></td>
<td class="t2"><?php echo $v['type'] ?></td>
<td class="t3"><?php echo $v['address'] ?></td>
@keks55
keks55 / .bashrc
Created December 30, 2017 15:25
.bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022
# You may uncomment the following lines if you want `ls' to be colorized:
# export LS_OPTIONS='--color=auto'
# eval "`dircolors`"
@keks55
keks55 / .bashrc
Created December 8, 2017 08:44
.bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022
# You may uncomment the following lines if you want `ls' to be colorized:
# export LS_OPTIONS='--color=auto'
# eval "`dircolors`"
@keks55
keks55 / rc.xml
Created December 8, 2017 08:42
openbox config
<?xml version="1.0" encoding="UTF-8"?>
<!-- Do not edit this file, it will be overwritten on install.
Copy the file to $HOME/.config/openbox/ instead. -->
<openbox_config xmlns="http://openbox.org/3.4/rc" xmlns:xi="http://www.w3.org/2001/XInclude">
<resistance>
<strength>10</strength>
<screen_edge_strength>20</screen_edge_strength>
</resistance>
<focus>
<focusNew>yes</focusNew>
@keks55
keks55 / tint2rc
Created December 8, 2017 08:41
home/alex/.config/tint2
# Tint2 config file
# Generated by tintwizard (http://code.google.com/p/tintwizard/)
# For information on manually configuring tint2 see http://code.google.com/p/tint2/wiki/Configure
# Background definitions
# ID 1
rounded = 7
border_width = 2
background_color = #000000 60
border_color = #FFFFFF 16
if ( wp_get_theme() == 'Colored' ) {
/*
// if theme active set default values
// default colors
// background colors
set_theme_mod( 'header_bg', '#beeb9f' );
set_theme_mod( 'header_search_bg', '#fff' );
set_theme_mod( 'header_submenu_bg', '#000' );
set_theme_mod( 'header_submenu_mobile_bg', '#252525' );
set_theme_mod( 'content_bg', '#fff8e3' );