Skip to content

Instantly share code, notes, and snippets.

@clintel
clintel / gist:1155906
Created August 19, 2011 02:40
Fenced code in bullet lists with GitHub-flavoured MarkDown??

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code
    
@franz-josef-kaiser
franz-josef-kaiser / paranoia-config.php
Last active July 29, 2022 10:01
WordPress debug - Error Reporting Level: Paranoia
<?php
define( 'DS', DIRECTORY_SEPARATOR );
# ==================================
# PHP errors & log
error_reporting(
E_ALL | E_STRICT | E_CORE_ERROR | E_CORE_WARNING
| E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE
| E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR
);
# OR: shorter and all together
@da1nonly
da1nonly / gist:2057532
Created March 17, 2012 10:55
wordpress meta box urls
<?php
add_action('admin_init', 'add_meta_boxes', 1);
function add_meta_boxes() {
add_meta_box( 'repeatable-fields', 'Audio Playlist', 'repeatable_meta_box_display', 'post', 'normal', 'high');
}
function repeatable_meta_box_display() {
global $post;
@franz-josef-kaiser
franz-josef-kaiser / curl_dump.php
Last active May 22, 2022 14:57
Debug and dump a WordPress cURL Request and it's response during a WP HTTP API call.
<?php
/**
* Plugin Name: Dump WP HTTP API cURL Request & Response
* Author: Franz Josef Kaiser
*/
add_action( 'plugins_loaded', array( 'WPSE81791_cURL', 'init' ) );
class WPSE81791_cURL
{
protected static $instance;
@jenovateurs
jenovateurs / SendMessageSlackWebhook.php
Last active November 8, 2021 00:54
Send Message With Webhook Slack using PHP
<?php
public static function sendMessage($sMessage){
$webhookurl = 'https://hooks.slack.com/services/WEBHOOK';
$timestamp = date("c", strtotime("now"));
$json_data = json_encode([
// Message
"text" => $sMessage
@thefuxia
thefuxia / t5-custom-logout-url.php
Created December 14, 2012 20:49
T5 Custom Log-out URL Create a custom log-out URL in WordPress.
<?php
/**
* Plugin Name: T5 Custom Log-out URL
* Description: Create a custom log-out URL.
* Plugin URI: http://wordpress.stackexchange.com/questions/76161/masking-logout-url
* Version: 2012.12.14
* Author: Thomas Scholz
* Author URI: http://toscho.de
* Licence: MIT
* License URI: http://opensource.org/licenses/MIT
@rmccue
rmccue / plugin-file.php
Created January 17, 2012 12:27 — forked from kovshenin/plugin-file.php
Improved class concept
<?php
/*****
All new versions will be posted at
https://github.com/rmccue/Rotor_WPPlugin
Please use that repository instead of this Gist.
******/
@kloon
kloon / gist:4228021
Created December 6, 2012 20:25
WooCommerce variations custom field
//Display Fields
add_action( 'woocommerce_product_after_variable_attributes', 'variable_fields', 10, 2 );
//JS to add fields for new variations
add_action( 'woocommerce_product_after_variable_attributes_js', 'variable_fields_js' );
//Save variation fields
add_action( 'woocommerce_process_product_meta_variable', 'variable_fields_process', 10, 1 );
function variable_fields( $loop, $variation_data ) {
?>
<tr>
@franz-josef-kaiser
franz-josef-kaiser / sys_bot.php
Last active August 4, 2020 06:29
Creates and maintains the SysBot User (which has the role of "editor"). Purpose of this bot user: You're importing data into a WordPress CustomPostType (for e.g.: via a HTTP request). During import/fetch you need a user who is the author of those CPTs posts. You could go with a fake ID, but this will successfully prevent you to use taxonomies, a…
<?php
defined( 'ABSPATH' ) OR exit;
/**
* Plugin Name: SysBot
* Description: Creates and maintains the SysBot User (which has the role of "editor")
* Author: Franz Josef Kaiser
*/
# PUBLIC API #
function get_bot()
@auser
auser / app.js
Last active October 11, 2017 03:01
The complete source for the http://www.ng-newsletter.com/posts/chrome-apps-on-angular.html article. Enjoy!
angular.module('myApp', ['ngRoute'])
.provider('Weather', function() {
var apiKey = "";
this.getUrl = function(type, ext) {
return "http://api.wunderground.com/api/" +
this.apiKey + "/" + type + "/q/" +
ext + '.json';
};