Skip to content

Instantly share code, notes, and snippets.

View sabrysuleiman's full-sized avatar

Sabry Suleiman sabrysuleiman

View GitHub Profile
@sabrysuleiman
sabrysuleiman / minify.php
Created August 26, 2019 09:01
A small PHP-Script for minifying CSS
<?php
// specify your css-files and their order here
$cssFiles = array(
'normalize.css', 'style.css', 'print.css', 'colorbox.css'
);
// the file to write the compressed css to
$minFileName = 'minified.css';
// thats all, just call this file in your browser and it will
// build you a minimized css-file. then just link to this single
@sabrysuleiman
sabrysuleiman / php-html-css-js-minifier.php
Created August 26, 2019 09:20 — forked from Rodrigo54/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {
/**
* Unhook all action with some exception on wp_head and wp_footer
*/
function fr_unhook_wp_head_footer(){
global $wp_filter; // Where all the hooks and their actions are stored
// Actions that should not be removed from the wp_head hook
$wp_head_whitelist = array( 'wp_enqueue_scripts', 'wp_print_styles', 'wp_print_head_scripts' );
// Unhook actions from wp_head
@sabrysuleiman
sabrysuleiman / Simple Ajax Login Form.php
Created September 26, 2019 14:54 — forked from cristianstan/Simple Ajax Login Form.php
Wordpress: Simple Ajax Login Form
<?php
//Simple Ajax Login Form
//Source: http://natko.com/wordpress-ajax-login-without-a-plugin-the-right-way/
//html
<form id="login" action="login" method="post">
<h1>Site Login</h1>
<p class="status"></p>
<label for="username">Username</label>
<input id="username" type="text" name="username">
@sabrysuleiman
sabrysuleiman / functions.php
Created September 26, 2019 14:54 — forked from vishalbasnet23/functions.php
User Registration Front End WordPress with Ajax
<?php
add_action('wp_ajax_register_user_front_end', 'register_user_front_end', 0);
add_action('wp_ajax_nopriv_register_user_front_end', 'register_user_front_end');
function register_user_front_end() {
$new_user_name = stripcslashes($_POST['new_user_name']);
$new_user_email = stripcslashes($_POST['new_user_email']);
$new_user_password = $_POST['new_user_password'];
$user_nice_name = strtolower($_POST['new_user_email']);
$user_data = array(
'user_login' => $new_user_name,
@sabrysuleiman
sabrysuleiman / wp-query-ref.php
Created January 22, 2020 22:25 — forked from luetkemj/wp-query-ref.php
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
*/
@sabrysuleiman
sabrysuleiman / fix-wordpress-permissions.sh
Created April 3, 2020 19:08 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@sabrysuleiman
sabrysuleiman / OtTaxonomiesMetabox.php
Created April 12, 2020 05:06 — forked from merianos/OtTaxonomiesMetabox.php
WordPress Taxonomies / Users MetaBox using OptionTree
<?php
/**
* Created by PhpStorm.
* User: merianos
* Date: 6/7/2018
* Time: 8:39 μμ
*/
class OtTaxonomiesMetabox {
@sabrysuleiman
sabrysuleiman / taxonomy-radio-metabox.php
Created April 12, 2020 05:12 — forked from jtsternberg/taxonomy-radio-metabox.php
Removes and replaces the built-in taxonomy metabox with our radio-select metabox.
<?php
if ( !class_exists( 'WDS_Taxonomy_Radio' ) ) {
/**
* Removes and replaces the built-in taxonomy metabox with our radio-select metabox.
* @link http://codex.wordpress.org/Function_Reference/add_meta_box#Parameters
*/
class WDS_Taxonomy_Radio {
// Post types where metabox should be replaced (defaults to all post_types associated with taxonomy)
@sabrysuleiman
sabrysuleiman / meta-tags.md
Created April 28, 2020 05:19 — forked from lancejpollard/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">