Skip to content

Instantly share code, notes, and snippets.

View davidroberto's full-sized avatar

David Robert davidroberto

View GitHub Profile
@davidroberto
davidroberto / autowp.sh
Created December 5, 2016 17:25
Bash script for wp install : create database, start mamp, download WP, define wp debug, generate password, install wp, clone a gulp based blank theme, generate posts etc...
#!/bin/bash -e
# define developpement root path
devdir=''
# define commercial dir
commdir=''
# define database root password
dbpass=''
@davidroberto
davidroberto / custom_walker_nav_menu.php
Created November 22, 2015 16:00
Add <h1> tag inside the <li> tag on current menu item: this walker class will check if the item url is the current page url, and if so will add the <h1> tag. Useful for SEO purpose.
class custom_walker_nav_menu extends Walker_Nav_Menu {
// add main/sub classes to li's and links
function start_el( &$output, $item, $depth, $args ) {
global $wp_query;
$indent = ( $depth > 0 ? str_repeat( "\t", $depth ) : '' ); // code indent
// depth dependent classes
$depth_classes = array(