Skip to content

Instantly share code, notes, and snippets.

@ppprakhar
ppprakhar / wp-install-latest.php
Last active October 3, 2022 17:57 — forked from thagxt/downunzip.php
Easiest way to download & extract zip files from a remote server to yours.
<?php
// Identify directories
$source = __DIR__ . "/wordpress";
$destination = __DIR__;
// Cycle through all source files
function move_all($source, $destination) {
if (is_dir($source)) {
// Make the destination directory if not exist
@mkdir($destination);
@ppprakhar
ppprakhar / image-shortcake-admin.js
Created September 22, 2022 19:59 — forked from vralle/image-shortcake-admin.js
Image-Shortcake: Fix 'media_send_to_editor' for WP Insert Media
function myTest() {
// Save default function
var defaultSend = wp.media.editor.send.attachment;
// new send function
wp.media.editor.send.attachment = function( props, attachment) {
// If not image, return default function
if ( 'image' !== attachment.type )
return defaultSend( props, attachment)
@ppprakhar
ppprakhar / admin.js
Created September 22, 2022 19:57 — forked from vralle/admin.js
Adding a Media Button to the WordPress Editor.
jQuery(function($) {
$(document).ready(function(){
$('#insert-my-media').click(open_media_window);
});
function open_media_window() {
if (this.window === undefined) {
this.window = wp.media({
title: 'Insert a media',
library: {type: 'image'},
@ppprakhar
ppprakhar / countries-with-code.js
Last active December 20, 2021 13:22
Get countries name with their country code
export const countries = [
{
"name": "Afghanistan",
"code": "AF"
},
{
"name": "Åland Islands",
"code": "AX"
},
{