Skip to content

Instantly share code, notes, and snippets.

View moabi's full-sized avatar
🎯
Focusing

David Fieffé moabi

🎯
Focusing
View GitHub Profile
@moabi
moabi / wp_helper.sh
Created December 9, 2017 08:45 — forked from phlbnks/wp_helper.sh
Utility script to help manage WordPress sites on an EasyEngine server (but not limited to EE)
#!/bin/bash
# Help / usage info.
USAGE=$'WordPress Helper script, built for EasyEngine but should be widely compatible.\nWithout any args it will search /var/www/ for WordPress sites, loop over them in alphabetical order and check for core and plugin updates.\nAlso accepts:\n\t--sites=[space seperated list of site paths relative to /var/www]\n\t--update=[plugins|wp|all].'
# Die function for exiting on errors.
die () {
echo "${1}, exitting..." >&2 ; echo ; exit 1
}
@moabi
moabi / facebook-f.svg
Last active October 9, 2017 18:20
Add a social share in wordpress
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
RewriteEngine on
RewriteCond %{THE_REQUEST} public/
RewriteRule ^public/(.*) http://site.dev/$1 [R=301,L]
RewriteCond %{REQUEST_URI} !public/
RewriteRule ^(.*)$ /public/$1 [L]
@moabi
moabi / widget-terms.php
Last active May 8, 2017 07:52
add a widget for terms listing from a custom taxonomy with child, description, count options
<?php
/**
* Created by PhpStorm.
* User: david1
* Date: 07/05/2017
* Time: 13:32
*/
/**
* Adds Foo_Widget widget.
*/
@moabi
moabi / bulma_walker_nav_menu.php
Last active August 2, 2021 12:09
A wordpress walker for Bulma Nav component
<?php
/**
* Will add classes to create bulma menu in wordpress
* http://bulma.io/documentation/components/nav/
* Usage
* wp_nav_menu(array(
* 'theme_location' => 'primary',
* 'items_wrap' => '%3$s',
* 'container_class' => 'nav-right nav-menu',
* 'walker' => new bulma_walker_nav_menu
@moabi
moabi / Form_to_sessionStorage.js
Created December 29, 2016 08:48
store inputs/selects to sessionsStorage, if page is reloaded, set form inputs values
/**
* 1/ onLoad, retrieve session storage data (ALL OF IT !!! - so carefull)
* 2/ the key === input/select ID
* 3/ set the value
*/
window.onload = function () {
if (sessionStorage) {
for (i = 0; i < sessionStorage.length; i++) {
var key = sessionStorage.key(i);
var value = sessionStorage[key];
@moabi
moabi / pure_walker_nav_menu.php
Last active April 20, 2017 03:35
Wordpress walker nav menu to pure.css dropdown menu
<?php
/**
* Will add classes to create a pure.css dropdown menu
* Usage
* wp_nav_menu(array(
* 'theme_location' => 'primary',
* 'menu_class' => 'pure-menu-list',
* 'container_class' => 'pure-menu pure-menu-horizontal',
* 'walker' => new pure_walker_nav_menu
* ));
@moabi
moabi / README.md
Created January 21, 2016 10:52
Jekyll - list directories from a path

usage

{% directory_list directory:products/tea iterator:item sort:descending %}
  {{ item }}

{% enddirectory_list %}

@moabi
moabi / class-backend-tables.php
Created December 10, 2015 19:59 — forked from wturnerharris/class-backend-tables.php
This is an example of extending the default class for tables in the admin section, WP_List_Table. It does take some setup arguments, but works and looks seamlessly within WordPress.
<?php
if(!class_exists('WP_List_Table')) require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
/**
* Extended class for displaying a list of items in an HTML table.
*
* @usage
* // be sure to modify the display_rows function to customize the output of the rows
* $args = array(