Skip to content

Instantly share code, notes, and snippets.

<?
require('/blog/wp-load.php');
do_action('wp');
gravity_form(1, false, false, false, '', false);
?>
<?
# wp-config.php` above `/* That's all, ...` add:
define('SAVEQUERIES', true);
# in `functions.php` add:
add_action('admin_footer','show_load_issuendo');
function show_load_issuendo() {
<?
function color_me($phrase, $color = 2, $class = 'red') {
$words = explode(' ', $phrase);
$reconstructed_phrase = '<span class="'.$class.'">';
$hasclosed = false;
foreach ($words as $k => $word) {
if ($k == $color) {
$reconstructed_phrase .= "</span>";
$hasclosed = true;
}
<?= color_me("Hello World, I'm Foobar"); ?>
vi /var/qmail/control/rcpthosts
vi /var/qmail/control/virtualdomains
# then restart qmail
/etc/init.d/qmail restart
# You can keep an eye on things with the error log:
tail /usr/local/psa/var/log/maillog
<?
date_default_timezone_set('America/New_York'); //Eastern
echo date('r')."<br />";
time_test_1();
time_test_2();
function time_test_1() {
echo date('r')."<br />";
}
<?
$zip = new ZipArchive;
$res = $zip->open('wordpress.zip');
if ($res === TRUE) {
$zip->extractTo('/wordpress/');
$zip->close();
echo 'unziped!';
} else {
echo "can't unzip";
}
<?
add_action('wp', 'myplugin_schedule_cron');
add_action('myplugin_cronjob', 'myplugin_cron_function');
#add_action('wp_head', 'myplugin_cron_function'); //test
/*-------------------------------------------------------------
Name: myplugin_schedule_cron
Purpose: schedule cron on page load if not scheduled
Receive: - none -
@davidsword
davidsword / gist:ef6dda9734eeca6587dd40b906f1b9f4
Created September 14, 2016 21:52
wordpress-simple-cronjobs-2.php
<?
add_filter('cron_schedules', 'cron_add_intervals');
function cron_add_intervals( $schedules ) {
$schedules['weekly'] = array(
'interval' => 604800,
'display' => __('Weekly')
);
$schedules['monthly'] = array(
'interval' => 2629743,
'display' => __('Monthly')
<?
function get_youtube_embed_from_url($youtube_url = '',$width = '428', $height = '206', $autostart = true) {
$autply = ($autostart) ? '&autoplay=1' : '';
parse_str( parse_url( $youtube_url, PHP_URL_QUERY ) );
$subject = '<iframe width="'.$width.'" height="'.$height.'" src="http://youtube.com/embed/'.$v.'?theme=dark&modestbranding=0&rel=0'.$autply.'" frameborder="0"></iframe>';
return $subject;
}