Skip to content

Instantly share code, notes, and snippets.

View rupomkhondaker's full-sized avatar

Rupom Khondaker rupomkhondaker

View GitHub Profile
@rupomkhondaker
rupomkhondaker / pdb-volunteer-dropdown.php
Created July 16, 2018 12:13 — forked from xnau/pdb-volunteer-dropdown.php
Demonstrates a plugin for using database values to populate a dropdown control in Participants database.
<?php
/**
* Plugin Name: PDB Volunteer Dropdown
* Description: load the registered volunteers into a Participants Database form
* dropdown
*/
/*
* sets our function to be called when the pdb-form_element_build_dropdown action
* is triggered by the form
*/
@rupomkhondaker
rupomkhondaker / dl-file.php
Created August 28, 2018 07:02 — forked from hakre/dl-file.php
Wordpress login to download uploaded files
<?php
/*
* dl-file.php
*
* Protect uploaded files with login.
*
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in
*
* @author hakre <http://hakre.wordpress.com/>
* @license GPL-3.0+
@rupomkhondaker
rupomkhondaker / Controller.php
Created September 6, 2018 09:21 — forked from gmazzap/Controller.php
WordPress plugin to ease the creation of virtual pages.
<?php
namespace GM\VirtualPages;
/**
* @author Giuseppe Mazzapica <giuseppe.mazzapica@gmail.com>
* @license http://opensource.org/licenses/MIT MIT
*/
class Controller implements ControllerInterface {
private $pages;
@rupomkhondaker
rupomkhondaker / draft.js
Created September 9, 2018 06:06 — forked from landsman/draft.js
automatic convert bootstrap v. 3 to bootstrap v. 4 idea ... more on https://github.com/twbs/bootstrap/blob/v4-dev/docs/4.0/migration.md, http://upgrade-bootstrap.bootply.com/
let gulp = require('gulp'),
replace = require('gulp-batch-replace'),
filesExist = require('files-exist');
gulp.task('bt4', () =>
{
let diff = {
'@media (min-width: $screen-xs-min) and (max-width: $screen-sm-max)': '@media (min-width: map-get($grid-breakpoints, xs)) and (max-width: map-get($grid-breakpoints, xs))',
'@media (min-width: $screen-xs) and (max-width: ($screen-md-min - 1))': '@media (min-width: map-get($grid-breakpoints, xs)) and (max-width: map-get($grid-breakpoints, md)-1)',
@rupomkhondaker
rupomkhondaker / wp-admin-select2.php
Created September 12, 2018 12:00 — forked from yanknudtskov/wp-admin-select2.php
Add select2 to all select fields in WordPress Admin
<?php
function enqueue_select2_jquery() {
wp_register_style( 'select2css', '//cdnjs.cloudflare.com/ajax/libs/select2/3.4.8/select2.css', false, '1.0', 'all' );
wp_register_script( 'select2', '//cdnjs.cloudflare.com/ajax/libs/select2/3.4.8/select2.js', array( 'jquery' ), '1.0', true );
wp_enqueue_style( 'select2css' );
wp_enqueue_script( 'select2' );
}
add_action( 'admin_enqueue_scripts', 'enqueue_select2_jquery' );
@rupomkhondaker
rupomkhondaker / my.cnf
Created September 24, 2018 06:20 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaSQL (on cPanel/WHM servers)
# Optimized my.cnf configuration for MySQL/MariaSQL on cPanel/WHM servers
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# === Updated July 2018 ===
#
# The settings provided below are a starting point for a 2GB - 4GB RAM server with 2-4 CPU cores.
# If you have less or more resources available you should adjust accordingly to save CPU,
# RAM and disk I/O usage.
# The settings marked with a specific comment or the word "UPD" after the value
@rupomkhondaker
rupomkhondaker / my.cnf
Created October 11, 2018 11:56 — forked from peerax/my.cnf
mySQL config file for ram 8GB
# my.cnf for TAKIS Server
# BEGIN CONFIG INFO
# DESCR: 8 GB RAM, InnoDB only, ACID, few connections, heavy queries
# TYPE: SYSTEM
# END CONFIG INFO
[client]
port = 7000
socket = /var/lib/mysql/mysql.sock
@rupomkhondaker
rupomkhondaker / template-authors.php
Created February 19, 2020 11:57 — forked from IngmarBoddington/template-authors.php
Example authors page template for multi-author WordPress blogs
<?php
/*
Template Name: Authors
*/
?>
<?php get_header(); ?>
<!-- BEGIN #content-wrap -->
<div id="content-wrap" class="clearfix">
SELECT p.`ID`,
p.`post_title` AS coupon_code,
p.`post_excerpt` AS coupon_description,
Max(CASE WHEN pm.meta_key = 'discount_type' AND p.`ID` = pm.`post_id` THEN pm.`meta_value` END) AS discount_type, -- Discount type
Max(CASE WHEN pm.meta_key = 'coupon_amount' AND p.`ID` = pm.`post_id` THEN pm.`meta_value` END) AS coupon_amount, -- Coupon amount
Max(CASE WHEN pm.meta_key = 'free_shipping' AND p.`ID` = pm.`post_id` THEN pm.`meta_value` END) AS free_shipping, -- Allow free shipping
Max(CASE WHEN pm.meta_key = 'expiry_date' AND p.`ID` = pm.`post_id` THEN pm.`meta_value` END) AS expiry_date, -- Coupon expiry date
Max(CASE WHEN pm.meta_key = 'minimum_amount' AND p.`ID` = pm.`post_id` THEN pm.`meta_value` END) AS minimum_amount, -- Minimum spend
Max(CASE WHEN pm.meta_key = 'maximum_amount' AND p.`ID` = pm.`post_id` THEN pm.`meta_value` END) AS maximum_amount, -- Maximum spend
Max(CASE WHEN pm.m
@rupomkhondaker
rupomkhondaker / dynamically-generated-settings.php
Created March 13, 2021 18:44 — forked from johnregan3/dynamically-generated-settings.php
A method for dynamically generating Settings Fields in WordPress through the use of an anonymous function assigned to a variable variable. This could be expanded to generate different input types (hidden, text, textarea, and maybe a select), and to dynamically generate Setting Sections and Section Callbacks.
<?php
/*
* Dynamically Generated Checkboxes in a WordPress Settings Page
*
* This file is fully functional and ready to be used in a plugin or theme to generate this Settings Page
*
*/
Class Pizza_Shop {