The popular open-source contract for web professionals by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: March 15th 2016
- Original post
<?php | |
add_action( 'wp', 'schedule_task' ); | |
/* Let's schedule some tasks! */ | |
function schedule_task() { | |
if ( ! wp_next_scheduled( 'task_hook' ) ) { | |
// Add scheduled daily task | |
wp_schedule_event( time(), 'daily', 'task_hook'); | |
} | |
} | |
add_action( 'task_hook', 'function_to_run' ); |
$ # If you're using Drush with MAMP and DevDesktop, you'll have to either change your bash profile or (my preference) specify the path to the correct instance of Drush. | |
$ # This solves the "Command pm-update needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command" issue. | |
$ /Applications/DevDesktop/drush/drush |
─────────▄──────────────▄──── | |
────────▌▒█───────────▄▀▒▌─── | |
────────▌▒▒▀▄───────▄▀▒▒▒▐─── | |
───────▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐─── | |
─────▄▄▀▒▒▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐─── | |
───▄▀▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▀██▀▒▌─── | |
──▐▒▒▒▄▄▄▒▒▒▒▒▒▒▒▒▒▒▒▒▀▄▒▒▌── | |
──▌▒▒▐▄█▀▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐── | |
─▐▒▒▒▒▒▒▒▒▒▒▒▌██▀▒▒▒▒▒▒▒▒▀▄▌─ | |
─▌▒▀▄██▄▒▒▒▒▒▒▒▒▒▒▒░░░░▒▒▒▒▌─ |
Animals & Nature | |
Art | |
Celebrations | |
Celebrities | |
Comics & Cartoons | |
Eating & Drinking | |
Emoji & Expressions | |
Fashion | |
Gaming | |
Kids & Family |
<?php | |
/* This doesn't work and here's why not. | |
* | |
* The missing piece here has to do with rewrite rules. | |
* The registration process creates new rewrite rules during the process. | |
* This ensures the custom post type is set up appropriately. | |
* Modifying the url structure (which we're doing here) to hierarchical requires a change to the rewrite rules as well. | |
* | |
* The following is the first change you need to make. The rewrite change is not included here. | |
*/ |
// Run this from the command line. | |
// h/t: http://superuser.com/questions/91935/how-to-chmod-755-all-directories-but-no-file-recursively#answer-91966 | |
// add read/execute to world, remove write | |
chmod -R u+rwX,g+rwX,o+rX-w path/ | |
// remove read/write/execute from world | |
chmod -R u+rwX,g+rwX,o-rwX path/ |
# Siege attempts to recreate real traffic by using a CSV of urls to hit. | |
# This allows you to remove requests for assets, if you're running a CDN. | |
# | |
# c = concurrent users | |
# i = "like the internet would visit" | |
# b = benchmark (no delay needed) | |
# t = time | |
# f = file with urls 1 per line | |
siege -c100 -i -b -t120S -f urls.csv |
<?php | |
add_filter('the_content','add_my_content'); | |
function add_my_content($content) { | |
$my_custom_text = '<hr><div class="patreonpara"><p><em>PARAGRAPH TEXT</em></p><a href="LINKURL" data-patreon-widget-type="become-patron-button" class="patreonbutton"><img src="FILEURL"></a></div>'; | |
$my_custom_text_other = 'something else'; | |
if(is_single() && !is_home()) { | |
if(in_category('videos')) { | |
$content .= $my_custom_text_other; | |
} else { | |
$content .= $my_custom_text; |