Skip to content

Instantly share code, notes, and snippets.

@thomasmb
thomasmb / statusboard-serverstats.php
Created April 10, 2013 14:05
A simple script for getting and displaying server stats in StatusBoard
<?php
//add your server aliases here
$servers = array(
"185.14.184.234" => "mcfly.bensmann.no",
"185.14.184.xxx" => "another.server.com",
);
//this script is triggered by this command from the terminal or cron:
//echo "time=`uptime`&df=`df -h`" | curl -s -d @- http://domain.com/path/to/script.php

#Sample Post H1

This is a sample post written in markdown. Markdown on Save Improved will ensure that when this post is saved, it will retain its syntax.

##Markdown Items (H2)

Writing Markdown is extremely simple, but incase you have problems you can read about the syntax of Markdown here, or read a useful cheat sheet here

###Lists

@novrian
novrian / yoast-bootstrap-breadcrumb.php
Last active March 14, 2019 16:09
Yoast Breadcrumb with Twitter Bootstrap Markup
<?php
/**
* Yoast Breadcrumbs on Twitter Bootstrap
*
* @author Novrian <[email protected]>
* @copyright (c) 2013. Novrian Y.F.
* @license MIT License
* @param string $sep Your custom separator
*/
function novrian_breadcrumbs($sep = '/') {
@svenl77
svenl77 / bootstrap-wordpress-default-widgets
Created August 7, 2013 12:38
Add Bootstrap classes to WordPress core html elements - default widgets and comments. If you want to build a WordPress theme using twitter bootstrap, this will help you to add all needed classes to html witch comes from functions inside WordPress like widgets and comments.
// first set the body to hide and show everyhthing when fully loaded ;)
document.write("<style>body{display:none;}</style>");
jQuery(document).ready(function(){
jQuery( 'input.search-field' ).addClass( 'form-control' );
// here for each comment reply link of wordpress
jQuery( '.comment-reply-link' ).addClass( 'btn btn-primary' );
@rohmann
rohmann / wp-debug-logging.php
Last active December 20, 2015 23:38
http://git.io/gJANNQ Enables debug logging for Wordpress.This snippet can be placed in wp-config.php to quickly setup debug logging. Adapted from: http://premium.wpmudev.org/forums/topic/the-right-way-to-debug-php-in-wordpress
define('WP_DEBUG', true);
/**
* When debug mode is enabled, you can enable logging to store errors in wp-content/debug.log
* This is useful for finding errors that might not get displayed on screen
*
* The next conditional section will make sure errors are not shown to users when logging is enabled
* This helps with quick troubleshooting on live sites
*/
define('WP_DEBUG_LOG', true);
@germanny
germanny / using-the-seo-plugin-to-the-max.md
Last active July 4, 2017 03:52
Google Plus stuff and PHP constants defined for Facebook Page ID, G+ Author Page, and Twitter Username from Yoast SEO plugin

Constants defined for Facebook Page ID, G+ Author Page, and Twitter Username

Using the Social fields in the SEO Plugin, we don't have to enter this data into the theme too:

/**
* Use Yoast SEO Plugin to create these constants
* http://wordpress.org/plugins/wordpress-seo/
* https://gist.github.com/germanny/6222479
*/
@halgatewood
halgatewood / pmpro-expire-at-end-of-year.php
Created November 20, 2013 16:09
Expire all membership levels at the end of the year. If the user registers after October (10 variable on line 8) then they'll expire in the next year.
/// EXPIRATION DATE
function my_pmpro_checkout_level($level)
{
$expiration_year = date('Y');
$current_month = date('n');
// IF OCT, NOV, DEC, EXPIRE NEXT YEAR
if($current_month >= 10) { $expiration_year++; }
$expiration_date = $expiration_year . "-12-31";
<?php
/**
* Add new classes to the $classes array
* http://codex.wordpress.org/Function_Reference/body_class#Add_Classes_By_Filters
*/
add_filter('body_class','my_class_names');
function my_class_names($classes) {
global $post;
if ( is_front_page() ) :
<?php
/**
* Delayed loading of typekit scripts vs Flicker-free loading
* Source: https://www.farbeyondcode.com/Delayed-loading-of-typekit-scripts-vs-Flicker-free-loading-5-2304.html
* Avg. Load Time: 66ms; 91ms; 113ms
*/
?>
<script type="text/javascript">
/* <![CDATA[ */
TypekitConfig = {