Skip to content

Instantly share code, notes, and snippets.

@webdev1001
webdev1001 / functions.php
Last active August 29, 2015 14:11 — forked from lmartins/functions.php
Add menu items programatically
add_filter( 'genesis_nav_items', 'be_follow_icons', 10, 2 );
add_filter( 'wp_nav_menu_items', 'be_follow_icons', 10, 2 );
/**
* Follow Icons in Menu
* @author Bill Erickson
* @link http://www.billerickson.net/genesis-wordpress-nav-menu-content/
*
* @param string $menu
* @param array $args
* @return string
@webdev1001
webdev1001 / functions.php
Last active August 29, 2015 14:11 — forked from lmartins/functions.php
Add markup with custom hook that runs inside it
add_action( 'genesis_after', 'mw_add_offcanvas' );
function mw_add_offcanvas()
{
$out = '<div class="shifter-navigation Sidebar-offcanvas">';
/**
* Using this hook:
* mw_add_offcanvas_sidebar
* mw_offcanvas_menu
*/
ob_start();
add_filter( 'wp_nav_menu_items', 'your_custom_menu_item', 10, 2 );
function your_custom_menu_item ( $items, $args ) {
if ($args->theme_location == 'header') {
$items .= '<li class="menu-item"><a id="openOptionsSidebar" class="shifter-handle">More</a></li>';
}
return $items;
}
<?php
$args = array(
'post_type' => 'product',
'meta_query' => array(
'relation' => 'OR',
array( // Simple products type
'key' => '_sale_price',
'value' => 0,
'compare' => '>',
'type' => 'numeric'
<?php
$args = array(
'post_type' => 'product',
'meta_key' => '_featured',
'meta_value' => 'yes',
'posts_per_page' => 6
);
$featured_query = new WP_Query( $args );
if ($featured_query->have_posts()) :
?>
'homepage' => array(
'existing_section' => false,
'args' => array(
'title' => __( 'HomePage Options', 'mw_theme_options' ),
'description' => __( 'Configure your homepage visualization options', 'mw_theme_options' ),
'priority' => 3
),
'fields' => array(
/*
* ==============
/**
* Sanitize File name during upload
* http://stackoverflow.com/questions/3259696/rename-files-during-upload-within-wordpress-backend
*/
function make_filename_hash($filename) {
$info = pathinfo($filename);
$ext = empty($info['extension']) ? '' : '.' . $info['extension'];
$name = basename($filename, $ext);
return md5($name) . $ext;
}
# Change Java Runtime:
sudo update-alternatives --config java
# Delete Open-JDK
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
# Change fonts - remove hinting:
http://askubuntu.com/questions/32624/ugly-fonts-in-netbeans-how-can-i-make-it-use-the-system-font
# Change RubyMine AntiAliasing first:
/*!
* Grunt
* $ npm install grunt-contrib-uglify grunt-autoprefixer grunt-contrib-cssmin grunt-contrib-imagemin grunt-contrib-sass grunt-contrib-watch grunt-contrib-concat grunt-contrib-clean grunt-contrib-jshint grunt-notify --save-dev
*/
module.exports = function(grunt) {
grunt.initConfig({
// Sass
<?php
/*
Author: Hans2103
credit: Jim Westergren, Jeedo Aquino & Flynsarmy
File: index-with-redis.php
Updated: 2013-05-27
This is a redis caching system for Wordpress based on Redis connection using PHPRedis.
https://github.com/nicolasff/phpredis