Skip to content

Instantly share code, notes, and snippets.

@lmartins
lmartins / installwp.sh
Last active September 6, 2015 21:45
Wordpress Install Plugins shell command Run with `sh installwp.sh`
#!/bin/sh
wp plugin install be-subpages-widget --activate
wp plugin install bulk-creator --activate
wp plugin install cookie-notice --activate
wp plugin install disable-comments --activate
wp plugin install jigsaw --activate
wp plugin install jetpack --activate
wp plugin install mailchimp --activate
wp plugin install mce-table-buttons --activate
wp plugin install menu-customizer --activate
@ericelliott
ericelliott / essential-javascript-links.md
Last active March 22, 2025 17:28
Essential JavaScript Links
@denji
denji / dnsmasq
Last active October 5, 2019 20:42
nginx config - dynamic virtual hosts
# sudo apt-get install dnsmasq
# echo "address=/.dev/127.0.0.1" | sudo tee /etc/dnsmasq.conf
# sudo update-rc.d dnsmasq enable
# sudo service dnsmasq restart
@amitgaur
amitgaur / kafkasetup
Created June 20, 2014 22:07
Kafka Setup on EC2 Instance
curl -O http://www.scala-lang.org/files/archive/scala-2.10.4.tgz
tar xvf scala-2.10.4.tgz
curl https://archive.apache.org/dist/kafka/0.8.1/kafka_2.10-0.8.1.tgz -O
tar zxvf kafka_2.10-0.8.1.tgz
export PATH=$PATH:$HOME/bin:/home/ec2-user/scala-2.10.4/bin:/home/ec2-user/kafka_2.10-0.8.1/bin
#Start Zookeeper
<?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:
*
@szbl
szbl / wp-singleton-namespace-example.php
Last active December 21, 2018 05:56
Quick Singleton class to be included in WordPress plugin (or theme functions.php file) that will create a simple Person post type and shows some methods of encapsulating functionality in a class as a "namespace," as well as applying filters to things, allowing other users to extend your code.
<?php
class Sizeable_Person
{
const POST_TYPE_SLUG = 'szbl-person';
public static $instance;
public static function init()
{
if ( is_null( self::$instance ) )
@gerbenvandijk
gerbenvandijk / Mark parent navigation active when on custom post type single page
Last active July 16, 2024 16:53
Mark (highlight) custom post type parent as active item in Wordpress Navigation.When you visit a custom post type's single page, the parent menu item (the post type archive) isn't marked as active. This code solves it by comparing the slug of the current post type with the navigation items, and adds a class accordingly.
<?php
function add_current_nav_class($classes, $item) {
// Getting the current post details
global $post;
// Get post ID, if nothing found set to NULL
$id = ( isset( $post->ID ) ? get_the_ID() : NULL );