Skip to content

Instantly share code, notes, and snippets.

View Pirenko's full-sized avatar

Pirenko Pirenko

View GitHub Profile
@Pirenko
Pirenko / basic-hotel-booking-form.markdown
Created March 13, 2020 09:53
Basic hotel booking form
[instagram-feed type=user num=12 cols=6 showfollow=false imagepadding=0 imagepaddingunit=px showheader=false showcaption=false showlikes=false showbutton=false disablelightbox=true captionlinks=false]
<?php
/*
* Resize images dynamically using wp built in functions
* Victor Teixeira
* Tweaked by Pirenko
*
* php 5.2+
*
* Usage Sample:
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<!-- NAME: TELL A STORY -->
<!--[if gte mso 15]>
<xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
// Set up e-mail feature
$to = '[email protected]';
$subject = 'Welcome to our website!';
$headers = array('Content-Type: text/html; charset=UTF-8');
// Get username secret key
$user_info = get_user_by('email', $to );
$login_link='https://www.yourwebsite.com/wp-json/sand_login/prk_route?username='.$to.'&secret='.$user_info->secret_key;
// Create e-mail message
// Generate a password
$user_pass=randomPassword();
// Add user
$new_user=wp_create_user( "[email protected]", $user_pass , "[email protected]");
//Add secret key field
$secret_string=wp_generate_password( 8, false );
update_user_meta( $new_user, 'secret_key', $secret_string );
// Here's an example of the route we are creating
// https://www.yourwebsite.com/wp-json/sand_login/[email protected]&secret=6Uy11Uyl
// Register the rest route
add_action( 'rest_api_init', function () {
register_rest_route(
'sand_login',
'prk_route',
array(
'methods' => 'GET',
<?php
/*
Copyright 2018 - Pirenko Studio
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CO
@Pirenko
Pirenko / vt_resize.php
Last active April 4, 2021 04:50
vt_resize.php
<?php
/*
* Resize images dynamically using wp built in functions
* Victor Teixeira
* Tweaked by Pirenko
*
* php 5.2+
*
* Usage Sample:
<?php
/**
* @author Dimas Begunoff
* @copyright Copyright (c) 2009, Dimas Begunoff, http://farinspace.com
* @license http://en.wikipedia.org/wiki/MIT_License The MIT License
* @package WPAlchemy
* @version 1.5
* @link http://github.com/farinspace/wpalchemy
* @link http://farinspace.com