Skip to content

Instantly share code, notes, and snippets.

View mavisland's full-sized avatar
🤯
overthinking kills your happiness

Tanju Yıldız mavisland

🤯
overthinking kills your happiness
View GitHub Profile
<?php
/**
* Plugin Name: Static Templates
*
* If most of your site content is in .php template files, and you're tired of
* creating new pages, assigning them page templates, creating page templates
* then doing it all over again on production, this plugin is for you.
*
* Examples:
*
@mavisland
mavisland / php-style-guide.md
Created May 25, 2020 00:27 — forked from ryansechrest/php-style-guide.md
PHP style guide with coding standards and best practices.

PHP Style Guide

All rules and guidelines in this document apply to PHP files unless otherwise noted. References to PHP/HTML files can be interpreted as files that primarily contain HTML, but use PHP for templating purposes.

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Most sections are broken up into two parts:

  1. Overview of all rules with a quick example
  2. Each rule called out with examples of do's and don'ts
@mavisland
mavisland / setup-franz-ubuntu.sh
Created September 16, 2017 22:28 — forked from ruebenramirez/setup-franz-ubuntu.sh
setup franz on ubuntu
#!/bin/bash
sudo rm -fr /opt/franz
sudo rm -fr /usr/share/applications/franz.desktop
# create installation dir
sudo mkdir -p /opt/franz
#install franz
@mavisland
mavisland / output.txt
Last active June 8, 2017 05:48 — forked from james2doyle/slugify.php
Simple slugify function for PHP. Creates a slug for the passed string, taking into account international characters as well.
messd-up-text-just-to-stress-test-our-little-clean-url-function
pijamali-hasta-yagiz-sofore-cabucak-guvendi-saf-ve-haydut-kiz-cocugu-bin-plaj-gormus
peux-tu-maider-sil-te-plait
tank-efter-nu-forrn-vi-foser-dig-bort
aaaaaaaeceeeeiiiidnooooouuuuyssaaaaaaaeceeeeiiiidnooooouuuuyy
@mavisland
mavisland / first-things.sh
Created May 28, 2017 16:12 — forked from vaibhavmule/first-things.sh
First Thing To Do After Installing Any Linux OS.
echo "Updating" &&
sudo apt-get update
echo "Upgrading" &&
sudo apt-get dist-upgrade
echo "Cleaning Up" &&
sudo apt-get -f install &&
sudo apt-get autoremove &&
sudo apt-get -y autoclean &&
<?php
add_action( 'restrict_manage_posts', 'add_admin_taxonomy_filters' );
/**
* Filtering for 2 taxonomies, 'genres', and 'colors'
*/
function add_admin_taxonomy_filters() {
$screen = get_current_screen();
if ( ! isset( $screen->id ) || $screen->id !== 'edit-post' )
<?php
/**
* CMB Theme Options
* @version 0.1.0
*/
class myprefix_Admin {
/**
* Option key, and option page slug
* @var string