Skip to content

Instantly share code, notes, and snippets.

@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
*/
@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);
@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' );
@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 = '/') {

#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

@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
@bonny
bonny / with-posts-wordpress-function.php
Last active May 9, 2016 18:50
WordPress function with_posts(), that simplifies getting and looping posts, in a jQuery anonymous function-ish way. Setups global, restores post afterwards. Simple, flexible and powerful.
<?php
/**
* WordPress WP_QUERY-wrapper to simplify getting and working with posts
*
* Does something with posts, using a callback
* Setups global post variable before running callback
* And restores it afterwards
*
* An introductionary blogpost about this function is posted on our blog:
@bonny
bonny / gist:5005579
Last active December 14, 2015 01:19
with_posts() WordPress function example usage
<?php
/**
* Examples for WordPress function with_posts()
*
* The main function is available here:
* https://gist.github.com/bonny/5011943
*
* Author and contact info:
* https//twitter.com/eskapism
@jruck
jruck / gist:4270084
Last active January 16, 2023 01:30
WP: Minimal wp_oembed_get
// Minimal YouTube & Vimeo embeds
function wp_oembed_get( $url, $args = '' ) {
if(preg_match("/youtube.com\/watch\?v=([^&]+)/i", $url, $aMatch)){
return '<iframe width="640" height="360" src="http://www.youtube.com/embed/' . $aMatch[1] . '?loop=1&modestbranding=1&rel=0&showinfo=0&autohide=1" frameborder="0" allowfullscreen></iframe>';
}
if(preg_match("/youtube.com\/watch\?feature=player_embedded&v=([^&]+)/i", $url, $aMatch)){
return '<iframe width="640" height="360" src="http://www.youtube.com/embed/' . $aMatch[1] . '?loop=1&modestbranding=1&rel=0&showinfo=0&autohide=1" frameborder="0" allowfullscreen></iframe>';
}