Skip to content

Instantly share code, notes, and snippets.

View lordspace's full-sized avatar

Svetoslav Marinov lordspace

View GitHub Profile
@lordspace
lordspace / send_mail_delayed.php
Created January 4, 2014 08:31
This function schedules an email by passing -odd parameters to sendmail. Those emails will be processed depending on: /etc/sysconfig/sendmail (using 1h) if sendmail is running all the time otherwise you may have to start sendmail via cron
<?php
/**
* This function schedules an email by passing -odd paramaters to sendmail.
* Those emails will be processed depending on: /etc/sysconfig/sendmail (using 1h)
* if sendmail is running all the time.
*
* @param string $email recipient
* @param string $subject - subject
* @param string $message - the message
@lordspace
lordspace / functions.php
Last active December 31, 2015 21:39
Use this snippet as a starting point when overriding functions from the parent theme (functions.php). The snippet might look like it's missing a closing php tag but this is done so there are no extra spaces added.
<?php
/*
Make sure that the function name matches the function name in the parent theme's functions.php file.
Also in the parent theme there must be a block e.g. !function_exists('function_name_that_you_want_to_override')
that will tell you that it is safe to override that function.
*/
function function_name_that_you_want_to_override() {
}
@lordspace
lordspace / gist:7853704
Created December 8, 2013 05:29
How to return JSON from a WordPress plugin without an external plugin
<?php
/*
Plugin Name: Orbisius Sample Code
Plugin URI: http://club.orbisius.com/products/
Description: Sample plugin to return JSON
Version: 1.0.0
Author: Svetoslav Marinov (Slavi)
Author URI: http://orbisius.com
License: GPL v2
*/
@lordspace
lordspace / gist:5175010
Created March 16, 2013 04:36
Removes an error message shown by Limit Login Attempts WordPress plugin. NN attemmpts remaining. We don't need to give info to the attacker. Making error null solves half of the problem. There is a wrapper with a red border which we will remove with : login_error_message_hide_empty_error_container
add_filter('login_head', create_function('$a', "wp_enqueue_script('jquery');"));
add_filter('login_errors', 'login_error_message');
add_action('login_footer', 'login_error_message_hide_empty_error_container');
/**
* Removes an error message shown by Limit Login Attempts plugin.
* NN attempts remaining. We don't need to give info to the attacker.
* Making error null solves half of the problem. There is a wrapper with
* a red border which we will remove with : login_error_message_hide_empty_error_container
*