Skip to content

Instantly share code, notes, and snippets.

View Njengah's full-sized avatar
👨‍💻
Coding & Learning Everyday

Joe Njenga Njengah

👨‍💻
Coding & Learning Everyday
View GitHub Profile
@retgef
retgef / wysiwyg-meta-box.php
Created September 10, 2011 02:06
How to add a Wordpress WYSIWYG editor to a meta box.
<?php
define('WYSIWYG_META_BOX_ID', 'my-editor');
define('WYSIWYG_EDITOR_ID', 'myeditor'); //Important for CSS that this is different
define('WYSIWYG_META_KEY', 'extra-content');
add_action('admin_init', 'wysiwyg_register_meta_box');
function wysiwyg_register_meta_box(){
add_meta_box(WYSIWYG_META_BOX_ID, __('WYSIWYG Meta Box', 'wysiwyg'), 'wysiwyg_render_meta_box', 'post');
}
@mattwiebe
mattwiebe / jquery.afterscroll.js
Created September 13, 2011 21:05
Do something after you scroll past a certain element. Maybe do something else when you scroll back above it.
/*!
* jQuery AfterScroll 1.0
*
* Do something once the bottom of an element comes into view,
* and something when you scroll above it too.
*
* (c) 2011 Matt Wiebe http://somadesign.ca/
* GPL2 / MIT dual-license, just like jQuery
* http://jquery.org/license/
*
@mattwiebe
mattwiebe / responsive-images.php
Created September 21, 2011 23:02
Mobile First Responsive Images for WordPress
<?php
/*
Plugin Name: Mobile First Responsive Images
Description: Serve up smaller images to smaller screens.
Version: 0.1.1
Author: Matt Wiebe
Author URI: http://somadesign.ca/
*/
/**
@luetkemj
luetkemj / wp-query-ref.php
Last active April 25, 2024 09:37
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@Abban
Abban / WordPress Theme Customizer Sample.php
Created June 21, 2012 21:09
WordPress Theme Customizer Sample
<?php
function themename_customize_register($wp_customize){
$wp_customize->add_section('themename_color_scheme', array(
'title' => __('Color Scheme', 'themename'),
'priority' => 120,
));
// =============================
@DavidWells
DavidWells / add-wordpress-settings-page.php
Created January 28, 2013 05:59
WordPress :: Add Settings Page with All Fields
<?php
/*
Plugin Name: Homepage Settings for BigBang
Plugin URI: http://www.inboundnow.com/
Description: Adds additional functionality to the big bang theme.
Author: David Wells
Author URI: http://www.inboundnow.com
*/
// Specify Hooks/Filters
@ideag
ideag / functions.php
Last active October 1, 2019 21:17
A very basic framework for creating front-end forms for WordPress.
<?php
// a framework to handle frontend form submission
// written by Arūnas Liuiza | tinyStudio | wp.tribuna.lt
// Usage: use [tiny_form1] shortcode or get_tiny_form1()/the_tiny_form1() template tags
// Arguments: one (optional) argument 'redirect': pass url where to redirect after successful login (default: false);
// Localization: replace 'theme' with your text domain string.
// ======= FORM 1 =====>
@phpfiddle
phpfiddle / fiddle_493421.php
Created September 1, 2013 21:49
Php color palette shade generator
<?php
class ColorPalette{
public $color;
public function __construct($color){
$this->color = $color;
}
public function color_mod($hex, $diff) {
$rgb = str_split(trim($hex, '# '), 2);
@aahan
aahan / WordPress Custom Global Variables.md
Last active March 28, 2024 19:26
Creating and using custom global variables in wordpress.

First create global variables (in functions.php or as a mu-plugin):

<?php

/*
 * CUSTOM GLOBAL VARIABLES
 */
function wtnerd_global_vars() {
@Arahnoid
Arahnoid / RGB-Hex.js
Last active December 27, 2022 21:32
[Convert color format] Bunch of RGB to Hex and Hex to RGB convert javascript functions what works well in Photoshop #Photoshop
///////////////////////////////////////////////////////////////////////////////////
/// Colection of RGB to HSB, HSB to RGB convert functions
/// Source: http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb
///////////////////////////////////////////////////////////////////////////////////
/**
* componentToHex convert two digit htx value to R, G or B chanel value
* @param number c value from 0 to 225
* @return string value of R, G or B chanel
* @usage //alert (componentToHex(255)); //ff