Skip to content

Instantly share code, notes, and snippets.

View klebinhopk's full-sized avatar
🏠
Working from home

Kleber Pereira klebinhopk

🏠
Working from home
View GitHub Profile
@klebinhopk
klebinhopk / functions.php
Created July 20, 2016 22:40 — forked from lenivene/functions.php
Insert thumbnail (attachment) post by url
<?php
/**
* Insert thumbnail by URL
* Is very good to execute wp_insert_post
*
* @author Lenivene Bezerra
* @param string $url Image url external or no
* @param int $post_ID Post id to insert thumbnail
* @return ID Thumbnail | WP_Error
*/
@taufik-nurrohman
taufik-nurrohman / php-html-css-js-minifier.php
Last active March 20, 2025 17:17
PHP Function to Minify HTML, CSS and JavaScript
<?php
// Based on <https://github.com/mecha-cms/x.minify>
namespace x\minify\_ { // start namespace
$n = __NAMESPACE__;
\define($n . "\\token_boolean", '\b(?:true|false)\b');
\define($n . "\\token_number", '-?(?:(?:\d+)?\.)?\d+');